.dd-game {
  --dd-ink: #102131;
  --dd-muted: #526c7a;
  --dd-line: #b7c8d2;
  --dd-panel: #fff;
  --dd-soft: #eef5f8;
  --dd-primary: #006b99;
  color: var(--dd-ink);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: #edf3f6;
}

.dd-game [hidden] { display: none !important; }

.dd-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--dd-line); flex-wrap: wrap; }
.dd-settings { position: relative; }
.dd-settings > summary, .dd-button { min-height: 42px; border: 1px solid #8da5b4; border-radius: 8px; background: #fff; color: var(--dd-ink); padding: 8px 13px; font: inherit; font-weight: 800; cursor: pointer; }
.dd-settings > summary { list-style: none; display: inline-flex; align-items: center; }
.dd-settings > summary::-webkit-details-marker { display: none; }
.dd-settings-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(330px, calc(100vw - 28px)); padding: 14px; border: 1px solid var(--dd-line); border-radius: 10px; background: #fff; box-shadow: 0 12px 28px rgba(16,33,49,.18); }
.dd-settings-panel fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.dd-settings-panel legend { font-weight: 900; margin-bottom: 6px; }
.dd-settings-panel label { display: block; padding: 5px 0; }
.dd-setting-summary { margin-right: auto; color: var(--dd-muted); font-size: .94rem; font-weight: 750; }
.dd-button:hover, .dd-settings > summary:hover { background: #f3f8fa; }
.dd-button:focus-visible, .dd-settings > summary:focus-visible { outline: 3px solid #f2b544; outline-offset: 2px; }
.dd-button--primary { background: var(--dd-primary); border-color: var(--dd-primary); color: #fff; }
.dd-button--primary:hover { background: #005479; }
.dd-button[disabled] { opacity: .45; cursor: not-allowed; }

.dd-workspace { min-height: 0; display: grid; grid-template-columns: minmax(270px, .7fr) minmax(570px, 1.55fr); gap: 12px; padding: 12px; }
.dd-clue-panel, .dd-play-panel { min-height: 0; background: var(--dd-panel); border: 1px solid var(--dd-line); border-radius: 12px; box-shadow: 0 3px 12px rgba(24,58,76,.08); }
.dd-clue-panel { padding: 16px; overflow: auto; }
.dd-level { margin: 0 0 4px; color: var(--dd-primary); font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.dd-mission { margin: 0 0 12px; font-size: clamp(1.2rem, 2vw, 1.65rem); line-height: 1.18; }
.dd-claim { padding: 10px 12px; border-left: 5px solid #8054b3; border-radius: 6px; background: #f7f2fb; font-weight: 850; }
.dd-clues { padding: 0; margin: 14px 0; list-style: none; display: grid; gap: 8px; }
.dd-clue { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; padding: 9px 10px; border: 1px solid #d5e0e6; border-radius: 8px; line-height: 1.3; }
.dd-clue-state { white-space: nowrap; font-size: .8rem; font-weight: 900; color: var(--dd-muted); }
.dd-clue[data-state="met"] { border-color: #5c9d72; background: #f1f8f3; }
.dd-clue[data-state="met"] .dd-clue-state { color: #21643a; }
.dd-clue[data-state="not-met"] { border-color: #d16a73; background: #fff3f3; }
.dd-clue[data-state="not-met"] .dd-clue-state { color: #9d2531; }
.dd-progress h3 { margin: 16px 0 5px; font-size: 1rem; }
.dd-recorded { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.dd-proof, .dd-claim-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 12px; }
.dd-proof label { display: grid; gap: 4px; font-weight: 800; }
.dd-proof select { min-height: 42px; border: 1px solid #8da5b4; border-radius: 8px; padding: 6px 9px; font: inherit; }

.dd-play-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 12px; overflow: hidden; }
.dd-board-scroll { min-height: 0; display: grid; place-items: center; overflow: hidden; }
.dd-board { width: min(100%, 980px); }
.dd-board .model-figure { margin: 0; }
.dd-board .diagram-visual { width: 100%; height: auto; max-height: 54vh; }
.dd-board [data-digit-card-id] { cursor: grab; }
.dd-board [data-digit-card-id]:focus { outline: none; }
.dd-board [data-digit-card-id]:focus rect { stroke: #f2a900; stroke-width: 4; }
.dd-board [data-digit-card-id].is-picked rect { stroke: #7d43b5; stroke-width: 5; }
.dd-board [data-digit-card-id].is-dragging { opacity: .55; }
.dd-board [data-digit-slot].is-target .digit-card-slot { fill: #fff3c7; stroke: #b57d00; stroke-width: 4; }
.dd-feedback-area { border-top: 1px solid #d5e0e6; padding: 10px 4px 0; }
.dd-feedback { margin: 0; min-height: 1.5em; font-weight: 800; }
.dd-feedback[data-tone="success"] { color: #21643a; }
.dd-feedback[data-tone="error"] { color: #9d2531; }
.dd-feedback[data-tone="hint"] { color: #69419b; }
.dd-reveal { margin: 8px 0 0; color: #344e5d; }
.dd-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 899px), (max-height: 649px) {
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .dd-game { display: block; height: auto; min-height: calc(100dvh - 64px); }
  .dd-workspace { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .dd-clue-panel { overflow: visible; }
  .dd-play-panel { min-height: 430px; overflow: visible; }
  .dd-board-scroll { overflow-x: auto; justify-content: start; }
  .dd-board { min-width: 620px; }
  .dd-board .diagram-visual { max-height: none; }
}

@media (max-width: 520px) {
  .dd-toolbar { padding: 7px 8px; gap: 6px; }
  .dd-setting-summary { flex-basis: 100%; order: -1; }
  .dd-workspace { padding: 8px; gap: 8px; }
  .dd-clue-panel, .dd-play-panel { border-radius: 9px; }
  .dd-clue-panel { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .dd-game *, .dd-game *::before, .dd-game *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
