﻿:root {
  color-scheme:light;
  --aqua:#9ad0d2;
  --ink:#285e65;
  --pale:#d3edef;
  --yellow:#ffdf22;
  font-family:system-ui,sans-serif;
  font-size:14px;
  font-weight:400;
  line-height:1.5;
  letter-spacing:normal;
  color:var(--ink);
  background:var(--aqua);
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
}
button, input, select, textarea {
  font:inherit;
}
button {
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
button:disabled {
  cursor:default;
}
button:focus-visible,[tabindex]:focus-visible {
  outline:3px solid #2864bd;
  outline-offset:5px;
}
[hidden] {
  display:none!important;
}
button {
  touch-action:manipulation;
}
#app {
  max-width:480px;
  min-height:100dvh;
  margin:auto;
}
.screen {
  min-height:100dvh;
  padding-top:env(safe-area-inset-top);
}
.title-screen {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:space-between;
  padding:0 7% max(28px,env(safe-area-inset-bottom));
  min-height:100svh;
}
.title-logo {
  width:100%;
  margin-top:clamp(24px,16svh,150px);
  aspect-ratio:1.48;
}
.start-area {
  width:100%;
  margin:36px 0 9svh;
}
.start-slider {
  height:64px;
  padding:9px;
  position:relative;
  border-radius:17px;
  background:var(--pale);
  touch-action:none;
  user-select:none;
}
.start-track {
  height:100%;
  background:repeating-linear-gradient(to right,#fff 0,#fff calc(100% / 7 - 1px),#ddd calc(100% / 7 - 1px),#ddd calc(100% / 7));
  border:1px solid #d3d9d9;
}
.start-handle {
  position:absolute;
  left:9px;
  top:9px;
  bottom:9px;
  width:calc((100% - 18px) * 3 / 7);
  display:flex;
  will-change:transform;
}
.start-handle i {
  flex:1;
  display:grid;
  place-items:center;
  font-style:normal;
  font-size:23px;
  color:#ffffffa0;
  background:#00b33d;
  box-shadow:inset 0 0 0 1px #0002;
}
.start-handle i:nth-child(2) {
  background:#ff5252;
}
.start-handle i:nth-child(3) {
  background:#f8cd13;
}
.start-caption {
  text-align:center;
  font-size:26px;
  letter-spacing:2px;
  font-weight:800;
  color:white;
  margin:12px 0;
}
.title-footnote {
  text-align:center;
  font-size:11px;
  letter-spacing:.3px;
  margin-top:24px;
  opacity:.8;
}
.icon {
  border:0;
  background:none;
  color:#fff;
  width:44px;
  height:44px;
  padding:0;
  font-size:37px;
  line-height:1;
  flex-shrink:0;
}
.icon:active {
  transform:scale(.9);
}
.eyebrow {
  font-size:10px;
  font-weight:800;
  letter-spacing:.06em;
  margin:0 0 5px;
}
.stage-header {
  display:flex;
  align-items:center;
  gap:10px;
  padding:26px 16px 12px;
}
.stage-header h1 {
  font-size:19px;
  margin:0;
}
.counter {
  margin-left:auto;
  font-size:12px;
  white-space:nowrap;
  font-weight:800;
  background:#ffffff45;
  padding:8px 10px;
  border-radius:20px;
}
.stage-instruction {
  text-align:center;
  font-size:11px;
  margin:12px 0 25px;
  opacity:.8;
}
.stage-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:17px 13px;
  padding:0 20px 20px;
}
.stage-tile {
  position:relative;
  aspect-ratio:1;
  border:7px solid #e8e9e9;
  border-radius:14px;
  padding:2px;
  background:#f7f7f7;
  box-shadow:0 6px 0 #b6bcbc;
  transition:transform .15s;
}
.stage-tile canvas {
  display:block;
  width:100%;
  height:100%;
  border-radius:5px;
  image-rendering:pixelated;
}
.stage-tile.locked canvas,.stage-tile.current canvas {
  filter:grayscale(1);
  opacity:.38;
}
.stage-tile.current {
  border-color:var(--yellow);
  box-shadow:0 6px 0 #e7bc0b;
}
.stage-tile.current:active {
  transform:translateY(4px);
  box-shadow:0 2px 0 #e7bc0b;
}
.stage-tile.cleared {
  border-color:#c8eaff;
  box-shadow:0 6px 0 #88bdd8;
}
.tile-number {
  position:absolute;
  right:-4px;
  bottom:-5px;
  min-width:18px;
  padding:1px 3px;
  background:#ffffffd9;
  border-radius:5px;
  color:#627e83;
  font-size:9px;
  line-height:14px;
}
.stage-footer {
  text-align:center;
  font-size:11px;
  padding:15px 0 28px;
  opacity:.6;
}
.game-screen {
  display:flex;
  flex-direction:column;
  min-height:100svh;
  padding-bottom:max(12px,env(safe-area-inset-bottom));
}
.game-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 12px 7px;
  text-align:center;
}
.game-header h1 {
  font-size:15px;
  margin:0;
  font-weight:800;
}
.game-header .eyebrow {
  font-size:10px;
}
.sound {
  font-size:31px;
}
.reference-area {
  display:flex;
  justify-content:center;
  align-items:flex-end;
  gap:14px;
  padding:16px 12px 20px;
}
.reference-frame {
  width:min(49vw,24svh,230px);
  padding:12px;
  border-radius:22px;
  background:var(--pale);
}
#target-board {
  width:100%;
  aspect-ratio:1;
  display:block;
  border:3px solid var(--ink);
  image-rendering:pixelated;
}
.grid-icon {
  font-size:34px;
}
.play-info {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:2px 18px 12px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.4px;
}
#move-label {
  background:#ffffff55;
  padding:6px 11px;
  border-radius:20px;
}
#move-label.urgent {
  background:#fff0d0;
  color:#a44735;
}
.board-wrap {
  width:min(100%,52svh);
  aspect-ratio:1;
  align-self:center;
  position:relative;
  box-shadow:0 3px 20px #285e6510;
}
#play-board {
  display:block;
  width:100%;
  height:100%;
  touch-action:none;
  user-select:none;
  cursor:grab;
}
#play-board:active {
  cursor:grabbing;
}
.play-hint {
  text-align:center;
  font-size:11px;
  margin:18px 12px 8px;
  opacity:.8;
}
dialog {
  border:0;
  border-radius:25px;
  padding:28px 24px;
  width:min(88vw,350px);
  max-height:90svh;
  overflow:auto;
  background:#eefafa;
  color:var(--ink);
  text-align:center;
  box-shadow:0 18px 70px #163e4740;
}
dialog::backdrop {
  background:#102c32ad;
}
dialog h2 {
  font-size:22px;
  font-weight:700;
  line-height:1.3;
  overflow-wrap:anywhere;
  margin:7px 0 12px;
}
dialog p {
  font-size:13px;
  line-height:1.7;
}
dialog .eyebrow {
  font-size:10px;
}
.modal-actions {
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:22px;
}
.action {
  border:0;
  border-radius:12px;
  background:#d8ebed;
  color:var(--ink);
  font-size:14px;
  font-weight:700;
  padding:13px 12px;
  min-height:46px;
}
.action.primary {
  background:#75b6cf;
  color:white;
  box-shadow:0 4px 0 #5599b4;
}
.action.reward {
  background:#ffe470;
  color:#6c5e23;
  box-shadow:0 4px 0 #ddc054;
}
.action.quiet {
  background:transparent;
  font-size:12px;
}
.action:active {
  transform:translateY(2px);
}
.clear-mark {
  font-size:50px;
  margin:0 0 8px;
  color:#f0c624;
}
.clear-title {
  font-size:38px;
  letter-spacing:3px;
  line-height:1.1;
  color:var(--ink);
  font-weight:900;
}
.clear-picture {
  width:78px;
  height:78px;
  border:7px solid #c7e7ed;
  border-radius:10px;
  margin:18px auto;
  display:block;
  image-rendering:pixelated;
}
.collection-picture {
  display:block;
  width:100%;
  aspect-ratio:1;
  image-rendering:pixelated;
  margin:18px auto;
}


.storage-notice {
  position:fixed;
  bottom:10px;
  left:5%;
  width:90%;
  font-size:12px;
  background:#fff1d6;
  padding:10px;
  border-radius:10px;
  z-index:30;
}
@media(min-width:700px) {
  body {
    background:#9ad0d2;
  }
  #app {
    background:var(--aqua);
    box-shadow:0 0 70px #37676e25;
  }
  .title-logo {
    margin-top:13svh;
  }
}
@media(max-height:650px) {
  .game-header {
    padding-top:7px;
  }
  .reference-area {
    padding-top:5px;
    padding-bottom:10px;
  }
  .reference-frame {
    padding:8px;
  }
  .play-hint {
    margin-top:10px;
  }
  .title-logo {
    margin-top:8svh;
  }
  .start-area {
    margin-bottom:3svh;
  }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation:none!important;
    transition:none!important;
  }
}








.screen {
  padding-top: 0;
  min-height: calc(100svh - 44px - env(safe-area-inset-top));
}
@media (max-height: 650px) {
  .reference-frame {
    width: min(49vw, 20svh, 230px);
  }
  .board-wrap {
    width: min(100%, 48svh);
  }
}
.game-top { position:relative; }
@media (orientation:landscape) and (max-height:500px) {
  .game-screen { flex-direction:row; align-items:center; gap:12px; padding:12px; }
  .game-top { width:48%; height:calc(100svh - 80px); min-height:180px; }
  .game-screen .board-wrap { width:min(48%,calc(100svh - 80px)); flex-shrink:0; }
  .game-screen .play-hint { display:none; }
}


/* 조작 영역을 우선하고, 낮은 화면에서는 상단 여백과 정답 이미지를 줄입니다. */
@media (orientation:portrait) and (max-height:750px) {
  .game-header { padding-top:7px; }
  .reference-area { padding-top:5px; padding-bottom:10px; }
  .reference-frame { width:min(49vw,18svh,230px); padding:8px; }
  .play-info { padding-bottom:8px; }
  .play-hint { margin-top:10px; }
}
