/* Adventure integration: keep the illustrated shell and a front-on puzzle. */
#game { grid-template-columns: minmax(0, 1fr); --cube-a: var(--cubeA); --cube-b: var(--cubeB); grid-template-rows: 48px 108px minmax(172px, 1fr) 42px 44px; gap: 10px; padding: calc(16px + env(safe-area-inset-top)) 22px calc(12px + env(safe-area-inset-bottom)); }
#game .target-stage { width: 90px; height: 90px; display: grid; place-items: center; }
#game #targetBoard { width: 100%; height: 100%; min-width: 0; min-height: 0; display: block; }
#game #targetBoard canvas { width: 100% !important; height: 100% !important; display: block; object-fit: contain; }
#game .game-board-wrap { display: grid; place-items: center; }
#playBoard {
  width: min(96cqw, calc(100cqh - 10px), 372px);
  gap: clamp(12px, 5cqw, 20px);
  padding: 12px;
  overflow: visible;
  border-color: color-mix(in srgb, var(--paper-hi) 24%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--frame-hi) 18%, transparent), color-mix(in srgb, var(--theme-ink) 28%, transparent));
  box-shadow: inset 0 1px #fff2, 0 12px 24px #071b2326;
}
#playBoard .cube-slot { border: 0; background: transparent; box-shadow: none; transform: none; transition: none; overflow: visible; border-radius: 10px; }
#playBoard .cube-slot:active { transform: none; }
#playBoard .cube-slot::before, #playBoard .cube-slot::after { display: none; }
#playBoard .cube-slot[aria-pressed="true"] { outline: 3px solid var(--paper-hi); outline-offset: 3px; box-shadow: 0 0 0 7px var(--action-mid); z-index: 3; }
#playBoard .cube-slot[aria-pressed="true"]::after { display: block; content: attr(data-piece-label); inset: -10px auto auto -8px; min-width: 22px; width: auto; height: 22px; border-radius: 8px; background: var(--paper-hi); }
#playBoard .cube-slot.is-linked-selection { outline: 2px dashed var(--paper-hi); outline-offset: 2px; z-index: 2; }
#playBoard .cube-slot.is-moving { z-index: 5; }
#playBoard .cube-slot.is-moving::after { display: none; }
#playBoard .cube-flat, #playBoard .cube-side { border-color: var(--theme-ink); }
#playBoard .cube-slot .link-badge { z-index: 6; pointer-events: none; top: auto; right: 3px; bottom: 3px; width: 18px; height: 18px; display: grid; place-items: center; border: 1.5px solid var(--theme-ink); border-radius: 6px; color: #25202a; font: 700 10px/1 QuestText,sans-serif; }
#playBoard.revealing .cube-slot { opacity: 0; }
#game .game-tools { min-width: 0; }
#game .game-tools button { flex-direction: column; gap: 2px; padding: 3px 4px; }
#game .game-tools .undo-icon, #game .game-tools .relic-shortcut > span { font: 700 22px/18px sans-serif; }
.game-tools button:disabled { opacity: .45; }
@media (max-height: 740px) {
  #game { grid-template-rows: 44px 90px minmax(170px, 1fr) 42px 44px; gap: 7px; padding: calc(10px + env(safe-area-inset-top)) 18px calc(8px + env(safe-area-inset-bottom)); }
  #game .target-stage { width: 72px; height: 72px; }
  #game .target-info h2 { font-size: 22px; margin: 5px 0; }
}
@media (max-width: 350px) {
  #game { padding-left: 12px; padding-right: 12px; }
}
@media (max-height: 610px) {
  #game { grid-template-rows: 44px 64px minmax(166px, 1fr) 38px 44px; gap: 3px; padding-top: 5px; padding-bottom: 5px; }
  #game .target-wrap { padding-top: 3px; padding-bottom: 3px; }
  #game .target-stage { width: 52px; height: 52px; }
  #game .target-info h2 { font-size: 19px; margin: 2px 0; }
  #game #playBoard { padding: 8px; gap: clamp(10px, 4cqw, 14px); width: min(96cqw, 100cqh, 320px); }
}
@media (max-height: 550px) { #app:has(#game.active) { height: 570px; min-height: 570px; max-height: none; } }

.audio-options { display: contents; }
#settingsOverlay .modal-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#settingsOverlay .modal-actions .settings-option { grid-column: span 2; }
#settingsOverlay .modal-actions > .quiet-button,
#settingsOverlay .modal-actions > .btn { grid-column: span 3; }
.audio-options .ico { width: 15px; height: 15px; }


.game-instructions { align-self: center; padding: 0 3px; text-align: center; color: var(--paper-hi); text-shadow: 0 1px 3px #17261f, 0 1px 8px #17261f; }
.game-instructions p { margin: 0; font-size: 12px; font-weight: 700; line-height: 1.4; }
.game-instructions small { display: block; margin-top: 3px; font-size: 10px; line-height: 1.3; }
.game-instructions small:empty { display: none; }
.settings-heading { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tutorial-help { width: 44px; height: 44px; flex: 0 0 44px; border: 1.5px solid var(--theme-ink); border-radius: 50%; color: var(--theme-ink); background: var(--paper-hi); font: 700 22px Quest,sans-serif; }
.tutorial-modal { width: 100%; --cube-a: var(--cubeA); --cube-b: var(--cubeB); }
.tutorial-step[hidden] { display: none; }
.tutorial-mosaic { position: relative; display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; width: 114px; height: 114px; margin: 22px auto; padding: 5px; border: 2px solid var(--theme-ink); border-radius: 12px; background: var(--theme-ink); }
.tutorial-mosaic i { background: var(--cube-b); border-radius: 3px; }
.tutorial-mosaic i:first-child, .tutorial-mosaic i:last-of-type { background: linear-gradient(135deg,var(--cube-a) 50%,var(--cube-b) 50%); }
.tutorial-mosaic i:nth-child(2) { background: var(--cube-a); }
.tutorial-mosaic.solved { gap: 0; }
.tutorial-mosaic b { position: absolute; right: -12px; bottom: -10px; width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--theme-ink); border-radius: 50%; background: var(--action-mid); color: var(--theme-ink); font-size: 23px; }
.tutorial-practice { display: grid; place-items: center; height: 152px; }
#tutorialBoard { width: 108px; height: 108px; }
#tutorialBoard .cube-slot { display: block; width: 100%; height: 100%; }
#tutorialBoard .cube-slot::before, #tutorialBoard .cube-slot::after { display: none; }
.tutorial-modal #tutorialHint { min-height: 30px; margin: 4px 0 8px; font-weight: 700; line-height: 1.3; }
.tutorial-actions { display: grid; gap: 5px; }
.tutorial-actions button { min-height: 44px; }
.tutorial-actions button:disabled { opacity: .5; }
@media(max-height:650px) {
 .tutorial-modal { padding: 14px 16px 10px; }
 .tutorial-modal h3 { font-size: 27px; margin: 6px 0 10px; }
 .tutorial-practice { height: 130px; }
 .tutorial-mosaic { margin: 18px auto; }
}
