/* RKT ACADEMY - base: reset, type, layout, buttons, header, navigation, footer, motion preferences */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; color-scheme: dark; scroll-padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 16px; line-height: 1.55; min-height: 100vh; min-height: 100svh; overflow-x: hidden; -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility; }
body.modal-open { overflow: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: var(--fact); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 700; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 6.4vw, 3rem); }
h2 { font-size: clamp(1.2rem, 3.4vw, 1.55rem); margin-top: 1.6em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .8rem; }
.dim { color: var(--dim); }
.center { text-align: center; }
.mono { font-family: var(--f-mono); }
.lead { font-size: clamp(1rem, 2.3vw, 1.15rem); color: var(--text2); max-width: 62ch; }
.kicker { display: block; font-family: var(--f-mono); font-size: .7rem; font-weight: 600; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: .6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 max(16px, var(--safe-l)) 0 max(16px, var(--safe-r)); }
.view { min-height: 60vh; }
.view:focus, .view:focus-visible { outline: none; }
.view.enter { animation: viewIn .28s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page { max-width: 1200px; margin: 0 auto; padding: 20px max(16px, var(--safe-l)) 40px max(16px, var(--safe-r)); }
.page.narrow { max-width: 780px; }
.err { background: var(--bad-soft); border: 1px solid var(--bad); padding: 12px; overflow: auto; font-family: var(--f-mono); font-size: .8rem; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 6px; color: var(--dim); font-size: .9rem; }
.back:hover { color: var(--text); text-decoration: none; }

/* atmosphere: one soft light from the top, nothing animated */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(900px 380px at 50% -140px, rgba(255,122,61,.075), transparent 70%), var(--bg); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; z-index: 200; border-radius: 8px; font-weight: 700; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--fact); outline-offset: 2px; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn { --c: var(--accent); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
  font-family: var(--f-display); font-weight: 700; font-size: .95rem; letter-spacing: .01em; line-height: 1; text-decoration: none !important; color: var(--accent-ink); background: var(--c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 1px 0 rgba(0,0,0,.4); touch-action: manipulation; transition: transform .12s var(--ease), filter .15s, background .15s, box-shadow .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(.992); filter: brightness(.96); }
.btn.big { min-height: 54px; font-size: 1rem; padding: 0 28px; border-radius: 14px; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: .85rem; }
.btn.play, .btn.mag { --c: var(--accent); color: var(--accent-ink); }
.btn.ghost { color: var(--text); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2); }
.btn.ghost:hover { background: var(--raise); filter: none; box-shadow: inset 0 0 0 1px var(--dim); }
.btn.quiet { background: transparent; color: var(--text2); box-shadow: none; }
.btn.danger { --c: var(--bad); color: #fff; }
.btn[disabled] { opacity: .6; cursor: not-allowed; filter: grayscale(.5); }
.btn .arr { transition: transform .15s var(--ease); } .btn:hover .arr { transform: translateX(3px); }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 1rem; touch-action: manipulation; }
.icon-btn:hover { border-color: var(--line2); background: var(--panel2); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 1rem 0; }

/* ---------- logo: slot-trajectory mark + wordmark ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.logo-mark { width: 30px; height: 30px; flex: none; } .logo-mark svg, .logo-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.logo-word { font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; letter-spacing: .02em; line-height: 1; white-space: nowrap; }
.logo-word b { font-weight: 700; } .logo-word i { font-style: normal; font-weight: 500; color: var(--text2); margin-left: .28em; letter-spacing: .1em; }
.logo.small .logo-mark { width: 26px; height: 26px; } .logo.small .logo-word { font-size: 1rem; }
.svg { display: inline-block; line-height: 0; } .svg svg { width: 100%; height: 100%; }

/* ---------- header + navigation ---------- */
.topbar { position: relative; z-index: 60; background: rgba(11,14,18,.92); border-bottom: 1px solid var(--line); padding-top: var(--safe-t); }
.bar { display: flex; align-items: center; justify-content: space-between; height: var(--top-h); gap: 12px; }
.brand { display: flex; align-items: center; text-decoration: none !important; min-height: 44px; }
.nav { display: none; gap: 2px; }
.nav a { white-space: nowrap; color: var(--dim); font-family: var(--f-display); font-weight: 600; font-size: .9rem; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--accent); }
.bar-right { display: flex; align-items: center; gap: 8px; }
.profile-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none !important; }
.profile-chip:hover { border-color: var(--line2); }
.profile-chip .chip-t { display: grid; line-height: 1.1; } .profile-chip b { font-size: .8rem; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip small { color: var(--accent); font-family: var(--f-mono); font-size: .65rem; font-weight: 600; }
.profile-chip .av { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: block; }
.who .av { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: block; }
/* Narrow phones (375 px and below): the logo, the profile chip and the gear no longer fit on one row at the default sizes, which pushed the header
   10 px past the viewport. Same logo, same words: slightly smaller type and tighter gaps. */
@media (max-width: 389px) {
  .bar { gap: 8px; } .bar-right { gap: 6px; }
  .brand .logo { gap: 8px; } .brand .logo-word { font-size: 1rem; } .brand .logo-word i { margin-left: .2em; letter-spacing: .06em; }
  .profile-chip { padding-right: 8px; gap: 6px; } .profile-chip b { max-width: 7ch; }
}
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(16,21,27,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .22s var(--ease); will-change: transform; transform: translateZ(0); }
.tabbar::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 240px; background: var(--panel); pointer-events: none; }
.tabbar a { position: relative; display: grid; place-items: center; align-content: center; gap: 3px; color: var(--dim); font-size: .66rem; font-weight: 600; letter-spacing: .02em; text-decoration: none; min-height: var(--tab-h); }
.tabbar a .svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--text); } .tabbar a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px; }
.tabbar a.todo::after { content: ""; position: absolute; top: 9px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel); }
@media (max-width: 1099px) { body.bar-hidden .tabbar { transform: translateY(100%); } }
.in-game .tabbar, .in-game .footer { display: none; } .in-game .view { padding-bottom: calc(var(--safe-b) + 16px); }
@media (min-width: 1100px) {
  html { scroll-padding-bottom: 24px; scroll-padding-top: calc(var(--top-h) + 20px); }
  .topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); padding-top: 0; }
  .nav { display: flex; } .tabbar { display: none; }
  .view { padding-top: var(--top-h); padding-bottom: 0; }
  .in-game .view { padding-top: var(--top-h); }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 36px 0 calc(var(--tab-h) + var(--safe-b) + 32px); margin-top: 24px; }
.foot-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
.foot-grid > div > b { display: block; font-family: var(--f-mono); font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; color: var(--dim); }
.foot-grid a { display: block; color: var(--text2); padding: 6px 0; font-size: .9rem; } .foot-grid a:hover { color: var(--text); }
@media (min-width: 720px) { .foot-grid { grid-template-columns: 1.2fr 1fr 1fr 1.4fr; } }
@media (min-width: 1100px) { .footer { padding-bottom: 28px; } }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
p, li, dd, td { overflow-wrap: break-word; }
.bullets li, .faq-a p { overflow-wrap: anywhere; }

@media (max-width: 359px) { .profile-chip { display: none; } .logo-word { font-size: 1rem; } }
