/* =============================================================
   PARK OUT!! スタイル (css/style.css)
   モバイル(縦長)最優先・明るくポップ・フォント16px以上
   想定クラス: .screen .hud .btn .level-grid .level-cell .overlay .stars
   ============================================================= */

:root {
  --c-bg-top: #7ec9ff;
  --c-bg-bottom: #cdeaff;
  --c-accent: #ff5d6c;      /* ストロベリー(メインアクセント) */
  --c-accent-dark: #d13a4c;
  --c-sub: #ffd93d;         /* レモン(星・強調) */
  --c-ink: #2b3350;         /* 文字色 */
  --c-card: #ffffff;
  --c-locked: #aab3c5;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(43, 51, 80, 0.18);
  --shadow-btn: 0 4px 0 rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Hiragino Maru Gothic ProN', 'M PLUS Rounded 1c', 'BIZ UDGothic',
    'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  color: var(--c-ink);
  background: linear-gradient(180deg, var(--c-bg-top) 0%, var(--c-bg-bottom) 100%);
  background-attachment: fixed;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 画面(タイトル/レベル選択/プレイ) ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px
    calc(16px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.screen.hidden,
.hidden {
  display: none !important;
}

/* タイトル画面 */
.title-inner {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.title-logo {
  font-size: clamp(44px, 13vw, 76px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow:
    0 3px 0 var(--c-accent-dark),
    0 8px 20px rgba(43, 51, 80, 0.35);
  -webkit-text-stroke: 2px var(--c-accent);
  transform: rotate(-2deg);
}

.title-sub {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-ink);
  opacity: 0.85;
}

/* ---------- ボタン ---------- */

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff7a87 0%, var(--c-accent) 100%);
  border-radius: 999px;
  padding: 14px 34px;
  min-height: 52px;
  box-shadow: var(--shadow-btn);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.btn:disabled {
  filter: grayscale(0.7);
  opacity: 0.6;
  cursor: default;
}

/* 控えめボタン(白地) */
.btn-ghost {
  background: var(--c-card);
  color: var(--c-ink);
}

/* アイコンボタン(HUD用の正方形小ボタン) */
.btn-icon {
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  font-size: 20px;
  line-height: 1;
  border-radius: 14px;
  background: var(--c-card);
  color: var(--c-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 大きな主ボタン(スタート等) */
.btn-big {
  font-size: 22px;
  padding: 18px 48px;
}

/* ---------- HUD(プレイ画面上部バー) ---------- */

.hud {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 56px 6px 0; /* 右は言語切替ボタンとの重なり回避 */
  flex-shrink: 0;
}

.hud-title {
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.hud-taps {
  margin-left: auto;
  font-size: 18px;
  font-weight: 900;
  background: var(--c-card);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}

.hud-taps.over {
  color: var(--c-accent-dark);
}

.hud-spacer {
  flex: 1;
}

/* ---------- 盤面 ---------- */

.board-wrap {
  flex: 1;
  width: 100%;
  max-width: 520px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-wrap canvas,
#board {
  display: block;
  touch-action: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 100%;
  max-height: 100%;
}

/* ---------- レベル選択 ---------- */

.level-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 12px;
  flex-shrink: 0;
}

.level-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
}

.level-grid {
  width: 100%;
  max-width: 520px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 4px 2px 24px;
  align-content: start;
}

.level-cell {
  position: relative;
  padding: 6px;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 16px;
  background: var(--c-card);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  color: var(--c-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.08s ease;
}

.level-cell:active {
  transform: translateY(2px);
}

.level-cell.cleared {
  background: linear-gradient(180deg, #fff8d6 0%, #ffefad 100%);
}

.level-cell.locked {
  background: var(--c-locked);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  cursor: default;
}

.level-cell .stars {
  font-size: 11px;
}

/* ---------- 星表示 ---------- */

.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 20px;
  line-height: 1;
  color: #d9dee8;            /* 消灯 */
  letter-spacing: 1px;
}

.stars .on {
  color: var(--c-sub);       /* 点灯 */
  text-shadow: 0 1px 0 rgba(180, 130, 0, 0.4);
}

.stars-big {
  font-size: 40px;
}

/* ---------- オーバーレイ(クリア/失敗/確認) ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(43, 51, 80, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlay-in 0.18s ease-out;
}

.overlay.hidden {
  display: none !important;
}

.overlay-panel {
  width: 100%;
  max-width: 340px;
  background: var(--c-card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom) * 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  animation: panel-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.overlay-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
}

.overlay-text {
  margin: 0;
  font-size: 16px;
  opacity: 0.8;
}

.overlay-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ---------- 言語切替(右上想定) ---------- */

.lang-toggle {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 14px;
  z-index: 10;
}

/* ---------- 横長・大画面 ---------- */

@media (min-width: 700px) {
  .level-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .title-inner {
    gap: 14px;
  }
  .title-logo {
    font-size: clamp(32px, 8vh, 56px);
  }
}
