*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f1e8;
  --ink: #191716;
  --muted: #6d6358;
  --panel: #fffaf0;
  --panel-2: #ece2d0;
  --line: #c8bda9;
  --red: #b42318;
  --green: #157f5b;
  --blue: #165a72;
  --gold: #b7791f;
  --shadow: 0 18px 45px rgba(25, 23, 22, 0.14);
}

body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(25, 23, 22, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, rgba(25, 23, 22, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.back-bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
}

.back-link {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--ink);
}

.auction-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.intro-screen,
.final-screen {
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-screen h1,
.final-screen h1,
.game-topbar h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  letter-spacing: 0;
}

.intro-screen h1 {
  margin-top: 0.55rem;
  font-size: clamp(3rem, 10vw, 7.5rem);
  line-height: 0.92;
}

.intro-copy {
  max-width: 590px;
  margin: 1.2rem auto 1.8rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.intro-art {
  width: min(420px, 84vw);
  aspect-ratio: 1.45;
  border: 12px solid #2a2118;
  background: #d8c3a5;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 0.86fr;
  gap: 10px;
  padding: 10px;
  transform: rotate(-1.5deg);
  margin-bottom: 2rem;
}

.intro-art span {
  min-height: 0;
  background: #b42318;
}

.intro-art span:nth-child(2) {
  background: #165a72;
}

.intro-art span:nth-child(3) {
  background: #e7b84c;
}

.intro-art span:nth-child(4) {
  background: #191716;
}

.primary-btn {
  border: 2px solid var(--ink);
  background: var(--ink);
  color: #fffaf0;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 1.35rem;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 5px 5px 0 rgba(25, 23, 22, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.primary-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(25, 23, 22, 0.18);
}

.primary-btn:active {
  transform: translate(0, 0);
  box-shadow: 3px 3px 0 rgba(25, 23, 22, 0.18);
}

.game-screen {
  padding-top: 1rem;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.2rem;
}

.game-topbar h1 {
  max-width: 780px;
  margin-top: 0.25rem;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.95;
}

.score-card {
  min-width: 116px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.8rem 1rem;
  text-align: right;
  box-shadow: 5px 5px 0 rgba(25, 23, 22, 0.12);
}

.score-card span,
.lot-meta span,
.result-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.lot-layout {
  display: grid;
  grid-template-columns: minmax(310px, 0.93fr) minmax(320px, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.art-frame {
  border: 14px solid #2b2118;
  border-radius: 8px;
  background: #f7ecd8;
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.art-frame svg {
  display: block;
  width: 100%;
  aspect-ratio: 6 / 7;
  background: #f8f1e4;
}

.art-frame figcaption {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  padding-top: 0.75rem;
}

.guess-panel {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 7px 7px 0 rgba(25, 23, 22, 0.12);
}

.lot-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lot-meta div,
.result-grid div {
  background: #f7ecd8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.lot-meta strong,
.result-grid strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.95rem;
  line-height: 1.3;
}

.guess-form {
  display: grid;
  gap: 0.8rem;
}

.guess-form label {
  font-size: 1.1rem;
  font-weight: 900;
}

.money-input {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.money-input span {
  padding-left: 0.9rem;
  color: var(--muted);
  font-size: 1.6rem;
  font-weight: 900;
}

.money-input input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0.85rem 0.9rem 0.85rem 0.45rem;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.quick-guesses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.quick-guesses button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  min-height: 38px;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.quick-guesses button:hover {
  border-color: var(--ink);
}

.result-panel {
  margin-top: 1rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.result-grid strong {
  font-size: 1.05rem;
}

#round-score {
  color: var(--green);
}

#difference-value {
  color: var(--red);
}

#result-note,
#final-copy {
  color: var(--muted);
  line-height: 1.65;
  margin: 1rem 0;
}

.final-score {
  margin: 0.7rem 0;
  font-size: clamp(4rem, 13vw, 8rem);
  font-weight: 950;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.final-score small {
  color: var(--muted);
  font-size: 0.2em;
}

.history-list {
  width: min(760px, 100%);
  display: grid;
  gap: 0.5rem;
  margin: 0.7rem 0 1.5rem;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.65rem 0.8rem;
  text-align: left;
}

.history-row strong {
  font-size: 0.9rem;
}

.history-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 780px) {
  .auction-shell {
    padding-inline: 0.9rem;
  }

  .intro-screen,
  .final-screen {
    min-height: calc(100vh - 4.5rem);
  }

  .game-topbar,
  .lot-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .game-topbar {
    align-items: stretch;
  }

  .score-card {
    text-align: left;
  }

  .lot-meta,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .quick-guesses {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
