/* ---------- home / lobby ---------- */
#screen-home, #screen-lobby {
  background: radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg) 62%);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#screen-home.active, #screen-lobby.active { display: block; }
.page { max-width: 640px; margin: 0 auto; padding: calc(18px + var(--safe-t)) 16px calc(28px + var(--safe-b)); display: grid; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 4px; }
.brand h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: .22em; color: var(--accent); line-height: 1.1; text-shadow: 0 1px 0 var(--accent2); }
.brand .brand-sub { margin-top: 3px; font-size: .68rem; font-weight: 600; letter-spacing: .5em; color: var(--ink-dim); }
.brand small { display: block; margin-top: 6px; color: var(--ink-faint); font-size: .76rem; font-weight: 500; letter-spacing: .02em; }
.panel { background: var(--panel); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 16px; padding: 16px; display: grid; gap: 12px; box-shadow: 0 10px 30px color-mix(in srgb, var(--bg) 46%, transparent); backdrop-filter: blur(6px); }
.panel h2 { margin: 0; font-size: 1.05rem; }
.panel .sub { color: var(--ink-dim); font-size: .85rem; margin: -6px 0 0; }
.tabs { display: grid; grid-auto-flow: column; gap: 6px; background: color-mix(in srgb, var(--bg) 39%, transparent); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--ink-dim); }
.tabs button.on { background: var(--gold); color: var(--paper-ink); }
.invite { text-align: center; display: grid; gap: 6px; }
.invite .code { font-size: 2rem; font-weight: 900; letter-spacing: .3em; color: var(--gold); }
.link-btn { background: none; border: 0; color: var(--gold); text-decoration: underline; font-size: .85rem; padding: 6px; }
.err-line { color: var(--danger); font-size: .88rem; min-height: 1.1em; font-weight: 600; }

/* settings form */
.set-list { display: grid; gap: 2px; }
.set-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 9px 2px; border-top: 1px solid color-mix(in srgb, var(--ink) 7%, transparent); }
.set-row:first-child { border-top: 0; }
.set-row .lbl { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.set-row .shint { grid-column: 1; color: var(--ink-dim); font-size: .76rem; line-height: 1.3; }
.set-row .ctl { grid-row: 1 / span 2; grid-column: 2; }
.badge-house { font-size: .62rem; font-weight: 800; background: color-mix(in srgb, var(--info) 55%, var(--bg)); color: var(--ink); padding: 2px 7px; border-radius: 99px; letter-spacing: .03em; }
.stepper { display: inline-flex; align-items: center; background: color-mix(in srgb, var(--bg) 46%, transparent); border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent); }
.stepper button { width: 36px; height: 36px; border: 0; background: color-mix(in srgb, var(--ink) 8%, transparent); font-size: 1.2rem; font-weight: 800; }
.stepper button:active { background: color-mix(in srgb, var(--ink) 20%, transparent); }
.stepper .val { min-width: 62px; text-align: center; font-weight: 800; font-size: 1rem; background: transparent; border: 0; color: var(--ink); font-family: inherit; padding: 0; -moz-appearance: textfield; }
.stepper .val::-webkit-outer-spin-button, .stepper .val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.ro button { display: none; }
.stepper.ro { box-shadow: none; background: transparent; }
.switch { position: relative; width: 50px; height: 28px; border-radius: 99px; border: 0; background: color-mix(in srgb, var(--ink) 18%, transparent); transition: background .2s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .2s var(--ease); box-shadow: 0 2px 4px color-mix(in srgb, var(--bg) 52%, transparent); }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(22px); }
.switch[disabled] { opacity: .6; }
.seg { display: inline-flex; background: color-mix(in srgb, var(--bg) 46%, transparent); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; font-weight: 800; color: var(--ink-dim); }
.seg button.on { background: var(--gold); color: var(--paper-ink); }
.seg button[disabled] { cursor: default; }
details.fold > summary { cursor: pointer; font-weight: 700; padding: 4px 0; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.fold > summary::after { content: "▾"; transition: transform .2s; }
details.fold[open] > summary::after { transform: rotate(180deg); }
details.fold > summary::-webkit-details-marker { display: none; }

/* lobby */
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-row .wa { grid-column: 1 / -1; background: linear-gradient(color-mix(in srgb, var(--ok) 90%, var(--ink)), var(--ok)); color: var(--paper-ink); font-weight: 800; }
.link-box { font-size: .78rem; color: var(--ink-dim); word-break: break-all; background: color-mix(in srgb, var(--bg) 39%, transparent); border-radius: 8px; padding: 8px 10px; }
.seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seat-card { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: 12px; padding: 10px; min-height: 58px; animation: pop-in .35s var(--ease) both; }
.seat-card.empty { background: transparent; border: 2px dashed color-mix(in srgb, var(--ink) 14%, transparent); color: var(--ink-dim); animation: none; }
.seat-card .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-card .sub2 { font-size: .72rem; color: var(--ink-dim); }
.seat-card .grow { flex: 1; min-width: 0; }
@keyframes pop-in { from { transform: scale(.8); opacity: 0; } }
.avatar-lg { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem; color: var(--paper); flex: none; box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--bg) 32%, transparent); }
.av-0 { background: var(--tile-red); } .av-1 { background: var(--tile-blue); } .av-2 { background: var(--tile-yellow); } .av-3 { background: color-mix(in srgb, var(--info) 45%, var(--tile-black)); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bg) 39%, transparent); }
.dot.off { background: var(--ink-faint); }
.wait-note { text-align: center; color: var(--ink-dim); font-size: .9rem; }
@media (max-width: 420px) { .seats { grid-template-columns: 1fr; } }
@media (max-height: 460px) and (orientation: landscape) { .page { max-width: 760px; gap: 10px; } .brand { display: none; } }

/* ---------- game picker ---------- */
.page.wide { max-width: 980px; }
.logo-cards { position: relative; width: 64px; height: 52px; flex: none; }
.logo-cards .lc { position: absolute; bottom: 0; width: 34px; height: 46px; border-radius: 6px; background: var(--paper); color: var(--paper-ink); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; box-shadow: 0 3px 8px color-mix(in srgb, var(--bg) 65%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--bg) 10%, transparent); transform-origin: 50% 100%; }
.logo-cards .lc1 { left: 0; transform: rotate(-14deg); }
.logo-cards .lc2 { left: 14px; color: var(--suit-red); transform: rotate(0deg); z-index: 1; }
.logo-cards .lc3 { left: 28px; transform: rotate(14deg); font-size: 1.25rem; z-index: 2; }
.section-title { margin: 6px 2px 0; font-size: 1rem; color: var(--ink-dim); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.game-card {
  --a: var(--felt); --b: var(--felt2);
  position: relative; overflow: hidden; text-align: left; border: 0; border-radius: 18px; padding: 14px 14px 12px; min-height: 148px;
  display: grid; align-content: start; gap: 4px; color: var(--ink);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--ink) 20%, transparent), transparent 55%),
    linear-gradient(150deg, var(--a), var(--b));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--bg) 58%, transparent), inset 0 1px 0 color-mix(in srgb, var(--ink) 28%, transparent);
  transition: transform .18s var(--ease), box-shadow .18s, filter .2s;
  animation: card-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.game-card::after { content: ""; position: absolute; right: -26px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.game-card:not(.soon):hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: 0 14px 28px color-mix(in srgb, var(--bg) 72%, transparent), inset 0 1px 0 color-mix(in srgb, var(--ink) 28%, transparent); }
.game-card:not(.soon):active { transform: scale(.97); }
.game-card .gc-emoji { font-size: 2.4rem; line-height: 1; filter: drop-shadow(0 3px 4px color-mix(in srgb, var(--bg) 52%, transparent)); }
.gc-emoji.big { font-size: 2.8rem; }
.game-card .gc-name { font-size: 1.15rem; font-weight: 900; letter-spacing: .01em; text-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 60%, transparent); }
.game-card .gc-short { font-size: .76rem; line-height: 1.3; opacity: .88; }
.game-card .gc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; position: relative; z-index: 1; }
.game-card .gc-meta i { font-style: normal; font-size: .66rem; font-weight: 800; background: color-mix(in srgb, var(--bg) 36%, transparent); border-radius: 99px; padding: 2px 8px; }
.game-card .gc-meta i.tm { background: var(--accent); color: var(--paper-ink); }
.game-card.soon { filter: grayscale(.9) brightness(.55); cursor: not-allowed; box-shadow: none; }
.game-card .gc-ribbon { position: absolute; top: 10px; right: -30px; transform: rotate(35deg); background: var(--gold); color: var(--paper-ink); font-size: .66rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; padding: 3px 34px; z-index: 2; box-shadow: 0 2px 6px color-mix(in srgb, var(--bg) 65%, transparent); }
@keyframes card-in { from { transform: translateY(18px) scale(.94); opacity: 0; } }
.panel.narrow { max-width: 560px; width: 100%; justify-self: center; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-row .input.code { font-size: 1.15rem; }
.link-btn.back { justify-self: start; text-decoration: none; font-weight: 800; }
.setup-head { --a: var(--felt); display: flex; align-items: center; gap: 14px; justify-self: center; width: 100%; max-width: 560px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--a) 55%, var(--bg)), color-mix(in srgb, var(--bg) 26%, transparent)); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 18%, transparent); }
.setup-head h2 { margin: 0; font-size: 1.3rem; }
.setup-head .sub { margin: 2px 0 0; font-size: .8rem; color: var(--ink-dim); }
.input.sel { width: auto; padding: 8px 10px; font-size: .9rem; }

/* lobby: game badge, teams */
.lobby-game { --a: var(--felt); display: flex; align-items: center; gap: 10px; justify-content: center; padding: 8px 14px; border-radius: 99px; background: linear-gradient(120deg, color-mix(in srgb, var(--a) 60%, var(--bg)), color-mix(in srgb, var(--bg) 26%, transparent)); justify-self: center; }
.lobby-game .gc-emoji { font-size: 1.5rem; }
.lobby-game .sub { font-size: .8rem; color: var(--ink-dim); }
.seat-card.swappable { cursor: pointer; }
.seat-card.picked { box-shadow: 0 0 0 2px var(--gold); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.seat-card.target { cursor: pointer; border-color: var(--gold); color: var(--gold); }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.team-box { border-radius: 14px; padding: 8px; display: grid; gap: 6px; align-content: start; border: 2px solid transparent; }
.team-box.team-0 { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.team-box.team-1 { background: color-mix(in srgb, var(--info) 14%, transparent); border-color: color-mix(in srgb, var(--info) 55%, transparent); }
.team-title { font-weight: 800; font-size: .8rem; text-align: center; }
.team-box.team-0 .team-title { color: var(--accent); } .team-box.team-1 .team-title { color: var(--info); }
.vs { align-self: center; font-size: .7rem; font-weight: 800; color: var(--ink-dim); text-transform: uppercase; writing-mode: vertical-rl; letter-spacing: .1em; }
.seats.one { grid-template-columns: 1fr; }
@media (max-width: 560px) { .teams { grid-template-columns: 1fr; } .vs { writing-mode: horizontal-tb; text-align: center; } }
@media (max-height: 460px) and (orientation: landscape) { .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .game-card { min-height: 120px; } .page.wide { max-width: 100%; } }
