/* Hanabi — player pages (index.html + play.html) */

/* ── generic bits ── */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { flex: 1; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-weight: 700; min-height: 44px; cursor: pointer; font-size: 0.95rem; }
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-title h3 { margin: 0; }
.empty { color: var(--muted); font-size: 0.9rem; padding: 6px 0; }
.list-item .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item { min-height: 56px; }
.seat-avatars { display: flex; gap: 2px; }
.seat-avatars .avatar { box-shadow: 0 0 0 2px var(--bg); }
.seat-avatars .avatar + .avatar { margin-left: -8px; }
.modal h2 { margin-bottom: 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal .actions .btn { flex: 1; }
.hello { display: flex; align-items: center; gap: 8px; }
.hello b { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; font-weight: 800; }
.links-row { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.links-row a { font-size: 0.9rem; }

.table-item { flex-direction: column; align-items: stretch; gap: 6px; }
.table-item > .row.between > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.container > * + * { margin-top: 12px; }
.container > div > .panel + .panel { margin-top: 12px; }

a.btn { text-decoration: none; }

/* identity picker */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.emoji-grid button { height: 46px; font-size: 24px; border-radius: 10px; border: 2px solid transparent; background: var(--panel-2); cursor: pointer; }
.emoji-grid button.selected { border-color: var(--accent); background: rgba(255,179,71,0.15); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
.swatch.selected { border-color: #fff; }
.preview-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }

/* leaderboard */
.lb { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lb th, .lb td { padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lb th:first-child, .lb td:first-child { text-align: left; }
.lb th { color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }
.lb td:first-child { display: flex; align-items: center; gap: 6px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* ── play: topbar ── */
.pt-top { flex-wrap: wrap; padding: 6px 10px; row-gap: 4px; }
.pt-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; }
.pt-row .code { font-weight: 800; letter-spacing: 1px; }
.pt-row .tname { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.pt-score { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pt-score small { color: var(--muted); font-weight: 600; font-size: 0.75rem; }
.pt-tokens { display: flex; gap: 3px; }
.pt-tokens .token { width: 13px; height: 13px; }
.pt-tokens .token.strike { width: 20px; height: 20px; font-size: 12px; }
.pt-deck { font-size: 0.85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.pt-top .timer { margin-left: auto; font-size: 1rem; min-width: 40px; text-align: right; }
.pt-top .btn.icon { min-height: 34px; min-width: 34px; padding: 4px; font-size: 1.1rem; }
.pt-status { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

/* ── play: lobby ── */
.code-big { font-size: 2.6rem; font-weight: 900; letter-spacing: 0.3em; text-align: center; padding-left: 0.3em; }
.qr-wrap { display: flex; justify-content: center; margin: 10px 0; }
.qr-wrap canvas { background: #fff; padding: 8px; border-radius: 10px; }
.seat-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,0.2); }
.seat-row .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg { display: flex; flex-direction: column; gap: 10px; }
.cfg label.field { gap: 4px; }
.cfg .switch { min-height: 44px; }
.cfg select.input, .cfg .input { min-height: 44px; }
.cfg-ro { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; }
.cfg-ro div { display: flex; justify-content: space-between; gap: 8px; }
.cfg-ro span:first-child { color: var(--muted); }

/* ── play: game ── */
.turn-banner { border-radius: 12px; padding: 10px 14px; font-weight: 800; text-align: center; font-size: 1.05rem; margin-top: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.turn-banner.mine { background: linear-gradient(135deg, #ff9f43, #ff6b6b); color: #1b0f12; animation: pop 0.25s ease-out; }
.turn-banner.mine .sub { font-size: 0.8rem; font-weight: 600; opacity: 0.85; }
.turn-banner.ended { background: rgba(30,136,229,0.2); }
.final-pill { display: flex; justify-content: center; margin-top: 6px; }

.piles-panel { padding: 10px 8px; }
.piles .card-sm { font-size: 22px; }
.pile .lbl { white-space: nowrap; }

.player-block { padding: 8px 10px; margin-top: 10px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); position: relative; }
.player-block.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(255,179,71,0.25); }
.player-block.clickable { cursor: pointer; }
.player-block.me { background: rgba(255,179,71,0.06); }
.player-head { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.player-head .name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head .tag { font-size: 0.72rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.player-head .hint { font-size: 0.75rem; color: var(--muted); }
.player-block .hand { padding: 10px 4px 10px; gap: 8px; justify-content: center; }
.player-block .hand.mine { padding: 14px 8px 12px; gap: 10px; }
.hand-legend { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); padding: 0 4px; }
.card.hl { box-shadow: 0 0 0 3px var(--accent), 0 0 16px var(--accent); transform: translateY(-4px); }
.card.dead { opacity: 0.55; }
.card.dead::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.2em; color: rgba(0,0,0,0.7); }

.reaction-bubble { position: absolute; top: -16px; left: 40px; font-size: 1.6rem; background: #fff; border-radius: 14px 14px 14px 2px; padding: 2px 8px; box-shadow: var(--shadow); animation: pop 0.2s ease-out; z-index: 5; }

.action-bar { display: flex; gap: 8px; margin-top: 4px; }
.action-bar .btn { flex: 1; min-height: 48px; }
.action-hint { text-align: center; font-size: 0.85rem; color: var(--muted); padding: 6px 0 2px; }

.reactions { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.reactions button { flex: 1; max-width: 64px; height: 44px; font-size: 1.3rem; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.reactions button:active { transform: scale(0.94); }

details.panel { padding: 0; }
details.panel > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: '▾'; color: var(--muted); transition: transform 0.15s; }
details.panel[open] > summary::after { transform: rotate(180deg); }
details.panel > .body { padding: 0 12px 12px; }
.discard-groups { display: flex; flex-direction: column; gap: 8px; }
.discard-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.discard-group .sw { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(255,255,255,0.3); }
.discard-group .card-xs { box-shadow: 0 1px 4px rgba(0,0,0,0.4); }

.log .entry.mine { font-weight: 600; }
.log.big { max-height: 260px; }

/* ── clue bottom sheet ── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 4000; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg-2); border: 1px solid var(--border); border-bottom: none; border-radius: 18px 18px 0 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); width: min(560px, 100%); max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow); animation: slideUp 0.2s ease-out; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; }
.target-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.target-tabs .tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 44px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chips .chip { min-height: 44px; min-width: 48px; }
.chips .chip.color { text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.chips .chip.color.multi-bg { background: linear-gradient(135deg,#e53935 0%,#fdd835 35%,#43a047 65%,#1e88e5 100%); }
.sheet .preview { padding: 12px 2px 6px; gap: 6px; justify-content: center; }
.sheet .cost { font-size: 0.8rem; color: var(--muted); text-align: center; margin-top: 4px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 10px; }
.sheet .actions .btn { flex: 1; min-height: 48px; }

/* ── ended ── */
.result { text-align: center; }
.result .big { font-size: 2.8rem; font-weight: 900; line-height: 1; }
.result .big small { font-size: 1.2rem; color: var(--muted); font-weight: 700; }
.result .reason { margin: 6px 0 10px; font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat-grid .stat { background: rgba(0,0,0,0.2); border-radius: 10px; padding: 8px 4px; }
.stat-grid .stat b { display: block; font-size: 1.2rem; }
.stat-grid .stat span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }
.pstats { width: 100%; font-size: 0.85rem; border-collapse: collapse; margin-top: 8px; }
.pstats td, .pstats th { padding: 5px 4px; text-align: center; border-bottom: 1px solid var(--border); }
.pstats th { color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }
.pstats td:first-child, .pstats th:first-child { text-align: left; }
.pstats td:first-child { display: flex; align-items: center; gap: 6px; }

/* settings */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.settings-list .btn { justify-content: flex-start; }

@media (max-width: 380px) {
  .player-block .hand.mine { gap: 6px; }
  .card-lg { width: 58px; height: 82px; font-size: 32px; }
}
