:root {
  color-scheme: light;
  --paper: #f2f0f6;
  --surface: #fdfcfe;
  --ink: #282437;
  --muted: #615971;
  --line: #d6d0df;
  --violet: #4d386a;
  --soft: #e9def4;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid #725098;
  outline-offset: 3px;
}

.page {
  width: min(100% - 54px, 740px);
  margin-inline: auto;
  padding-block: 39px 26px;
}

.topbar, .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar { flex-wrap: wrap; padding-bottom: 15px; border-bottom: 1px solid var(--line); }

h1 {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: clamp(1.8rem, 6.7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.07em;
  line-height: 1;
}

.mark {
  position: relative;
  width: .57em;
  height: .48em;
  border-radius: 2px;
  background: var(--violet);
}

.mark::before {
  content: "";
  position: absolute;
  top: -.08em;
  left: 0;
  width: .29em;
  height: .13em;
  border-radius: 2px 3px 0 0;
  background: var(--violet);
}

.case-stamp { display: grid; gap: 2px; text-align: right; white-space: nowrap; font-size: .85rem; }
.case-stamp time { color: var(--muted); font-size: .78rem; }

.primary, .secondary {
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  font-size: .85rem;
  font-weight: 750;
  white-space: nowrap;
}

.secondary:hover { border-color: #9e89b7; }
.summary { margin-block: 16px; font-weight: 650; }
.storage-warning { margin-bottom: 12px; color: #8b3e51; font-size: .88rem; }

.lead-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 20px 23px;
  border-radius: 12px;
  color: #fcf8ff;
  background: var(--violet);
}

h2 { font-size: 1.23rem; letter-spacing: -.035em; line-height: 1.2; }
.lead-panel h2 { margin-bottom: 6px; color: #e9d7fc; font-size: .87rem; letter-spacing: 0; }
#lead { font-size: clamp(1rem, 3.95vw, 1.35rem); line-height: 1.37; font-weight: 650; }
.budget { min-width: 78px; padding-left: 15px; border-left: 1px solid #8a71a2; text-align: center; }
.budget strong { display: block; font-size: clamp(2.15rem, 9vw, 3.3rem); line-height: .96; font-variant-numeric: tabular-nums; }
.budget span { display: block; margin-top: 7px; color: #ecdafa; font-size: .75rem; font-weight: 650; white-space: nowrap; }

.market { margin-top: 22px; }
.section-heading { margin-bottom: 9px; }
.section-heading span { color: var(--muted); font-size: .78rem; }

.clues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.clue {
  display: flex;
  width: 100%;
  min-height: 57px;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  line-height: 1.25;
}

.offer:hover:enabled { border-color: #9e89b7; background: #f9f5fd; }
.offer:disabled { background: #ece8f0; color: var(--muted); }
.clue-name { font-size: .92rem; }
.clue-price { flex: none; padding: 3px 5px; border-radius: 4px; background: var(--soft); color: var(--violet); font-size: .75rem; font-weight: 750; }
.evidence { flex-direction: column; align-items: start; justify-content: center; background: #f8f2ff; border-color: #c7b7d9; outline: none; }
.evidence:focus-visible { outline: 2px solid #725098; outline-offset: 2px; }
.evidence .clue-name { font-size: .75rem; color: var(--violet); }
.clue-text { font-size: .89rem; overflow-wrap: anywhere; }

.guess-panel, .result {
  margin-top: 19px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.guess-panel label { display: block; margin-bottom: 7px; font-weight: 750; font-size: .91rem; }
.guess-row { display: flex; gap: 7px; }
.guess-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #a99cb9;
  border-radius: 7px;
  background: #fff;
  font-size: 1rem;
}

.guess-row input::placeholder { color: #6d637c; }
.primary { border-color: var(--violet); color: #fff; background: var(--violet); }
.primary:hover:enabled { background: #654889; }
.primary:disabled { border-color: var(--line); color: var(--muted); background: #ede9f1; }

.result[data-correct="true"] { border-color: #a997bd; }
.result[data-correct="false"] { border-color: #cfa9b1; }
.result[data-correct="false"] h2 { color: #8b3e51; }
#result-heading:focus { outline: none; }
#answer { margin-top: 4px; font-size: 1.16rem; font-weight: 760; }
#result-guess { margin-top: 2px; color: var(--muted); font-size: .87rem; }
#result-guess:empty, .copy-status:empty { display: none; }
.share-text { margin-block: 11px; color: var(--muted); font-size: .86rem; white-space: pre-line; overflow-wrap: anywhere; }
.copy-status, .reference { display: block; margin-top: 8px; color: var(--muted); font-size: .8rem; }
.copy-status { white-space: pre-line; overflow-wrap: anywhere; }

.history { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--line); }
.history summary { width: fit-content; padding-block: 8px; cursor: pointer; font-weight: 750; }
.history summary:focus-visible { outline: 3px solid #725098; outline-offset: 3px; }
.history ul { margin: 0; padding: 0; list-style: none; }
.history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.history-title { font-size: .9rem; }
.history-date { display: block; color: var(--muted); font-size: .78rem; }
footer { margin-top: 16px; color: var(--muted); font-size: .78rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 540px) {
  .page { width: calc(100% - 28px); padding-block: 14px; }
  .topbar { padding-bottom: 10px; gap: 7px; }
  .summary { margin-block: 11px; font-size: .92rem; }
  .lead-panel { padding: 14px 12px; gap: 10px; }
  .budget { min-width: 60px; padding-left: 8px; }
  .market, .guess-panel, .result { margin-top: 14px; }
  .clue { padding-inline: 8px; }
}
