/* geo app styles: icon classes + page layouts. Tokens only. */
.i-archive { --i: url(../icons/archive.svg); }
.i-arrow-left { --i: url(../icons/arrow-left.svg); }
.i-arrow-right { --i: url(../icons/arrow-right.svg); }
.i-calendar { --i: url(../icons/calendar.svg); }
.i-chart-column { --i: url(../icons/chart-column.svg); }
.i-check { --i: url(../icons/check.svg); }
.i-chevron-down { --i: url(../icons/chevron-down.svg); }
.i-chevron-up { --i: url(../icons/chevron-up.svg); }
.i-dice-5 { --i: url(../icons/dice-5.svg); }
.i-flag { --i: url(../icons/flag.svg); }
.i-info { --i: url(../icons/info.svg); }
.i-lock { --i: url(../icons/lock.svg); }
.i-log-out { --i: url(../icons/log-out.svg); }
.i-menu { --i: url(../icons/menu.svg); }
.i-repeat-2 { --i: url(../icons/repeat-2.svg); }
.i-search { --i: url(../icons/search.svg); }
.i-settings { --i: url(../icons/settings.svg); }
.i-share-2 { --i: url(../icons/share-2.svg); }
.i-shuffle { --i: url(../icons/shuffle.svg); }
.i-trophy { --i: url(../icons/trophy.svg); }
.i-users { --i: url(../icons/users.svg); }
.i-x { --i: url(../icons/x.svg); }

/* ---------- shell ---------- */
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: var(--space-2); top: var(--space-2); z-index: 100; background: var(--surface); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.app-header .spacer { flex: 1; }
.menu-btn { display: inline-grid; }
@media (min-width: 960px) { .menu-btn { display: none; } }
.header-game { font-weight: 700; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 960px) { .header-game { display: none; } }
.user-link { font-size: var(--fs-sm); font-weight: 700; color: var(--text); text-decoration: none; padding: var(--space-2); border-radius: var(--radius-sm); max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link:hover { background: var(--surface-sunken); }
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(320px, 85vw); border: 0; padding: var(--space-5); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
dialog.drawer::backdrop { background: color-mix(in srgb, var(--overlay) 50%, transparent); }
.drawer nav { display: grid; gap: var(--space-1); margin-top: var(--space-4); }
.drawer nav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); color: var(--text); text-decoration: none; font-weight: 700; }
.drawer nav a:hover { background: var(--surface-sunken); }
.drawer nav a .game-badge { width: 32px; height: 32px; box-shadow: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.site-footer { text-align: center; font-size: var(--fs-xs); color: var(--text-subtle); padding: var(--space-6) var(--gutter) var(--space-7); }
.site-footer a { color: inherit; }
.page-wide { max-width: var(--content-wide); }
.stack { display: grid; gap: var(--space-3); }
.stack-lg { display: grid; gap: var(--space-5); }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.center { text-align: center; }
a { color: var(--accent); }
.lead { color: var(--text-muted); margin: 0; }
h2.section { font-size: var(--fs-lg); margin: var(--space-6) 0 var(--space-3); }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); font-size: var(--fs-sm); }
.notice.error { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.notice.ok { background: var(--hit); color: var(--on-hit); font-weight: 700; }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--space-1); }
.field label { font-size: var(--fs-sm); font-weight: 700; }
.field input { height: 48px; padding: 0 var(--space-3); border: 2px solid var(--border-input); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: 500 var(--fs-base) var(--font-sans); width: 100%; }
.field input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.field .hint { margin: 0; font-size: var(--fs-xs); color: var(--text-muted); }
.auth { max-width: 400px; margin: var(--space-7) auto; }
.auth h1 { font-size: var(--fs-xl); margin-bottom: var(--space-2); }
.code { font: 700 var(--fs-lg) var(--font-mono); letter-spacing: .12em; }
.copy-field { display: flex; gap: var(--space-2); }
.copy-field input { flex: 1; min-width: 0; height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--text); font: 500 var(--fs-sm) var(--font-sans); }

/* ---------- hub ---------- */
.hub-title { font-size: var(--fs-xl); text-align: center; }
.game-card.soon { opacity: .7; }
.game-card .row .spacer { flex: 1; }
.board-mini { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.board-mini td, .board-mini th { padding: var(--space-2); text-align: left; border-top: 1px solid var(--border); }
.board-mini th { font-weight: 500; color: var(--text-muted); font-size: var(--fs-xs); border-top: 0; }
.board-mini tr.me td { font-weight: 700; background: var(--surface-sunken); }
.state-open { color: var(--text-subtle); }
.state-playing { color: var(--text-muted); font-style: italic; }
.chip-late { background: var(--near); color: var(--on-near); }

/* ---------- game page ---------- */
.game-root { display: grid; gap: var(--space-4); }
.game-root[aria-busy="true"] { opacity: .6; }
.top-row { display: flex; justify-content: space-between; align-items: end; }
.counter .lbl { font-size: var(--fs-xs); color: var(--text-muted); display: block; }
.counter .val { font-size: var(--fs-xl); font-weight: 800; line-height: 1; }
.guess-list { display: grid; gap: var(--space-3); }
.guess-enter { animation: pop-in var(--motion-slow) var(--motion-spring); }
@keyframes pop-in { from { transform: translateY(-8px) scale(.98); opacity: 0; } }
.reveal { display: flex; gap: var(--space-5); align-items: center; justify-content: center; }
.reveal img.flag-lg { width: 120px; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px var(--border); }
.shape-mask { width: 110px; height: 90px; background: var(--shape-fill, var(--accent)); -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat; }
.answer-name { font-size: var(--fs-xl); font-weight: 800; }
.facts { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-4); font-size: var(--fs-sm); text-align: left; margin: 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; }
.toast-host { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); z-index: 50; display: grid; gap: var(--space-2); justify-items: center; pointer-events: none; }
.toast { animation: pop-in var(--motion-base) var(--motion-ease); }
.archive-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.archive-list a { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); text-decoration: none; box-shadow: var(--shadow-card); }
.archive-list a:hover { background: var(--surface-sunken); }
.archive-list .no { font-weight: 800; min-width: 4ch; }
.archive-list .chip { margin-left: auto; }
.result-card { margin-top: var(--space-2); }
.result-card h2 { font-size: var(--fs-lg); }
.groups-results { width: 100%; display: grid; gap: var(--space-4); text-align: left; }
.groups-results h3 { font-size: var(--fs-base); margin-bottom: var(--space-1); }
.how-to p { margin: 0 0 var(--space-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-sunken), var(--surface), var(--surface-sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-md); min-height: 52px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.err-box { text-align: center; padding: var(--space-6) 0; }
.h3 { font-size: var(--fs-lg); line-height: var(--lh-lg); margin: 0; }
.section-gap { margin-top: var(--space-4); }
ul.stack { padding-left: var(--space-5); }
.board-mini .locked { filter: blur(4px); user-select: none; }
.empty img { width: 96px; height: 96px; border-radius: var(--radius-lg); opacity: .9; }
.tile-flag { width: 100%; height: auto; max-height: 70%; object-fit: contain; border-radius: 2px; box-shadow: 0 0 0 1px var(--border); }
.tile-shape { width: 100%; height: 100%; min-height: 48px; --shape-fill: color-mix(in srgb, var(--accent) 75%, var(--surface)); }
.tile:has(.tile-shape) { place-content: stretch; padding: var(--space-2); }
.group-banner .flag { display: block; margin: 0 auto var(--space-1); box-shadow: 0 0 0 1px var(--border); }
.tiles.solution { width: 100%; }
.vs-flag { width: 120px; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px var(--border); }
.chain { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); text-align: left; }
.chain li { display: flex; gap: var(--space-3); align-items: center; font-size: var(--fs-sm); }
.chain li b { margin-left: auto; }
details.solution { width: 100%; text-align: left; }
details.solution summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.rankle-current { display: grid; justify-items: center; gap: var(--space-2); text-align: center; }
.rankle-current .flag-lg { width: 160px; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px var(--border); }
.rankle-current .answer-name, .rankle-current p { margin: 0; }
.result .cat-list { width: 100%; }
.paint-flag { width: min(280px, 100%); }
.paint-flag svg { width: 100%; height: auto; display: block; border-radius: 4px; box-shadow: 0 0 0 1px var(--border); }
.paint-slot { fill: var(--paint, url(#geo-chk)); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); width: 100%; }
.compare figure { margin: 0; display: grid; gap: var(--space-2); justify-items: center; font-size: var(--fs-sm); font-weight: 700; }
.compare .paint-flag, .compare .flag-orig { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px var(--border); }
.round-result { text-align: center; }
.round-result .stat .val { font-size: var(--fs-display); font-weight: 800; line-height: 1; }
.swatch small { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatches { flex-wrap: wrap; justify-content: center; }
