:root {
  --bg: #0f1f17;
  --panel: #16291f;
  --panel-2: #1d3428;
  --line: #2b4637;
  --ink: #f3ecd9;
  --muted: #a9b5a6;
  --brass: #d8b45a;
  --hit: #3fa86b;
  --warm: #d8b45a;
  --tepid: #c9783d;
  --cold: #3c4d44;
  --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.4; }
a { color: var(--brass); }

.top {
  display: flex; align-items: center; gap: 12px;
  max-width: 640px; margin: 0 auto; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font: 700 26px/1 Georgia, "Times New Roman", serif; letter-spacing: .5px; }
.top h1 span { color: var(--brass); }
.top .meta { flex: 1; color: var(--muted); font-size: 14px; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; font-size: 18px; padding: 4px 9px; cursor: pointer; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }

.photo { position: relative; margin: 0 0 16px; border-radius: var(--radius); overflow: hidden; background: var(--panel); aspect-ratio: 7 / 5; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo figcaption {
  position: absolute; left: 10px; top: 10px;
  background: rgba(15, 31, 23, .85); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--muted);
}

.clues { display: grid; gap: 8px; margin-bottom: 16px; }
.clue {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.clue .ico { font-size: 20px; line-height: 1.2; text-align: center; }
.clue .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.clue .val { font-size: 16px; }
.clue .sub { font-size: 13px; color: var(--muted); }
.clue.locked { opacity: .45; }
.clue.locked .val { color: var(--muted); }
.clue.new { animation: pop .45s ease-out; border-color: var(--brass); }
@keyframes pop { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }

.guesses { display: grid; gap: 6px; margin-bottom: 14px; }
.guess-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 10px; background: var(--cold); font-variant-numeric: tabular-nums;
}
.guess-row.hit { background: var(--hit); }
.guess-row .amt { font-weight: 600; font-size: 17px; }
.guess-row .dir { font-size: 18px; width: 22px; text-align: center; }

.guess-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.guess-form .row { display: flex; align-items: center; gap: 8px; }
.guess-form .dollar { color: var(--muted); font-size: 20px; }
#guess {
  flex: 1; min-width: 0; font-size: 20px; padding: 10px 12px; border-radius: 8px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
}
#guess:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
#submit {
  font-size: 17px; font-weight: 700; padding: 11px 18px; border-radius: 8px; border: 0;
  background: var(--brass); color: #1d1a10; cursor: pointer;
}
#submit:disabled { opacity: .5; cursor: default; }
#slider { width: 100%; margin: 0 0 12px; accent-color: var(--brass); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; min-height: 1.2em; }
.hint.err { color: #e98c6c; }

.result { background: var(--panel-2); border: 1px solid var(--brass); border-radius: var(--radius); padding: 16px; text-align: center; }
.result h2 { margin: 0; font: 700 22px Georgia, serif; }
.result .price { font: 700 40px Georgia, serif; color: var(--brass); margin: 6px 0; font-variant-numeric: tabular-nums; }
.result .who { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.result .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.result button { font-size: 15px; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.result button.primary { background: var(--brass); color: #1d1a10; border: 0; }
.result .next { margin-top: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

footer { max-width: 640px; margin: 8px auto 40px; padding: 0 16px; font-size: 12px; color: var(--muted); text-align: center; }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); width: min(92vw, 380px); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 12px; font: 700 20px Georgia, serif; }
dialog h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; }
.stat-grid b { display: block; font-size: 26px; }
.stat-grid span { font-size: 11px; color: var(--muted); }
.bar { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; }
.bar div { background: var(--cold); padding: 2px 6px; text-align: right; border-radius: 4px; min-width: 22px; }
.bar div.cur { background: var(--hit); }
dialog .close { margin-top: 18px; width: 100%; padding: 9px; border-radius: 8px; border: 0; background: var(--brass); color: #1d1a10; font-weight: 700; cursor: pointer; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-weight: 600; z-index: 10;
}
