:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #19294d;
  background: #f8f5ed;
  --ink: #19294d;
  --paper: #fffdf6;
  --sky: #afe0f7;
  --line: #24375a;
  --muted: #425576;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, .file-button, label[for="camera"] { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button, a, select, input { outline-offset: 4px; }
button { color: inherit; }
h1,h2,p,ul { margin: 0; }
button, .file-button, label[for="camera"] { min-height: 42px; }
.head {
  min-height: 106px; padding: 16px clamp(18px, 4vw, 64px); display: flex;
  align-items: center; justify-content: space-between; gap: 14px;
  border-bottom: 1px solid #c6cbd1; background: var(--paper);
}
.identity { min-width: 0; }
.brand { color: #4d5672; font-size: 12px; font-weight: 900; letter-spacing: .15em; }
h1 { font-size: clamp(28px, 4vw, 54px); line-height: 1.08; letter-spacing: -.052em; }
.head-actions, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plain,.primary,.danger,.file-button,label[for="camera"] {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 15px; font-weight: 750;
  background: var(--paper); line-height: 1.25;
}
.primary { background: #faca60; border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
.primary:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.danger { background: #ffe2df; color: #801927; }
#world { display: grid; grid-template-columns: minmax(0,1fr) minmax(278px,350px); gap: 20px;
  max-width: 1580px; margin: auto; padding: 22px clamp(16px,3.5vw,56px) 26px;
}
.stage {
  min-width: 0; min-height: 380px; height: clamp(380px,calc(100svh - 155px),800px);
  background: var(--sky); border: 2px solid var(--line); border-radius: 26px; position: relative;
  display: grid; place-items: center; overflow: clip;
}
#scene { display: block; width: 100%; max-width: calc((100svh - 160px) * 1.37); height: auto; object-fit: contain; }
.stage-label,.credit { position: absolute; font-weight: 750; font-size: 13px; color: var(--ink); }
.stage-label { top: 16px; left: 16px; display: flex; align-items: center; gap: 7px; padding: 7px 11px;
  background: #f4fcff; border: 1px solid #7897af; border-radius: 100px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #257450; }
.credit { bottom: 13px; left: 17px; }
.side,.workshop { background: var(--paper); border: 2px solid var(--line); border-radius: 26px; padding: clamp(16px,2.2vw,28px); }
.side { align-self: start; display: grid; gap: 11px; }
.round-label,.eyebrow { color: #465679; font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.side h2,.workshop h2 { font-size: clamp(26px,3vw,42px); line-height: 1.03; letter-spacing: -.04em; text-wrap: balance; }
.instructions,#upload-help { color: var(--muted); line-height: 1.42; }
.checklist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.checklist:empty { display: none; }
.checklist li { font-size: 13px; line-height: 1.2; font-weight: 700; border: 1px solid #ccd6e3; background: #edf3fc;
  border-radius: 9px; padding: 7px; display: flex; align-items: center; gap: 5px; }
.checklist li span { color: #425576; font-size: 16px; }
.checklist .done { background: #def4df; border-color: #a8cfa9; }
.checklist .done span { color: #206341; }
.qr-card { border-top: 1px solid #d6dce5; padding-top: 11px; display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 12px; }
.qr-card img { width: 88px; height: 88px; display: block; image-rendering: pixelated; border-radius: 6px; }
.qr-card a { font-weight: 800; color: inherit; }
.text-button { background: none; border: 0; text-decoration: underline; text-underline-offset: 2px; padding: 0; min-height: 32px; text-align: left; }
#screen-reports { justify-self: start; font-size: 13px; }
.next-panel { border-radius: 12px; padding: 10px; background: #fff0c9; }
.next-panel p { margin-bottom: 7px; font-size: 16px; font-weight: 800; }
.upload-body .head { min-height: 82px; }
.upload-body #fullscreen { display: none; }
#upload-page, #missing { padding: 24px 14px; }
.workshop { width: min(100%,530px); margin: auto; display: grid; gap: 15px; }
.workshop .primary { justify-self: start; }
.upload-result:not(:empty) { background: #e4f3ff; border: 1px solid #adc7e6; border-radius: 10px; padding: 10px; }
.upload-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 16px; }
#connection { position: fixed; bottom: 12px; left: 12px; max-width: calc(100% - 24px);
  background: #fff6ca; border: 1px solid var(--ink); border-radius: 10px; padding: 8px 12px; z-index: 4; }
.dialog,.popup { color: inherit; background: var(--paper); width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 28px);
  overflow: auto; border: 2px solid var(--line); border-radius: 22px; padding: clamp(14px,3vw,24px); }
dialog::backdrop { background: #14284ed1; }
.dialog-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.dialog p,.dialog .row,.editor p { margin-bottom: 10px; }
.qr-dialog img { width: min(100%, 410px, 65vh); display: block; margin: auto; image-rendering: pixelated; }
.qr-dialog p { text-align: center; margin-top: 10px; }
.parts-list { display: grid; gap: 8px; }
.part-card { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 8px; align-items: center; border: 1px solid #ccd6e3; border-radius: 10px; padding: 8px; }
.part-card img { width: 66px; height: 63px; object-fit: contain; background: #e1edf6; border-radius: 8px; }
.part-card .row { margin: 4px 0 0; }
.part-card button { padding: 6px 9px; }
.editor .dialog-note,.editor .edit-status { line-height: 1.4; color: var(--muted); }
.editor .edit-status:not(:empty) { margin-top: 8px; }
.editor label { font-weight: 650; }
.editor .kind-row,.editor .edit-tabs,.editor .photo-actions,.editor .retouch-tools { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 8px; }
.editor select { color: var(--ink); background: white; min-height: 42px; max-width: 100%; border: 1px solid #7c97aa; border-radius: 8px; padding: 4px 8px; font-size: 16px; }
.editor #recognition-note { display: block; color: var(--muted); flex-basis: 100%; }
.editor canvas { width: 100%; height: auto; max-width: 520px; display: block; border-radius: 10px; touch-action: none;
  background: repeating-conic-gradient(#e6eef5 0 25%, #f8fbfd 0 50%) 0/18px 18px; border: 1px solid #adc7e6; }
.editor .photo-preview { margin: 8px 0; }
.editor input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.editor .file-button:focus-within { outline: 2px solid var(--line); }
.editor .photo-inputs { display: flex; flex-wrap: wrap; gap: 8px; }
.editor .file-button { display: inline-flex; align-items: center; }
.editor #send { margin-top: 6px; }
.editor [aria-pressed=true] { background: #d7edf9; }
@media (max-width: 820px) {
  #world { grid-template-columns: minmax(0,1fr); max-width: 590px; gap: 12px; padding-top: 12px; }
  .stage { min-height: 0; height: auto; aspect-ratio: 4/3; border-radius: 20px; }
  #scene { max-width: 100%; }
  .head { min-height: 75px; padding: 10px 14px; }
  .head-actions .plain { padding: 7px 9px; font-size: 12px; }
  .stage-label,.credit { font-size: 10px; left: 9px; }
  .stage-label { top: 8px; padding: 4px 7px; }
  .credit { bottom: 7px; }
  .side,.workshop { border-radius: 21px; }
}
@media (max-height: 620px) and (min-width: 821px) {
  .head { min-height: 65px; padding-block: 8px; }
  #world { padding-top: 10px; }
  .stage { height: max(300px, calc(100svh - 90px)); min-height: 300px; }
  #scene { max-width: max(410px,calc((100svh - 90px)*1.37)); }
}
@media (prefers-reduced-motion: reduce) { *, *::after, *::before { scroll-behavior: auto !important; } }
