* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  /* 常夏の夕暮れパレット */
  --sky-top: #1d1537;
  --sky-mid: #4a2560;
  --sky-low: #a04468;
  --horizon: #e8795a;
  --gold: #ffd97a;
  --sea-top: #6b2f5e;
  --sea-deep: #171129;
  --text: #fff4e8;
  --muted: #cfa8a0;
  --glass: rgba(28, 14, 40, 0.5);
  --glass-strong: rgba(32, 16, 44, 0.72);
  --border: rgba(255, 205, 160, 0.18);
  --accent: #ffb066;
  --grad: linear-gradient(135deg, #ffd166, #ff7b54 55%, #ff4f7b);
  --shadow: 0 24px 64px rgba(10, 4, 20, 0.55);
}

html {
  /* セーフエリア・オーバースクロール部分にも背景色を敷く */
  background: var(--sky-top);
  height: 100%;
  /* ゲームアプリなので長押しの選択・メニュー・タップハイライトを無効化
     (iOS の「コピー/調べる/翻訳」や画像保存メニューの誤発動を防ぐ) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  color: var(--text);
  min-height: 100%;
  overflow: hidden;
  background: var(--sea-deep);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   背景シーン: 常夏の夕暮れの海
   ============================================================ */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* 空 */
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    #35204f 26%,
    var(--sky-mid) 42%,
    #7c3564 54%,
    var(--sky-low) 60%,
    var(--horizon) 66%,
    #ffb072 69.5%
  );
}

/* 星 (上空でまたたく) */
.scene-stars {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  animation: twinkle 4.5s ease-in-out infinite;
}

.stars-1 {
  box-shadow:
    5vw 8vh 0 0 rgba(255, 245, 225, 0.9),
    12vw 15vh 0 0 rgba(255, 235, 210, 0.6),
    20vw 5vh 0 0 rgba(255, 245, 225, 0.85),
    28vw 11vh 0 0 rgba(255, 235, 210, 0.55),
    35vw 3vh 0 0 rgba(255, 245, 225, 0.75),
    43vw 9vh 0 0 rgba(255, 235, 210, 0.6),
    52vw 6vh 0 0 rgba(255, 245, 225, 0.9),
    60vw 13vh 0 0 rgba(255, 235, 210, 0.5),
    68vw 4vh 0 0 rgba(255, 245, 225, 0.8),
    76vw 10vh 0 0 rgba(255, 235, 210, 0.6),
    85vw 7vh 0 0 rgba(255, 245, 225, 0.85),
    93vw 14vh 0 0 rgba(255, 235, 210, 0.55);
}

.stars-2 {
  width: 1.5px;
  height: 1.5px;
  animation-duration: 6s;
  animation-delay: 1.6s;
  box-shadow:
    9vw 20vh 0 0 rgba(255, 235, 215, 0.5),
    17vw 26vh 0 0 rgba(255, 225, 200, 0.4),
    26vw 19vh 0 0 rgba(255, 235, 215, 0.55),
    38vw 24vh 0 0 rgba(255, 225, 200, 0.35),
    47vw 17vh 0 0 rgba(255, 235, 215, 0.5),
    57vw 22vh 0 0 rgba(255, 225, 200, 0.4),
    66vw 28vh 0 0 rgba(255, 235, 215, 0.35),
    74vw 18vh 0 0 rgba(255, 225, 200, 0.45),
    83vw 25vh 0 0 rgba(255, 235, 215, 0.4),
    91vw 20vh 0 0 rgba(255, 225, 200, 0.5);
}

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* 茜色の雲 */
.scene-cloud {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  animation: drift 70s ease-in-out infinite alternate;
}

.cloud-1 {
  width: 46vw;
  height: 7vh;
  left: 6vw;
  top: 38vh;
  background: rgba(255, 140, 120, 0.22);
}

.cloud-2 {
  width: 38vw;
  height: 6vh;
  right: 4vw;
  top: 48vh;
  background: rgba(255, 170, 130, 0.25);
  animation-duration: 90s;
  animation-delay: -30s;
}

.cloud-3 {
  width: 30vw;
  height: 5vh;
  left: 30vw;
  top: 55vh;
  background: rgba(255, 190, 150, 0.2);
  animation-duration: 80s;
  animation-delay: -55s;
}

@keyframes drift {
  from { transform: translateX(-4vw); }
  to { transform: translateX(4vw); }
}

/* 沈む太陽 */
.scene-sun {
  position: absolute;
  left: 50%;
  top: 60vh;
  width: 15vmin;
  height: 15vmin;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff7dc 0%, var(--gold) 55%, #ffab63 100%);
  box-shadow:
    0 0 40px 18px rgba(255, 205, 130, 0.5),
    0 0 140px 70px rgba(255, 150, 90, 0.3),
    0 0 320px 160px rgba(255, 120, 80, 0.16);
  animation: sun-breathe 7s ease-in-out infinite;
}

@keyframes sun-breathe {
  0%, 100% { box-shadow: 0 0 40px 18px rgba(255, 205, 130, 0.5), 0 0 140px 70px rgba(255, 150, 90, 0.3), 0 0 320px 160px rgba(255, 120, 80, 0.16); }
  50% { box-shadow: 0 0 48px 22px rgba(255, 205, 130, 0.62), 0 0 160px 80px rgba(255, 150, 90, 0.38), 0 0 340px 170px rgba(255, 120, 80, 0.2); }
}

/* 海 */
.scene-sea {
  position: absolute;
  left: 0;
  right: 0;
  top: 66vh;
  bottom: 0;
  background: linear-gradient(180deg, #d86a54 0%, var(--sea-top) 22%, #3b2154 55%, var(--sea-deep) 100%);
}

/* さざ波のきらめき */
.scene-sea::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 200, 140, 0.09) 0 2px,
    transparent 2px 9px
  );
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 75%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 75%);
  animation: waves 9s linear infinite;
}

@keyframes waves {
  from { background-position-y: 0; }
  to { background-position-y: 11px; }
}

/* 太陽の光の道 */
.scene-reflection {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 17vmin;
  height: 90%;
  background: linear-gradient(180deg, rgba(255, 214, 140, 0.65), rgba(255, 160, 100, 0.22) 45%, transparent 85%);
  filter: blur(7px);
  animation: shimmer 5.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.85; width: 17vmin; }
  50% { opacity: 0.55; width: 20vmin; }
}

/* ヤシの木のシルエット */
.scene-palm {
  position: absolute;
  bottom: -4vmin;
  font-size: 42vmin;
  line-height: 1;
  filter: brightness(0);
  opacity: 0.82;
  transform-origin: 50% 95%;
  animation: sway 9s ease-in-out infinite alternate;
}

.palm-1 {
  left: -13vmin;
}

.palm-2 {
  right: -14vmin;
  font-size: 30vmin;
  animation-delay: -4.5s;
}

@keyframes sway {
  from { transform: rotate(-1.6deg); }
  to { transform: rotate(1.6deg); }
}

/* フィルム風の粒子 */
.scene-grain {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}

/* 周辺減光 (ノスタルジックなヴィネット) */
.scene-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(12, 5, 24, 0.6));
}

@media (prefers-reduced-motion: reduce) {
  .scene * {
    animation: none !important;
  }
}

/* ============================================================
   時間帯テーマ (body.time-day / time-sunset / time-night)
   sunset がデフォルト。実際の時刻に合わせて JS がクラスを付与する
   ============================================================ */

/* --- 昼: 明るい南国の海 --- */
body.time-day {
  --sky-top: #2b7fc4;
  --muted: #d9edf5;
  --glass: rgba(10, 45, 70, 0.42);
  --glass-strong: rgba(12, 48, 74, 0.72);
  --border: rgba(255, 255, 255, 0.25);
}

body.time-day .scene {
  background: linear-gradient(
    180deg,
    #2b7fc4 0%,
    #4899d4 34%,
    #6fb8e2 52%,
    #a3d9ec 62%,
    #d8f3f2 66%,
    #eafcf7 69.5%
  );
}

body.time-day .scene-stars {
  display: none;
}

body.time-day .scene-cloud {
  background: rgba(255, 255, 255, 0.5);
}

body.time-day .cloud-1 { top: 16vh; }
body.time-day .cloud-2 { top: 30vh; background: rgba(255, 255, 255, 0.4); }
body.time-day .cloud-3 { top: 42vh; background: rgba(255, 255, 255, 0.35); }

body.time-day .scene-sun {
  top: 20vh;
  left: 68%;
  width: 11vmin;
  height: 11vmin;
  background: radial-gradient(circle, #ffffff 0%, #fff4c4 55%, #ffe89a 100%);
  box-shadow:
    0 0 50px 24px rgba(255, 250, 220, 0.55),
    0 0 150px 80px rgba(255, 240, 190, 0.28);
  animation: none;
}

body.time-day .scene-sea {
  background: linear-gradient(180deg, #7fd4d6 0%, #2e9fb5 22%, #14657f 55%, #0a3a52 100%);
}

body.time-day .scene-sea::before {
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14) 0 2px,
    transparent 2px 9px
  );
}

body.time-day .scene-reflection {
  left: 68%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18) 45%, transparent 85%);
}

body.time-day .scene-vignette {
  background: radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(8, 30, 45, 0.45));
}

/* --- 夜: 月と満天の星 --- */
body.time-night {
  --sky-top: #05060f;
  --muted: #a9abcf;
  --glass: rgba(12, 10, 30, 0.55);
  --glass-strong: rgba(16, 13, 38, 0.78);
  --border: rgba(185, 200, 255, 0.16);
}

body.time-night .scene {
  background: linear-gradient(
    180deg,
    #05060f 0%,
    #0b0d22 34%,
    #141133 52%,
    #221947 62%,
    #32235a 66%,
    #3c2a63 69.5%
  );
}

body.time-night .scene-stars {
  opacity: 1;
}

body.time-night .scene-cloud {
  background: rgba(130, 145, 205, 0.1);
}

/* 太陽 → 月 */
body.time-night .scene-sun {
  top: 22vh;
  left: 70%;
  width: 9vmin;
  height: 9vmin;
  background: radial-gradient(circle at 38% 35%, #ffffff 0%, #e4eaf8 55%, #becbe8 100%);
  box-shadow:
    0 0 30px 12px rgba(200, 215, 255, 0.35),
    0 0 100px 50px rgba(170, 190, 255, 0.16);
  animation: none;
}

body.time-night .scene-sea {
  background: linear-gradient(180deg, #2b2050 0%, #191540 30%, #0d0b26 65%, #05060f 100%);
}

body.time-night .scene-sea::before {
  background: repeating-linear-gradient(
    180deg,
    rgba(200, 215, 255, 0.07) 0 2px,
    transparent 2px 9px
  );
}

/* 月の光の道 */
body.time-night .scene-reflection {
  left: 70%;
  background: linear-gradient(180deg, rgba(210, 222, 255, 0.4), rgba(190, 205, 255, 0.14) 45%, transparent 85%);
}

body.time-night .scene-vignette {
  background: radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(3, 3, 12, 0.65));
}

/* ============================================================
   レイアウト
   ============================================================ */
.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== セットアップ画面 ===== */
#setup-screen {
  align-items: center;
  gap: clamp(12px, 3vh, 40px);
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.setup-header {
  text-align: center;
  /* margin auto で上下中央寄せ (はみ出しても上が切れない) */
  margin-top: auto;
}

.setup-card {
  margin-bottom: auto;
}

.setup-header h1 {
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(92deg, #ffe9a8 0%, #ffb066 40%, #ff6f7d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 16px rgba(255, 140, 90, 0.3));
}

.title-icon {
  -webkit-text-fill-color: initial;
  margin-right: 0.35em;
  filter: drop-shadow(0 4px 12px rgba(255, 179, 71, 0.4));
}

/* バージョンバッジ */
.version {
  -webkit-text-fill-color: var(--muted);
  display: inline-block;
  vertical-align: super;
  font-size: 0.36em;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 235, 210, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 0.6em;
  filter: none;
}

.setup-header p {
  color: var(--muted);
  margin-top: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 10px rgba(20, 8, 30, 0.8);
}

.setup-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(14px, 2.4vh, 28px) clamp(14px, 3vw, 28px);
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 20px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* --- ドロップゾーン --- */
.dropzone {
  border: 1.5px dashed rgba(255, 210, 165, 0.35);
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  background: rgba(255, 235, 210, 0.03);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--gold);
  background: rgba(255, 200, 120, 0.08);
}

.dropzone:active {
  transform: scale(0.99);
}

.dropzone-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(255, 79, 123, 0.2));
  border: 1px solid rgba(255, 200, 130, 0.35);
  box-shadow: 0 8px 24px rgba(255, 130, 90, 0.2);
}

.dropzone-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* 写真選択後はコンパクトな横並びレイアウト */
.dropzone.has-image {
  padding: 14px;
  cursor: default;
}

#dropzone-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

#dropzone-preview img {
  width: 44%;
  max-height: clamp(80px, 16vh, 160px);
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 4, 20, 0.55);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.preview-note {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --- 難易度 --- */
.difficulty h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 12px;
  color: var(--muted);
}

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.diff-btn {
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 235, 210, 0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 4px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform 0.12s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.diff-btn:hover {
  background: rgba(255, 235, 210, 0.1);
}

.diff-btn:active {
  transform: scale(0.96);
}

.diff-count {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.diff-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.diff-btn.selected {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.26), rgba(255, 79, 123, 0.24));
  border-color: rgba(255, 190, 110, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 180, 100, 0.18), 0 8px 24px rgba(255, 120, 80, 0.18);
}

.diff-btn.selected .diff-count {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.diff-btn.selected .diff-label {
  color: #ffdcb2;
}

/* ===== ボタン共通 ===== */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 235, 210, 0.08);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, background 0.2s, border-color 0.2s, filter 0.15s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 235, 210, 0.15);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--grad);
  border: none;
  color: #401505;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(255, 110, 80, 0.45);
}

.btn-primary:hover:not(:disabled) {
  background: var(--grad);
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
}

.btn-small {
  font-size: 0.85rem;
  padding: 8px 13px;
  border-radius: 10px;
}

.btn-small.active {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.28), rgba(255, 79, 123, 0.26));
  border-color: rgba(255, 190, 110, 0.7);
  color: #ffdcb2;
}

/* ===== ゲーム画面 ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left));
  background: rgba(24, 10, 34, 0.55);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-wrap: wrap;
  z-index: 2;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.3rem;
  margin-right: 2px;
  filter: drop-shadow(0 2px 8px rgba(255, 179, 71, 0.45));
}

.stat {
  font-variant-numeric: tabular-nums;
  background: rgba(255, 235, 210, 0.07);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.88rem;
}

.game-main {
  flex: 1;
  position: relative;
  min-height: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#game-canvas.dragging {
  cursor: grabbing;
}

/* ===== モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 6, 26, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  cursor: pointer;
  padding: 20px;
}

.modal-body {
  text-align: center;
}

#peek-img {
  max-width: min(86vw, 900px);
  max-height: 76vh;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.clear-body {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 44px;
  cursor: default;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.clear-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(92deg, #ffe9a8, #ff6f7d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.clear-sub {
  color: #ffd9b8;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

#clear-stats {
  color: var(--muted);
  margin-bottom: 24px;
  white-space: pre-line;
  line-height: 1.8;
}

.clear-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes pop-in {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 紙吹雪 */
.confetti {
  position: fixed;
  top: -30px;
  font-size: 1.6rem;
  z-index: 60;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

/* 背の低い画面: 余白と要素を圧縮してスクロールなしで収める */
@media (max-height: 780px) {
  .setup-header h1 {
    font-size: clamp(1.4rem, 4.5vw, 2rem);
  }

  .setup-header p {
    font-size: 0.82rem;
    margin-top: 6px;
  }

  .dropzone {
    padding: 16px 14px;
  }

  .dropzone-icon {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    margin-bottom: 8px;
    border-radius: 16px;
  }

  .dropzone-title {
    font-size: 0.95rem;
  }

  .muted {
    font-size: 0.78rem;
  }

  .diff-btn {
    padding: 8px 4px 7px;
  }

  .diff-count {
    font-size: 1rem;
  }

  .btn-primary {
    padding: 12px;
    font-size: 1rem;
  }

  .btn {
    padding: 9px 14px;
  }
}

/* ===== モバイル ===== */
@media (max-width: 600px) {
  /* 縦方向を圧縮してノッチ付き実機でも1画面に収める */
  #setup-screen {
    gap: 12px;
  }

  .setup-header h1 {
    font-size: 1.5rem;
  }

  .version {
    font-size: 0.52em;
    padding: 2px 8px;
    margin-left: 0.5em;
  }

  .setup-header p {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    margin-top: 6px;
  }

  .setup-card {
    gap: 12px;
    padding: 14px;
  }

  .dropzone {
    padding: 14px 12px;
  }

  .dropzone-icon {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    margin-bottom: 8px;
    border-radius: 14px;
  }

  .dropzone-title {
    font-size: 0.95rem;
  }

  .btn-primary {
    padding: 12px;
    font-size: 1rem;
  }

  /* 月・昼の太陽はタイトル文字と重ならない位置へ */
  body.time-night .scene-sun,
  body.time-day .scene-sun {
    top: 8vh;
    left: 82%;
  }

  body.time-night .scene-reflection,
  body.time-day .scene-reflection {
    left: 82%;
  }

  /* 3列 + 中央寄せ2つの2段組み */
  .difficulty-buttons {
    grid-template-columns: repeat(6, 1fr);
  }

  .diff-btn {
    grid-column: span 2;
  }

  .diff-btn:nth-child(4) {
    grid-column: 2 / span 2;
  }

  .diff-btn:nth-child(5) {
    grid-column: 4 / span 2;
  }

  .stat {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  /* ツールバーはアイコンのみ表示で1段に収める */
  .toolbar .btn-label {
    display: none;
  }

  .btn-small {
    font-size: 0.95rem;
    padding: 7px 11px;
  }

  .clear-body {
    padding: 30px 24px;
  }

  .scene-palm {
    font-size: 34vmin;
  }
}
