/* SpacedCube: case dialog and 3D viewer. */
/* Dialog */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 10, 14, .5); display: grid; place-items: center; z-index: 20;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.dialog {
  background: var(--surface); color: var(--ink); border-radius: 16px; width: min(560px, 100%);
  max-height: calc(100% - 24px); overflow: auto; padding: 22px; position: relative; display: grid; gap: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.dlg-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.dlg-head h2 { font-family: var(--font-display); font-stretch: 112%; font-size: 26px; font-weight: 800; }
.dlg-head h2 span { font-weight: 500; color: var(--muted); font-size: 18px; }
.dlg-head .muted { margin: 2px 0 8px; }
.x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; }
.sec { display: grid; gap: 8px; }
.sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
  font-family: var(--font-mono); font-size: 14px;
}
.msg { margin: 0; font-size: 13px; min-height: 1.2em; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }
.kv { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kv li { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: grid; }
.kv b { font-size: 18px; font-variant-numeric: tabular-nums; }
.kv span { font-size: 12px; color: var(--muted); }
.hist { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.hist i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hist i.h1 { background: var(--good); } .hist i.h0 { background: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }


.viewer { width: min(720px, 100%); gap: 12px; }
.v-title { font-family: var(--font-display); font-stretch: 110%; font-size: 20px; font-weight: 800; padding-right: 40px; }
.v-stage { height: min(52vh, 420px); min-height: 240px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--bg)); display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: grab; }
.v-stage canvas { display: block; }
.v-msg { padding: 20px; text-align: center; }
.v-moves { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; font-family: var(--font-mono); font-size: 17px; font-weight: 500; }
.v-moves li { padding: 2px 6px; border-radius: 6px; min-width: 2.2ch; text-align: center; border: 1.5px solid transparent; }
.v-moves li.auf { color: var(--muted); font-style: italic; }
.v-moves li.done { opacity: .45; }
.v-moves li.now { border-color: var(--accent); background: var(--accent-soft); opacity: 1; }
.v-ctrl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v-play { min-width: 120px; justify-content: center; }
.v-speed { margin-left: auto; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.v-speed select { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 4px 6px; }
.v-open { justify-self: start; }

.hist > span[aria-hidden] { display: contents; }
