/* Maze — 100dvh フルスクリーンレイアウト。配色は元の iOS 版(SpriteKit 既定の濃灰背景)に合わせる */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: #262626;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- HUD (プレイ中のみ表示) ---- */
#hud {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  font-size: 1rem;
}
.hud-center { display: flex; align-items: center; gap: 8px; }
#hud-level { color: #888; font-size: 0.85rem; }
/* 傾きインジケータ(円の中を点が動く) */
#tilt {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1px solid #666;
  border-radius: 50%;
}
#tilt-dot {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff8000;
}
#hud-time { font-variant-numeric: tabular-nums; }
.hud-btn {
  border: none;
  background: none;
  color: #fff;
  font: inherit;
  cursor: pointer;
  padding: 2px 0;
}

/* ---- ステージ ---- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---- タイトル / ゴール画面 ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  user-select: none;
  -webkit-user-select: none;
}
#screen-title { background: #262626; }
#screen-goal { background: rgba(38, 38, 38, 0.45); }

.screen h1 {
  font-size: 4rem;
  font-weight: 400;
  color: #808080;
}
#screen-goal h1 { color: #fff; font-size: 3rem; }
.sub {
  font-size: 0.85rem;
  color: #aaa;
  max-width: 22em;
  line-height: 1.6;
}
.hint {
  font-size: 0.78rem;
  color: #888;
  line-height: 1.7;
}
.title-msg {
  font-size: 0.85rem;
  color: #ff8a65;
  max-width: 22em;
  line-height: 1.6;
}
.goal-time {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

/* ---- プレイヤー名 ---- */
.name-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.name-box label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: #888;
}
#player-name {
  font: inherit;
  font-size: 1rem;
  padding: 6px 10px;
  width: 12em;
  max-width: 80vw;
  text-align: center;
  color: #fff;
  background: #1c1c1c;
  border: 1px solid #666;
  outline: none;
}
#player-name:focus { border-color: #ff8000; }

/* ---- 難易度と自己ベスト(元の iOS 版と同じく、ボタンの右に記録) ---- */
.level-list {
  border-collapse: collapse;
  margin: 4px 0;
}
.level-list td { padding: 4px 0; }
.level-list .best {
  padding-left: 20px;
  text-align: left;
  color: #808080;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.level-btn {
  min-width: 6em;
  padding: 4px 12px;
  text-align: right;
  font-size: 1.8rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
}
.level-btn:hover, .level-btn:focus-visible { color: #ff8000; outline: none; }

/* ---- ランキング(ゴール画面) ---- */
#ranking {
  width: min(360px, 90vw);
  max-height: 40vh;
  overflow-y: auto;
  padding: 8px 12px;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid #555;
}
#ranking h3 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #aaa;
  margin-bottom: 4px;
}
#ranking table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
#ranking td {
  padding: 3px 4px;
  border-top: 1px solid #3a3a3a;
  text-align: right;
}
#ranking td.name {
  text-align: left;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ranking tr.me td { color: #ff8000; }
#ranking p { font-size: 0.85rem; color: #aaa; margin-top: 4px; }

.sound-btn {
  padding: 4px 14px;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #ccc;
  background: none;
  border: 1px solid #666;
  cursor: pointer;
}
.sound-btn.off { color: #777; border-color: #444; }

/* ゴールの文字(元の版と同じく横に伸びた状態から縮む) */
#goal-title.pop { animation: goal-pop 0.4s linear; }
@keyframes goal-pop {
  from { transform: scaleX(5); }
  to   { transform: scaleX(1); }
}

.btn-main {
  padding: 8px 40px;
  font-size: 1.4rem;
  color: #fff;
  background: none;
  border: 1px solid #888;
  cursor: pointer;
}
.btn-main:hover, .btn-main:focus-visible { border-color: #ff8000; color: #ff8000; outline: none; }

/* ---- 横向きの案内(元の iOS 版は縦向き固定)。タッチ端末で横にしたときは全面を覆う(傾きの軸が変わるため) ---- */
#rotate-note {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: #262626;
  color: #aaa;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  padding: 24px;
  font-size: 1.1rem;
  line-height: 1.6;
}
#rotate-note small { font-size: 0.8rem; color: #888; }
@media (pointer: coarse) and (orientation: landscape) {
  #rotate-note { display: flex; }
}

/* 2026.10.18(01) */
