:root {
  --bg: #1b1814; --panel: #26211b; --line: #3a332a; --text: #eee6d8; --muted: #a39684; --accent: #f3c77a;
  --ok: #9be39b; --bad: #f19a8a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, "Segoe UI", sans-serif; display: flex; flex-direction: column; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
h1 { font-size: 17px; margin: 0; margin-right: auto; }
h2 { font-size: 14px; margin: 14px 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
button { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.on { background: #4a3d26; border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
.tip { position: fixed; z-index: 10; pointer-events: none; max-width: 260px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.tip b { font-size: 13px; }
.playlink { color: var(--accent); align-self: center; padding: 6px 4px; text-decoration: none; font-weight: 600; }
.clock { font-variant-numeric: tabular-nums; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); white-space: nowrap; }
select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; max-width: 260px; }
.tools, .actions { display: flex; flex-wrap: wrap; gap: 6px; }
main { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 12px 16px; }
#view { flex: 1; width: 100%; min-height: 300px; display: block; touch-action: none; cursor: crosshair; }
.status { margin-top: 8px; min-height: 20px; color: var(--muted); }
.status.bad { color: var(--bad); }
.status.ok { color: var(--ok); }
aside { width: 320px; padding: 4px 16px 16px; border-left: 1px solid var(--line); overflow-y: auto; }
.player { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.player.on { border-color: var(--accent); background: #2f281f; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.player .name { font-weight: 600; }
.player .flags { margin-left: auto; letter-spacing: 1px; }
.player .score { min-width: 44px; text-align: right; font-weight: 700; font-size: 16px; }
.player.watched { display: block; cursor: default; }
.player.watched .who { display: flex; align-items: center; gap: 8px; }
.player.watched .cls { color: var(--muted); font-size: 12px; }
.player.watched .score { margin-left: auto; }
.player.watched .info { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.player.watched .hand { color: var(--text); letter-spacing: 1px; }
.player .score small { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--bad); }
.claim { border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.claim .top { display: flex; justify-content: space-between; font-weight: 600; }
.claim .row { display: flex; justify-content: space-between; color: var(--muted); }
.claim .row b { color: var(--text); font-weight: 600; }
.status-masterpiece { color: var(--accent); }
.status-blended { color: var(--ok); }
.empty { color: var(--muted); font-style: italic; }
.scoring { width: 100%; border-collapse: collapse; color: var(--muted); }
.scoring td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.scoring td + td { text-align: right; color: var(--text); font-weight: 600; }
.help { margin-top: 16px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--text); }
.help ul { padding-left: 18px; margin: 6px 0; }
.help li { margin-bottom: 4px; }
@media (max-width: 760px) {
  main { flex-direction: column; }
  aside { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  #view { min-height: 260px; }
  h1 { width: 100%; }
}

/* Simulate popup (Round 59) */
[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 3vh 12px; overflow: auto; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; width: min(920px, 100%); }
.sheethead { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.muted { color: var(--muted); }
.simform details { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; }
.simform summary { cursor: pointer; font-weight: 600; }
.simform details[open] { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 4px 16px; }
.simform details[open] summary { grid-column: 1 / -1; }
.simrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 6px; }
.simrow.changed { background: rgba(232,182,76,.14); }
.simrow .l { display: flex; flex-direction: column; min-width: 0; }
.simrow .k { font-size: 13px; }
.simrow code { font-size: 11px; color: var(--muted); }
.simrow input[type=number], .simrow input[type=text] { width: 110px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.simbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 6px; }
.simbar input { width: 90px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.simavg, .simgames { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 13px; }
.simavg th, .simavg td, .simgames th, .simgames td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.simavg td { font-weight: 700; font-size: 15px; }
.bad { color: #ec7d6c; }

.speed { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.speed input { width: 64px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.seek { flex: 1 1 260px; min-width: 200px; accent-color: var(--accent); }
.simbar.presets select, .simbar.presets input[type=text] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.simbar.presets input[type=text] { width: 180px; }
.simbar .gap { flex: 1; }
.simrow select { width: 150px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
/* Round 80: live scores are a debug aid; scoring happens only at the end */
.scorenote { margin: 0 0 6px; font-size: 12px; color: #e8b64c; border: 1px dashed #e8b64c; border-radius: 6px; padding: 3px 6px; }
