/* A deliberately plain, fixed light theme: every rater sees the images under the same conditions. */
:root {
  --bg: #f1f1ee; --surface: #ffffff; --ink: #1c1c1a; --muted: #62625d; --line: #c6c6c0;
  --accent: #1d5fbf; --accent-soft: #e4edfa; --warn: #a23b1e; --warn-soft: #fbeee9;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .4rem; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .6rem 1.3rem; font-weight: 600; }
button.primary:disabled { background: #a9b4c4; cursor: default; }
button.quiet { background: none; border: 1px solid var(--line); border-radius: 6px; padding: .3rem .8rem; color: var(--muted); }
button:focus-visible, input:focus-visible, .opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.foot { position: fixed; right: 10px; bottom: 6px; font-size: .7rem; color: #9a9a94; pointer-events: none; }

/* Plain pages */
body.plain { display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; width: 100%; max-width: 520px; }
.panel.wide { max-width: 820px; }
.panel label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.panel input { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 6px; letter-spacing: .06em; }
.panel form button { margin-top: 1rem; }
.panel ul { padding-left: 1.2rem; margin: .3rem 0; }
.panel li { margin: .25rem 0; }
.who { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.error { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: .5rem .8rem; }
.notice { background: var(--accent-soft); border-radius: 6px; padding: .5rem .8rem; }
table { border-collapse: collapse; width: 100%; margin-top: .6rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .35rem .6rem; border-bottom: 1px solid var(--line); }
th.num, td.num { text-align: right; }

/* Work screen */
body.work { overflow: hidden; display: flex; flex-direction: column; height: 100vh; }
body.work .foot { display: none; }
.top { flex: none; height: 48px; display: flex; align-items: center; gap: 18px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .label { font-weight: 600; }
.top .progress, .top .timer { color: var(--muted); font-variant-numeric: tabular-nums; }
.top .spacer { flex: 1; }
.top form { margin: 0; }
.narrow { flex: none; background: var(--warn-soft); color: var(--warn); text-align: center; padding: 4px; font-size: .9rem; }
.view { flex: 1; min-height: 0; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* Arrangement: on the left the reference and the card in hand, equally large; on the right the cards still to
   place and, below them, the line. Cards, stems and dots are placed by the script, in the coordinates of .arr. */
.arr { position: relative; height: 100%; display: grid; grid-template-columns: var(--lw, 30%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--fh, 70%); gap: 12px; padding: 12px 16px; user-select: none; touch-action: none; }
.views { grid-row: 1 / span 2; display: flex; gap: 12px; min-width: 0; min-height: 0; }
.views.rows { flex-direction: column; }      /* wide designs: one above the other; tall designs: side by side */
.pane { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 6px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.panehead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.panehead h2 { flex: 1 1 0; min-width: 0; margin: 0; font-size: 1rem; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoomin { flex: none; padding: .05rem .6rem; font-size: .85rem; line-height: 1.5; white-space: nowrap; }
.zoomin:disabled { visibility: hidden; }
.views.tight .ztext { display: none; }
.views.tight .zoomin { padding: .05rem .45rem; }
.views.tight .panehead h2 { font-size: .9rem; }
.note { margin: 8px 0 0; color: var(--muted); font-size: .92rem; min-height: 1.4em; }
.pane .note { margin: 4px 0 0; font-size: .9rem; line-height: 1.3; min-height: 2.6em; }      /* two lines when the panes are narrow */
.views.rows .pane .note { min-height: 1.3em; }
/* A large image sits in a frame and is sized and placed by the script, so that it can be shown turned */
.frame { position: relative; overflow: hidden; background: #fff; }
.frame img { position: absolute; max-width: none; display: block; pointer-events: none; }
.frame.turned::after { content: "turned"; position: absolute; left: 4px; bottom: 3px; padding: 0 5px; border-radius: 4px; background: rgba(255,255,255,.88);
  color: var(--muted); font-size: .72rem; line-height: 1.5; pointer-events: none; }
.paneimg { flex: 1; min-height: 0; cursor: zoom-in; }
.paneimg[hidden] { display: none; }
.selhint { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); margin: 0; padding: 0 10%; }
.selhint[hidden] { display: none; }
.traypane { border: 1px dashed var(--line); border-radius: 10px; padding: 0 0 0 10px; display: flex; min-width: 0; min-height: 0; }
.traymain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.traylab { margin: 6px 0; font-size: .85rem; color: var(--muted); }
.traybody { flex: 1; min-height: 0; margin-bottom: 8px; }
.bar { flex: none; width: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; text-align: center; }
.bar.wide { flex: 1; width: auto; flex-direction: row; justify-content: flex-end; gap: 16px; text-align: left; }
.leftcount { color: var(--muted); }
.feedback { flex: 1; background: var(--warn-soft); color: #5c2413; border-radius: 6px; padding: .35rem .8rem; font-size: .9rem; line-height: 1.35; }
.feedback p { margin: .15rem 0; }
.field { position: relative; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.scale { position: absolute; height: 2px; background: #8d8d86; }
.tick { position: absolute; width: 2px; height: 14px; background: #8d8d86; }
.lab { position: absolute; font-size: .82rem; font-weight: 600; line-height: 1.15; }
.stem { position: absolute; width: 1px; background: #a9a9a2; pointer-events: none; z-index: 1; }
.dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #6f6f69; pointer-events: none; z-index: 2; }
.stem.sel, .dot.sel { background: var(--accent); }
.dot.sel { z-index: 3; }
.stem[hidden], .dot[hidden] { display: none; }
.card { position: absolute; z-index: 5; background: #fff; border: 1px solid #9c9c95; border-radius: 5px; padding: 3px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.card img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card.drag { cursor: grabbing; box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(0,0,0,.25); }
.card.fixed { cursor: zoom-in; border-style: dashed; background: #f6f6f3; }
.card.fixed::after { content: "example"; position: absolute; left: -20px; right: -20px; bottom: -17px; font-size: .72rem; color: var(--muted); text-align: center; white-space: nowrap; }
.card.flag { outline: 3px solid var(--warn); outline-offset: 2px; }

/* Comparison */
.cho { height: 100%; display: flex; flex-direction: column; align-items: center; padding: 14px 18px 10px; gap: 10px; }
.question { font-size: 1.15rem; font-weight: 600; margin: 4px 0 0; text-align: center; }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.cho .note { margin: 0; text-align: center; }
.cho .mid { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.cho figure { margin: 0; position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; align-items: center; }
.cho .figimg { width: var(--im, 140px); height: var(--im, 140px); }
.cho figcaption { font-size: .8rem; color: var(--muted); padding-top: 3px; }
.pair { display: flex; gap: 34px; align-items: flex-start; justify-content: center; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: center; background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.opt { background: none; border: 3px solid transparent; border-radius: 12px; padding: 3px; }
.opt:hover { border-color: #9db9e6; }
.opt.chosen { border-color: var(--accent); background: var(--accent-soft); }
.zoombtn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.92); color: var(--muted); line-height: 1; font-size: 15px; padding: 0; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(28,28,26,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.overlay[hidden] { display: none; }
.dialog { background: var(--surface); border-radius: 12px; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.dialog .dbody { flex: 1; min-height: 0; overflow: auto; padding: 26px 30px 6px; }
.dialog .dbody:focus { outline: none; }
.dialog h1 { font-size: 1.35rem; }
.dialog .lead { font-size: 1.05rem; }
.dialog ul { padding-left: 1.2rem; color: #33332f; }
.dialog li { margin: .3rem 0; }
.dialog .actions { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 30px 20px; border-top: 1px solid var(--line); }
.dialog .more { color: var(--muted); font-size: .9rem; }
.dialog .more[hidden] { display: none; }
/* Enlarged view: every image in a pane of its own, zoomed, moved and turned on its own */
.zoom { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; padding: 12px 18px 16px; background: rgba(28,28,26,.9); }
.zbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #fff; }
.zhint { font-size: .92rem; }
.zbar button { background: #fff; color: var(--ink); border-color: #fff; padding: .3rem 1rem; }
.zpanes { flex: 1; min-height: 0; display: flex; gap: 14px; }
.zpane { flex: 1; min-width: 0; margin: 0; background: #fff; border-radius: 10px; padding: 8px 10px 6px; display: flex; flex-direction: column; }
.zview { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; cursor: zoom-in; touch-action: none; user-select: none; }
.zview.zoomed { cursor: grab; }
.zview img { position: absolute; max-width: none; display: block; pointer-events: none; }
.zpane figcaption { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .85rem; padding-top: 6px; }
.zname { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zctl { flex: none; display: flex; align-items: center; gap: 6px; }
.zctl button { min-width: 2.1rem; padding: .05rem .55rem; white-space: nowrap; }
.zctl button:disabled { opacity: .4; cursor: default; }
.zturn { width: 120px; margin: 0; accent-color: #6f6f69; cursor: pointer; }      /* a plain grey: the slider shows an angle, not progress */
