:root {
  --bg: #f4f4f1; --card: #ffffff; --ink: #1f2328; --muted: #646a73; --line: #d9dbd6;
  --accent: #2f5d8a; --accent-ink: #ffffff; --warn: #b42318; --soft: #eef3f8; --stage: #2a2c30;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181b; --card: #222428; --ink: #e8e9ea; --muted: #9aa0a8; --line: #3a3d43;
          --accent: #6ea4d8; --accent-ink: #0d1520; --warn: #ff8a80; --soft: #1d2a37; --stage: #101113; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 1.5rem; margin: 0 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.hint { background: var(--soft); padding: .5rem .7rem; border-radius: 6px; }
.error { color: var(--warn); font-weight: 600; }
.big { font-size: 1.15rem; font-weight: 600; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
button { font: inherit; border-radius: 7px; padding: .55rem 1rem; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost:hover { background: var(--soft); }
button.wide { width: 100%; margin-top: .6rem; }
input, textarea { font: inherit; color: inherit; }
input[type=text], input:not([type]), input[type=password], textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
label { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.6rem; }
.narrow { max-width: 560px; margin: 8vh auto; }
.narrow label { margin-bottom: .8rem; }
.steps li { margin-bottom: .5rem; }
.demo-banner { background: #f2c94c; color: #3a2c00; text-align: center; padding: .35rem 1rem; font-weight: 600; font-size: .85rem; }

/* review */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.prog { flex: 1; max-width: 520px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: .3rem; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - 58px); }
.demo-banner:not([hidden]) ~ #v-review .review { height: calc(100vh - 88px); }
.stage { position: relative; background: var(--stage); display: flex; align-items: center; justify-content: center;
  overflow: hidden; user-select: none; -webkit-user-select: none; }
.stage img { max-width: 96%; max-height: 96%; object-fit: contain; pointer-events: none; }
.shield { position: absolute; inset: 0; }
.wm { position: absolute; inset: -50%; transform: rotate(-28deg); color: rgba(255,255,255,.16); font-size: 15px;
  line-height: 3.2; word-spacing: .4rem; pointer-events: none; overflow: hidden; text-shadow: 0 0 1px rgba(0,0,0,.35); }
.paused, .loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: var(--stage); color: #fff; font-size: 1.2rem; gap: 1rem; }
.panel { background: var(--card); border-left: 1px solid var(--line); padding: 1rem 1.1rem; overflow-y: auto; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: .7rem 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .35rem; }
legend .muted { font-weight: 400; font-size: .85rem; display: block; }
.opt { padding: .2rem 0; cursor: pointer; }
.opt input { margin-right: .4rem; }
.cat { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.cat .best { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.cat .best:has(input:disabled) { opacity: .35; }
.none { margin-top: .3rem; border-top: 1px dashed var(--line); padding-top: .4rem; }
#prob-note { margin-top: .4rem; }
.locked { background: var(--soft); padding: .45rem .6rem; border-radius: 6px; }
.assigned { font-size: 1.4rem; font-weight: 700; margin: .2rem 0 .3rem; }
.big-choice { margin: .9rem 0; }
.choice { border: 1px solid var(--line); border-radius: 8px; padding: .7rem 1.2rem; font-weight: 600; cursor: pointer; flex: 1; text-align: center; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.choice input { margin-right: .4rem; }
dialog { max-width: 820px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 1.4rem; }
dialog::backdrop { background: rgba(0,0,0,.45); }
table.defs { border-collapse: collapse; width: 100%; margin-bottom: .8rem; }
table.defs td, table.defs th { border-bottom: 1px solid var(--line); padding: .45rem .5rem; text-align: left; vertical-align: top; }

/* zoom */
.stage img { transition: transform .08s ease-out; transform-origin: center center; will-change: transform; }
.shield { cursor: zoom-in; touch-action: none; }
.zoombar { position: absolute; right: .7rem; bottom: .7rem; display: flex; gap: .3rem; z-index: 2; }
.zoombar button { background: rgba(20,22,25,.78); color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: .3rem .7rem; font-weight: 700; min-width: 2.3rem; }

/* confidentiality notice, bottom of every page after login */
.notice { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #3a2c00; color: #ffe8a3;
  font-size: .82rem; text-align: center; padding: .4rem 1rem; line-height: 1.3; }
body:has(.notice:not([hidden])) { padding-bottom: 2.4rem; }
body:has(.notice:not([hidden])) .review { height: calc(100vh - 58px - 2.4rem); }
body:has(.notice:not([hidden])):has(.demo-banner:not([hidden])) .review { height: calc(100vh - 88px - 2.4rem); }

/* my answered images */
.pad { padding: .6rem 1rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; padding: 1rem; }
.thumb { position: relative; padding: 0; height: 150px; overflow: hidden; background: var(--stage); border-radius: 8px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.thumb span { position: absolute; left: .35rem; top: .35rem; background: rgba(0,0,0,.65); color: #fff;
  font-size: .75rem; padding: .05rem .4rem; border-radius: 4px; }
.thumb:hover { outline: 2px solid var(--accent); }
table.answers { border-collapse: collapse; width: 100%; margin-top: .6rem; }
table.answers th { text-align: left; vertical-align: top; padding: .45rem .5rem .45rem 0; width: 38%; color: var(--muted); font-weight: 600; }
table.answers td { padding: .45rem 0; border-bottom: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: default; }

/* admin */
.admin { max-width: 1000px; margin: 2rem auto; }
.admin table { border-collapse: collapse; width: 100%; }
.admin td, .admin th { border-bottom: 1px solid var(--line); padding: .5rem; text-align: left; }
.pill { display: inline-block; padding: .1rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 700; }
.pill.on { background: #d8f3dc; color: #1b5e20; } .pill.off { background: #fde2e1; color: #8a1c13; }

@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; height: auto; }
  .stage { height: 60vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
}
