
/* The two pages intentionally use the same shell, header and background.
   Keep layout changes here to prevent jumps when navigating between URLs. */
.site-shell { position: relative; overflow: clip; min-height: 100vh; isolation: isolate; }
.site-shell::before { content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none; background-image: linear-gradient(rgba(118, 157, 188, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(118, 157, 188, .04) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(#000 0%, rgba(0,0,0,.9) 28%, transparent 85%); }
.site-shell::after { content: ''; position: absolute; inset: 0; z-index: 10; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 4px, rgba(0,0,0,.047) 5px); }
.background-glow { position: absolute; z-index: -1; top: 130px; left: 47%; width: 830px; height: 830px; transform: translateX(-15%); background: radial-gradient(circle, rgba(58,176,191,.095), transparent 67%); pointer-events: none; }
.topbar, .site-header, .site-shell > main, .site-footer { max-width: 1400px; margin-inline: auto; padding-inline: clamp(24px, 5.5vw, 88px); }
.topbar { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(142, 174, 191, .19); font: 10px/1.5 var(--font-mono); letter-spacing: .105em; color: #768798; }
.topbar-left, .topbar-right { display: flex; gap: 9px; align-items: center; }
.tiny-symbol { color: #b3ff70; font-size: 16px; }
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #b3ff70; box-shadow: 0 0 9px #b3ff70; }
.topbar-separator { color: #3b4a5a; padding: 0 5px; }
.site-header { min-height: 106px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 15px; text-decoration: none; color: #eef3f4; }
.brand-symbol { display: grid; place-items: center; width: 47px; height: 47px; background: #b3ff70; color: #080b12; font: 800 28px/1 sans-serif; clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 22% 100%, 0 78%); }
.brand-name { font: 800 26px/.82 var(--font-display); letter-spacing: .035em; }
.brand-slash { color: #b3ff70; margin-inline: 1px; }
.brand-name small { display: block; margin-top: 8px; font: 9px/1 var(--font-mono); letter-spacing: .18em; color: #7f8e9b; }
.header-actions { display: flex; align-items: center; gap: clamp(18px, 3vw, 46px); }
.library-link { font: 10px/1.3 var(--font-mono); letter-spacing: .045em; text-decoration: none; color: #b5c1ca; transition: color .18s; white-space: nowrap; }
.library-link:hover { color: #b3ff70; }
.library-link span { color: #b3ff70; font-size: 14px; margin-left: 4px; }
.header-cards-link { font:10px/1.3 var(--font-mono); letter-spacing:.045em; color:#b3ff70;text-decoration:none;white-space:nowrap; }
.header-cards-link:hover { color:#fff; }
.header-cards-link span { font-size:14px;margin-left:3px; }
.install-button { cursor: pointer; border: 1px solid #4b626d; background: rgba(11,17,26,.92); padding: 12px 17px; font: 11px/1 var(--font-mono); color: #d8f6ef; letter-spacing: .06em; display: none; align-items: center; gap: 13px; transition: border-color .2s, background .2s, transform .2s; white-space: nowrap; }
.install-button:hover { border-color: #b3ff70; background: #152322; transform: translateY(-2px); }
.install-glyph { color: #b3ff70; font-size: 19px; line-height: .65; }
@media (max-width: 900px) { .header-actions { gap: 18px; } }
@media (max-width: 850px) { .topbar-right { display: none; } .site-header { min-height: 88px; } }
@media (max-width: 650px) { .header-cards-link { display: none; } }
/* Show the install action on phones and small touch devices without
   depending on an install-prompt event (many browsers never dispatch it). */
@media (max-width: 650px), (max-width: 1024px) and (hover: none) and (pointer: coarse) {
  .site-header .install-button:not([hidden]) { display: inline-flex; }
}
@media (max-width: 600px) {
  .topbar, .site-header, .site-shell > main, .site-footer { padding-inline: 20px; }
  .topbar { min-height: 30px; font-size: 8px; letter-spacing: .03em; }
  .site-header { min-height: 78px; }
  .brand-symbol { width: 40px; height: 40px; font-size: 24px; }
  .brand { gap: 11px; }
  .brand-name { font-size: 23px; }
  .brand-name small { font-size: 7px; margin-top: 7px; }
  .library-link { display: none; }
  .install-button { font-size: 9px; padding: 11px 11px; gap: 8px; }
  .install-glyph { font-size: 15px; }
}

/* Shared mobile install dialog and its controls. */
.primary-link { border: 0; background: var(--mint); color: #08120b; text-decoration: none; min-height: 52px; display: inline-flex; justify-content: space-between; align-items: center; gap: 28px; padding: 0 19px 0 22px; font: 500 11px/1 var(--font-mono); letter-spacing: .035em; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }
.primary-link:hover { background: #d0ffa2; transform: translateY(-3px); box-shadow: 0 9px 32px rgba(179,255,112,.14); }
.primary-link span { font-size: 19px; }
.section-kicker { display: inline-flex; gap: 10px; align-items: center; font: 11px var(--font-mono); color: var(--mint); letter-spacing: .06em; }
.install-dialog { width: min(430px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); overflow: auto; background: #131d26; border: 1px solid rgba(179,255,112,.65); color: var(--ink); padding: 26px; box-shadow: 0 30px 110px rgba(0,0,0,.7); }
.install-dialog::backdrop { background: rgba(2,5,11,.82); backdrop-filter: blur(8px); }
.dialog-top { display: flex; justify-content: space-between; align-items: center; }
.dialog-close { cursor: pointer; background: none; border: 0; font-size: 30px; color: #a7bac2; padding: 0 2px; }
.dialog-close:hover { color: var(--mint); }
.dialog-symbol { display: grid; place-items: center; margin-top: 29px; background: var(--mint); color: var(--bg); width: 68px; height: 68px; font-size: 38px; clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 22% 100%, 0 78%); }
.install-dialog h2 { font: 800 52px/.89 var(--font-display); margin: 22px 0 13px; }.install-dialog h2 span { color: var(--mint); }
.install-dialog p { font: 14px/1.8 var(--font-body); color: #b2c4c9; margin-bottom: 26px; }
.dialog-done { width: 100%; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; color: #122112; background: var(--mint); font: 11px/1.5 var(--font-mono); padding: 15px 20px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s,transform .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

/* Single-document route transitions: the shared header/background never remount. */
.topbar { view-transition-name: kana-topbar; }
.site-header { view-transition-name: kana-site-header; }
.site-footer { view-transition-name: kana-footer; }
::view-transition-old(kana-topbar), ::view-transition-new(kana-topbar),
::view-transition-old(kana-site-header), ::view-transition-new(kana-site-header),
::view-transition-old(kana-footer), ::view-transition-new(kana-footer) { animation: none; }
.route-view[hidden] { display: none !important; }
.game-view { padding-top: clamp(22px, 4vw, 52px); padding-bottom: 44px; }
.game-view-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding-bottom: 24px; }
.game-view-heading h1 { margin: 18px 0 0; font: 800 clamp(54px, 7vw, 96px)/.87 var(--font-display); letter-spacing: -.015em; }
.game-view-heading h1 span { color: var(--mint); }
.game-view-counter { color: #79909a; font: 9px/1.5 var(--font-mono); letter-spacing: .11em; white-space: nowrap; }
/* Game is a regular in-document module; there is no frame or nested scrolling. */
.game-view #kanaGame { width: 100%; min-width: 0; }
/* One continuous active-route rule beneath both the label and arrow.
   Text-decoration drew separate underline fragments because the arrow span
   has a different font size and baseline. */
.library-link[aria-current="page"], .header-cards-link[aria-current="page"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #b3ff70;
  text-decoration: none;
}
.library-link[aria-current="page"]::after,
.header-cards-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 1px;
  background: rgba(179,255,112,.45);
  pointer-events: none;
}
/* We animate only the view, not the surrounding app chrome. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .13s ease-in both kana-route-out; }
::view-transition-new(root) { animation: .19s ease-out both kana-route-in; }
@keyframes kana-route-out { to { opacity: .2; } }
@keyframes kana-route-in { from { opacity: .2; } to { opacity: 1; } }
@media(max-width: 850px) {
  .game-view-counter { display: none; }
}
@media(max-width: 650px) {
  .site-header { flex-wrap: wrap; padding-top: 15px; padding-bottom: 15px; row-gap: 14px; }
  .header-actions { width: 100%; justify-content: space-between; gap: 16px; }
  .header-cards-link, .library-link { display: inline-flex; align-items: center; font-size: 9px; }
  .game-view-heading h1 { font-size: clamp(49px, 11vw, 75px); }
}
@media(max-width: 380px) {
  .header-actions { gap: 10px; }
  .header-cards-link, .library-link { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0ms !important; }
}
