:root {
  --paper: #eef1f5;
  --card: #ffffff;
  --text: #19202a;
  --muted: #5d6774;
  --line: #d6dce4;
  --ink: #161b23;
  --ink-2: #232b37;
  --ink-line: rgba(255, 255, 255, 0.13);
  --on-ink: #f1f4f8;
  --on-ink-muted: #9ba6b4;
  --marker: #f2cf3a;
  --marker-ink: #2a2300;
  --bad: #e5484d;
  --good: #2f9e6b;
  --radius-panel: 18px;
  --radius-control: 10px;
  --font: "Schibsted Grotesk", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--text); background: var(--paper); }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--marker); outline-offset: 2px; }
a { color: inherit; }

/* Sheets: password, welcome, board, results */
.sheet { max-width: 680px; margin: 0 auto; padding: 64px 20px 80px; }
.sheet h1 { font-size: 2.1rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 20px; font-weight: 700; }
.sheet h2 { font-size: 1.15rem; margin: 36px 0 8px; }
.sheet p, .sheet li { max-width: 62ch; }
.sheet ol { padding-left: 1.3em; }
.sheet li { margin: 6px 0; }
.lede { font-size: 1.2rem; line-height: 1.5; }
.muted { color: var(--muted); }
.field { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.field input {
  flex: 1 1 220px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--card);
}
.btn {
  border: 0; border-radius: var(--radius-control); padding: 12px 18px; font-weight: 600;
  background: var(--ink); color: var(--on-ink); text-decoration: none; display: inline-block;
}
.btn.light { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.45; cursor: default; }
.names { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.error { color: var(--bad); }
kbd {
  display: inline-block; min-width: 1.7em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; background: var(--card); font: 600 0.85em/1.4 var(--font); text-align: center; color: var(--text);
}
.ink kbd { background: rgba(255, 255, 255, 0.08); border-color: var(--ink-line); color: inherit; }
.keys { display: grid; gap: 10px; margin: 12px 0 0; }
.keys div { display: grid; grid-template-columns: 3.4em 1fr; gap: 12px; align-items: baseline; }
.keys dt kbd { font-size: 1rem; min-width: 2.4em; }
.keys dd { margin: 0; }
.callout { border-left: 3px solid var(--marker); padding: 2px 0 2px 16px; margin: 20px 0; }

/* Review shell */
#review { position: fixed; inset: 0; }
#frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
#hl {
  position: fixed; z-index: 5; pointer-events: none; border: 3px solid var(--marker); border-radius: 4px;
  background: rgba(242, 207, 58, 0.1); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
#hl span {
  position: absolute; left: -3px; top: -3px; background: var(--marker); color: var(--marker-ink);
  font: 600 13px/1 var(--font); padding: 6px 9px; border-radius: 4px 0 6px 0; max-width: 60vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ink {
  background: rgba(22, 27, 35, 0.94); color: var(--on-ink); -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--ink-line);
}
/* Bottom-corner stack: the card, then a row with the comment button and the design pill. Gaps let clicks through. */
#dockbox {
  position: fixed; z-index: 10; bottom: 18px; right: 18px; max-height: calc(100vh - 36px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
#dockbox > * { pointer-events: auto; }
#review.left #dockbox { right: auto; left: 18px; align-items: flex-start; }
#pill {
  border: 0; border-radius: 999px; padding: 8px 10px 8px 16px; font-weight: 600; display: flex; gap: 10px; align-items: center;
}
#pill b { font-size: 17px; }
#pill-score { color: var(--marker); }
#pill[aria-expanded="true"], #cpill[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); }
#pill[aria-expanded="true"] #pill-score { color: inherit; }
#pill[aria-expanded="true"] #pill-pos { color: rgba(42, 35, 0, 0.7); }
#pill[aria-expanded="true"] kbd, #cpill[aria-pressed="true"] kbd { border-color: rgba(42, 35, 0, 0.3); background: rgba(255, 255, 255, 0.35); }
#pill-score:empty { display: none; }
#pill-pos { color: var(--on-ink-muted); font-weight: 400; font-size: 14px; }
/* Comment button sits left of the design pill; the tip goes on the outer side of the row. */
.pills { display: flex; gap: 8px; align-items: center; }
.p-block:has(#note-form:not([hidden])) #sec-hint { display: none; }
#cpill {
  border: 0; border-radius: 999px; height: 40px; padding: 0 10px 0 12px; display: flex; gap: 7px; align-items: center;
}
#ctip { white-space: nowrap; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
#review.left #ctip { order: 1; }
#pill { height: 40px; }
#panel {
  width: 340px; min-height: 0; overflow: auto; border-radius: var(--radius-panel); padding: 16px 16px 14px; font-size: 14px;
}
.p-head { display: flex; align-items: center; gap: 8px; }
.p-code { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.p-pos { color: var(--on-ink-muted); margin-right: auto; }
.icon {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--ink-line); background: transparent;
  display: grid; place-items: center; font-size: 16px; line-height: 1; padding: 0;
}
.icon:hover, .chip:hover { background: var(--ink-2); }
.p-block { border-top: 1px solid var(--ink-line); margin-top: 14px; padding-top: 12px; }
.p-label { font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.p-label small { color: var(--on-ink-muted); font-weight: 400; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0 6px; }
.scale button {
  height: 44px; border-radius: var(--radius-control); border: 1px solid var(--ink-line); background: var(--ink-2);
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.scale button[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); border-color: var(--marker); }
.scale.small button { height: 34px; font-size: 15px; }
.scale-word { min-height: 1.4em; color: var(--on-ink-muted); }
#panel textarea, #panel input[type="text"] {
  width: 100%; resize: vertical; min-height: 64px; border-radius: var(--radius-control); border: 1px solid var(--ink-line);
  background: rgba(255, 255, 255, 0.06); color: var(--on-ink); padding: 9px 10px; font-size: 14px;
}
#panel textarea::placeholder { color: var(--on-ink-muted); }
.chip {
  border: 1px solid var(--ink-line); background: transparent; border-radius: var(--radius-control); padding: 8px 12px;
  font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); border-color: var(--marker); }
.chip.primary { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.hint { color: var(--on-ink-muted); margin: 8px 0 0; }
.notes { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.notes li { background: rgba(255, 255, 255, 0.05); border-radius: 9px; padding: 8px 10px; }
.notes .n-top { display: flex; gap: 8px; align-items: baseline; }
.notes .n-top [data-go] { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; flex: 1; }
.notes .n-top [data-go]:hover { text-decoration: underline; }
.notes .n-act { background: none; border: 0; color: var(--on-ink-muted); padding: 0 2px; font-size: 13px; }
.notes p { margin: 3px 0 0; color: var(--on-ink-muted); white-space: pre-wrap; }
.badge { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--marker); }
.form { background: var(--ink-2); border-radius: 12px; padding: 10px; margin-top: 10px; }
.form .p-label { margin-bottom: 4px; }
.status { color: var(--on-ink-muted); font-size: 13px; }
.status.bad { color: #ff8b8e; }
.status button { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }
.list { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.list button {
  border: 1px solid var(--ink-line); background: transparent; border-radius: 8px; padding: 6px 0 4px; font-weight: 700;
  font-size: 13px; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.list button small { display: block; font-weight: 400; color: var(--on-ink-muted); font-size: 11px; }
.list button.done small { color: var(--marker); }
.list button[aria-current="true"] { border-color: var(--on-ink); }
.p-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.p-foot a { color: var(--on-ink-muted); font-size: 13px; }
#toast {
  position: fixed; z-index: 20; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 16px;
  border-radius: 999px; font-weight: 600; font-size: 14px; max-width: calc(100vw - 32px);
}
.closed-note { background: var(--ink-2); border-radius: 10px; padding: 8px 10px; margin-top: 10px; }

/* Boards: top 3 and guessing */
.board { max-width: 1240px; margin: 0 auto; padding: 48px 20px 80px; }
.board h1 { font-size: 2rem; letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.15; }
.board > p { max-width: 70ch; margin: 0 0 6px; }
.bar {
  position: sticky; top: 0; z-index: 3; background: var(--paper); padding: 14px 0; margin: 14px 0 6px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line);
}
.count { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.count b { font-variant-numeric: tabular-nums; }
.count.over b { color: var(--bad); }
.count.full b { color: var(--good); }
.bar .spacer { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.card.picked { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #e3e7ec; border: 0; padding: 0; display: block; width: 100%; }
.thumb iframe { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; pointer-events: none; }
.thumb .rank {
  position: absolute; top: 10px; left: 10px; background: var(--marker); color: var(--marker-ink); font-weight: 700;
  border-radius: 999px; padding: 4px 12px;
}
.card-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.card-head { display: flex; align-items: baseline; gap: 8px; }
.card-head b { font-size: 20px; font-variant-numeric: tabular-nums; }
.card-head a { margin-left: auto; font-size: 14px; color: var(--muted); }
.models { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.models button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 7px 8px; text-align: left;
  font-size: 14px; font-weight: 600; line-height: 1.2;
}
.models button small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.models button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.models button[aria-pressed="true"] small { color: var(--on-ink-muted); }
.card input[type="text"] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); font-size: 14px; }
.save-line { font-size: 14px; color: var(--muted); }

@media (max-width: 600px) {
  #dockbox, #review.left #dockbox { left: 8px; right: 8px; bottom: 8px; }
  #panel { width: 100%; max-height: 65vh; }
  .sheet { padding-top: 40px; }
  .sheet h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: no-preference) {
  #cpill, #pill { transition: background-color 0.15s ease, color 0.15s ease; }
}
