* { box-sizing: border-box; }
:root { font-family: system-ui, sans-serif; color: #ffe1b1; background: #14152c; }
body { margin: 0; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
header { display: flex; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 16px 8px; gap: 8px; }
small { font-size: 9px; letter-spacing: .18em; color: #c48c70; }
h1 { margin: 3px 0; font-size: clamp(17px, 4.7vw, 24px); font-weight: 650; }
#clock { border: 1px solid #93684b; border-radius: 50%; min-width: 48px; height: 48px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
#stage { position: relative; min-height: 0; touch-action: none; overflow: hidden; outline-offset: -3px; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.label { position: absolute; top: 10px; width: 100%; text-align: center; font-size: 10px; letter-spacing: .18em; pointer-events: none; color: #d5a784; }
#veil { position: absolute; inset: 0; background: #14152cee; display: grid; place-content: center; text-align: center; }
#veil[hidden] { display: none; }
footer { padding: 8px 14px max(12px, env(safe-area-inset-bottom)); background: #201c32; border-top: 1px solid #614333; }
#message { margin: 0 0 8px; font-size: 13px; min-height: 32px; }
.controls { display: flex; align-items: center; gap: 8px; }
.controls span { flex: 1; font-size: 10px; line-height: 1.5; color: #c9ada9; }
button { min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid #aa7750; border-radius: 14px; background: #33283b; color: #ffe1b1; font: inherit; font-size: 12px; cursor: pointer; touch-action: manipulation; }
button:focus-visible, #stage:focus-visible { outline: 2px solid #89efde; }
@media (max-width: 350px) { header { padding: 8px 10px; } footer { padding: 8px 10px; } .controls { gap: 5px; } button { padding: 8px; } }
@media (max-height: 450px) {
  body { grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  header { padding: 8px; flex-wrap: wrap; } h1 { font-size: 17px; } header small, .label { display: none; }
  #clock { height: 40px; min-width: 44px; border-radius: 10px; }
  #stage { grid-column: 2; grid-row: 1 / 3; }
  footer { padding: 8px; grid-column: 1; grid-row: 2; } #message { font-size: 12px; }
  .controls { flex-wrap: wrap; } .controls span { flex-basis: 100%; }
}

/* Production shell; the wheel and cranking remain shared with the graybox. */
[hidden] { display: none !important; }
body[data-production] button, .back { height: 44px; min-height: 44px; min-width: 44px; }
.back { display: grid; place-items: center; color: #ffe1b1; text-decoration: none; border: 1px solid #aa7750; border-radius: 14px; }
body[data-production] .controls { flex-wrap: wrap; gap: 4px; }
body[data-production] .controls button { padding: 4px 8px; }
#chapter { position: absolute; top: 8px; width: 100%; text-align: center; font-size: 11px; color: #d5a784; pointer-events: none; }
.storage { display: flex; align-items: center; gap: 4px; min-height: 22px; }
#save-status { font-size: 10px; flex: 1; }
dialog { color: #ffe1b1; background: #201c32; border: 1px solid #aa7750; border-radius: 20px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 16px; }
dialog::backdrop { background: #101020aa; }
dialog h2 { font-size: 20px; margin: 0 0 10px; }
dialog p { font-size: 13px; }
#silhouette-preview { display: block; width: 130px; height: 130px; margin: auto; }
@media (max-height: 450px) { body[data-production] header { gap: 4px; } body[data-production] h1 { font-size: 15px; } body[data-production] #message { font-size: 11px; margin-bottom: 4px; } body[data-production] footer { overflow-y: auto; } #silhouette-preview { width: 100px; height: 100px; } }
