/* client/client.css -- the shell around the game: account, lobby and menu screens. The game's own
   look (board, squad panel, order windows) is shared/ui.css, linked first. Same palette and 8px grid
   (design/ui-design.html section 1); 44px touch targets everywhere. */

body { overflow-x: hidden; }
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.app-bar { background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); min-height: 56px; }
.app-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-brand h1 { font-size: 15px; letter-spacing: .02em; font-weight: 800; }
.squads { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.squads i { width: 14px; height: 14px; border-radius: 3px; display: block; }
.app-user { display: flex; align-items: center; gap: 10px; }
.app-name-btn { margin: 0 !important; display: inline-flex !important; align-items: center; color: #B8BFC9 !important; text-decoration: none !important; }
#app-username { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; white-space: nowrap; display: inline-block; }
.app-user .btn { background: #2A2F3A; border-color: #3D4450; color: #fff; }

.app-main { flex: 1 1 auto; padding: 24px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.screen.acct { min-height: 0; }

.acct-card { max-width: 26rem; margin: 0 auto; background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 20px; }
.acct-card h2 { font-size: 18px; margin-bottom: 6px; }
.acct-lede { color: var(--ink2); font-size: 13.5px; line-height: 1.45; margin: 0 0 14px; }
.acct-notice { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 5px; padding: 8px 10px; font-size: 13px; font-weight: 700; margin: 0 0 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1 1 0; min-height: 44px; border-radius: 5px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink2); font-size: 13.5px; font-weight: 800; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.acct-form label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .03em; color: var(--ink2); margin: 12px 0 4px; }
.acct-form label:first-child { margin-top: 0; }
.acct-form input[type=text], .acct-form input[type=email], .acct-form input[type=password] {
  display: block; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px;
  font: inherit; font-size: 16px; color: var(--ink); background: #fff; }
.acct-form input:focus-visible, .tab:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hint { font-size: 11.5px; color: var(--ink3); margin: 4px 0 0; }
.form-msg { min-height: 18px; margin: 10px 0; font-size: 13px; font-weight: 700; color: var(--danger); }
.form-msg.ok { color: var(--good); }
.form-msg:empty { min-height: 0; margin: 6px 0; }
.btn.wide { width: 100%; font-size: 15px; }
.link-btn { display: block; margin: 8px auto 0; min-height: 44px; background: none; border: none; color: var(--accent); font-size: 13.5px; font-weight: 700; text-decoration: underline; padding: 0 12px; }

.screen.wide-screen .acct-card { max-width: none; margin: 0; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 16px; max-width: 64rem; margin: 0 auto; align-items: start; }
.home-grid .my-games { grid-column: 1 / -1; }
.lobby-card { max-width: 40rem !important; margin: 0 auto !important; }
.acct-form select { display: block; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; }
.acct-form select:focus-visible, .acct-form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.acct-form label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: 0; margin-top: 8px; }
.acct-form label.check input { width: 22px; height: 22px; flex: 0 0 auto; }
.code-input { text-transform: uppercase; letter-spacing: .18em; font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.game-list { list-style: none; margin: 0; padding: 0; }
.game-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.game-info { min-width: 0; }
.game-line { font-size: 13px; color: var(--ink2); margin-top: 4px; }
.seat-chips { display: flex; gap: 4px; }
.seat-chip { width: 22px; height: 22px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.seat-chip.you { outline: 2px solid var(--ink); outline-offset: 1px; }
.seat-chip.open { background: transparent !important; color: var(--ink2); border: 2px dashed var(--ink3); }
.lobby-status { font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.seat-list { list-style: none; margin: 0 0 8px; padding: 0; }
.seat-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); min-height: 52px; }
.seat-row.you { background: #EAF4FB; margin: 0 -8px; padding: 8px; border-radius: 4px; }
.seat-dot { width: 28px; height: 28px; border-radius: 5px; color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.seat-info { flex: 1 1 auto; font-size: 14px; }
#lobby-owner h3 { font-size: 14px; margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
.share-row label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .03em; color: var(--ink2); margin: 10px 0 4px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; font-size: 14px; background: var(--panel); color: var(--ink); }
.squad-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; margin: 8px 0; font-size: 13.5px; }
.owner-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 12px; font-size: 14px; font-weight: 700; }
.owner-check input { width: 22px; height: 22px; flex: 0 0 auto; }
#screen-config { padding-bottom: 32px; }
.owner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 480px) {
  .app-main { padding-top: 16px; }
  .acct-card { padding: 16px; }
  .app-brand h1 { font-size: 13px; }
}

/* ---- in a game ---- */
body.in-game .app-bar { display: none; }
body.in-game .app-main { display: none; }
#game-banner { position: fixed; left: 50%; transform: translateX(-50%); top: 8px; z-index: 150; max-width: 92vw; background: #7A5A0F; color: #fff;
  border-radius: 6px; padding: 8px 14px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.3); pointer-events: none; }
#game-banner.hidden { display: none; }
.wait-note { font-size: 15px; font-weight: 800; color: var(--ink); flex: 1 1 100%; order: -1; min-height: 20px; }
.wait-note:empty { display: none; }
.wait-chip { display: inline-block; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; min-width: 28px; padding: 1px 8px; border-radius: 4px; color: #fff; font-size: 13px; font-weight: 800; text-align: center; margin: 0 2px; }
.timer-btn.static { pointer-events: none; }

/* ---- the whole world: after-game replay and spectating (client/replay.js, shared/render-full.js) ---- */
.game-acts { display: flex; gap: 8px; flex: 0 0 auto; }
.rw-wrap { max-width: 78rem; margin: 0 auto; }
.rw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.rw-head-text { min-width: 0; }
.rw-head h2 { font-size: 18px; margin: 0; }
.rw-sub { font-size: 13px; color: var(--ink2); margin: 4px 0 0; line-height: 1.45; max-width: 52rem; }
.rw-banner { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 6px; padding: 8px 12px; font-size: 13.5px; font-weight: 700; margin: 0 0 10px; }
.rw-banner.hidden { display: none; }
.rw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 16px; align-items: start; }
.rw-board-wrap { background: var(--board-bg); border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; max-height: calc(100dvh - 210px); margin: 0 auto; }
.rw-board-wrap svg { width: 100%; height: 100%; display: block; cursor: zoom-in; }
.rw-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rw-controls .btn { min-height: 44px; min-width: 44px; }
.rw-turn { flex: 1 1 10rem; text-align: center; font-size: 14px; font-weight: 800; color: var(--ink); }
.rw-beat { flex: 1 1 12rem; min-height: 44px; }
.rw-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; font-weight: 700; }
.rw-check input { width: 20px; height: 20px; }
.rw-side { background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 12px; }
.rw-side h3 { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); margin: 14px 0 6px; }
.rw-side h3:first-child { margin-top: 0; }
.rw-player { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.rw-player.won .rw-name { font-weight: 800; }
.rw-dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; display: inline-block; }
.rw-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rw-resources { display: inline-flex; gap: 2px; }
.rw-res { opacity: .22; display: inline-flex; }
.rw-res.got { opacity: 1; }
.rw-robots { font-size: 12px; color: var(--ink2); min-width: 2.2em; text-align: right; }
.rw-order-line { font-size: 12.5px; padding: 3px 0; line-height: 1.4; }
.rw-order-line .rw-dot { margin-right: 6px; vertical-align: -1px; }
.rw-src { font-size: 10.5px; font-weight: 800; background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.rw-log { position: relative; max-height: 22rem; overflow-y: auto; border: 1px solid var(--rule); border-radius: 5px; }
@media (max-width: 900px) {
  .rw-layout { grid-template-columns: minmax(0, 1fr); }
  .rw-board-wrap { max-height: none; }
  .rw-log { max-height: 16rem; }
}
