/* ============================================================
   金の匙 v2.0-α — 画面まわりの見た目
   3Dの絵づくりは game.js（three.js）。ここはオーバーレイとHUDだけ。
   ============================================================ */

:root {
  --gold-1: #fff3c4;
  --gold-2: #f5cf5a;
  --gold-3: #c9971d;
  --gold-4: #7a5a10;
  --bg-0: #0d0a14;
  --ink: #fff;
  --ink-dim: #bdb6cf;
  --font-body: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── オーバーレイ共通 ── */

.ov {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: max(20px, env(safe-area-inset-top)) 24px max(20px, env(safe-area-inset-bottom));
  background: radial-gradient(closest-side at 50% 45%, rgba(13, 10, 20, 0.55) 0%, rgba(13, 10, 20, 0.93) 100%);
}

.ov-thin {
  background: rgba(10, 7, 18, 0.55);
  backdrop-filter: blur(2px);
}

.alpha-tag {
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--gold-2);
  border: 1px solid var(--gold-4);
  border-radius: 999px;
  padding: 4px 14px;
}

.logo {
  font-size: clamp(3rem, 15vw, 4.6rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-1) 8%, var(--gold-2) 45%, var(--gold-4) 85%, var(--gold-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0 16px rgba(245, 207, 90, 0.3));
}

.lead {
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--ink-dim);
  max-width: 340px;
}

.lead b {
  color: var(--gold-2);
}

.btn-gold {
  width: min(100%, 340px);
  border: 3px solid var(--gold-1);
  border-radius: 16px;
  padding: 14px 10px 12px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #3c2a05;
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 45%, var(--gold-3) 100%);
  box-shadow: 0 6px 0 var(--gold-4), 0 12px 30px rgba(245, 207, 90, 0.35), inset 0 2px 0 #fff;
  transition: transform 0.06s, box-shadow 0.06s;
}

.btn-gold:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--gold-4), 0 6px 18px rgba(245, 207, 90, 0.3), inset 0 2px 0 #fff;
}

.note {
  font-size: 0.72rem;
  color: var(--ink-dim);
}

.homage {
  font-size: 0.62rem;
  color: #6d6683;
  max-width: 320px;
}

/* ── 構え確認 ── */

.aim-card {
  background: rgba(13, 10, 20, 0.85);
  border: 2px solid var(--gold-3);
  border-radius: 18px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.aim-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-2);
}

.aim-sub {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.aim-meter {
  width: 200px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.aim-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-1));
  transition: width 0.1s linear;
}

/* ── 大文字（カウントダウン・落下） ── */

.big {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  z-index: 25;
  text-align: center;
  font-size: clamp(3.4rem, 18vw, 5.5rem);
  font-weight: 800;
  pointer-events: none;
  color: var(--gold-1);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 207, 90, 0.45);
}

.big.is-bad {
  color: #ff6b6b;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.8), 0 0 30px rgba(224, 69, 69, 0.5);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(13, 10, 20, 0.85);
  border: 1.5px solid var(--gold-3);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 18px;
  pointer-events: none;
  white-space: nowrap;
}

/* ── HUD ── */

.hud-top {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

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

.hud-right {
  flex-direction: column;
  align-items: flex-end;
}

.tag {
  background: rgba(13, 10, 20, 0.65);
  border: 1.5px solid var(--gold-3);
  color: var(--gold-2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  border-radius: 8px;
  padding: 5px 9px;
  white-space: nowrap;
}

.falls {
  color: var(--ink-dim);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(13, 10, 20, 0.55);
  border-radius: 8px;
  padding: 5px 8px;
  white-space: nowrap;
}

.btn-hud {
  pointer-events: auto;
  border: 2px solid var(--gold-2);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(245, 207, 90, 0.95), rgba(201, 151, 29, 0.95));
  color: #3c2a05;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 10px 13px;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--gold-4), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.btn-hud:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--gold-4);
}

.btn-hud-s {
  font-size: 0.8rem;
  padding: 7px 10px;
  background: rgba(13, 10, 20, 0.65);
  color: var(--gold-2);
  border-color: var(--gold-4);
  box-shadow: none;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-dim);
  background: rgba(13, 10, 20, 0.6);
  border-radius: 999px;
  padding: 6px 14px;
  pointer-events: none;
  white-space: nowrap;
  max-width: 94vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-mini {
  display: flex;
  gap: 6px;
}

/* ── 持ち物えらび（匙・杓・桶） ── */

.pick-vessel {
  width: min(100%, 360px);
}

.pick-cap {
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  color: var(--gold-2);
  margin-bottom: 6px;
}

.ves-row {
  display: flex;
  gap: 8px;
}

.ves-btn {
  flex: 1;
  border: 2px solid var(--gold-4);
  border-radius: 12px;
  background: linear-gradient(180deg, #241d38, #17121f);
  color: var(--ink-dim);
  padding: 9px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: transform 0.06s;
}

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

.ves-emoji {
  font-size: 1.25rem;
  line-height: 1.2;
}

.ves-name {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.ves-sub {
  font-size: 0.6rem;
  font-weight: 700;
  opacity: 0.8;
}

.ves-btn.is-on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 45%, var(--gold-3));
  border-color: var(--gold-1);
  color: #3c2a05;
  box-shadow: 0 0 16px rgba(245, 207, 90, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.ves-row-s .ves-btn {
  padding: 7px 4px 5px;
}

.ves-row-s .ves-name {
  font-size: 1rem;
}

.ves-desc {
  font-size: 0.68rem;
  color: var(--ink-dim);
  margin-top: 6px;
  min-height: 1.5em;
}

/* ── 設定パネル ── */

.set-ov {
  justify-content: flex-end;
  padding: 0;
  /* パネルの外（3D画面）は指で直接さわって調整できるようにする */
  pointer-events: none;
  background: linear-gradient(180deg, rgba(13, 10, 20, 0) 40%, rgba(13, 10, 20, 0.35) 100%);
  backdrop-filter: none;
}

.set-card {
  width: 100%;
  max-width: 520px;
  /* 画面の下半分に収め、はみ出す項目はパネル内でスクロールする
     （上半分は3D画面のまま残して、指で直接さわって調整できるように） */
  max-height: 62dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(13, 10, 20, 0.96);
  border-top: 3px solid var(--gold-3);
  border-radius: 20px 20px 0 0;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: left;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.set-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold-2);
  text-align: center;
}

.set-lead {
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--ink-dim);
  text-align: center;
  margin-top: -8px;
}

.set-lead b {
  color: var(--gold-2);
}

.set-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.set-sec {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--gold-3);
  border-bottom: 1px solid #2f2745;
  padding-bottom: 4px;
  margin-top: 2px;
}

.set-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.set-label b {
  color: var(--gold-2);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.set-ends {
  display: flex;
  justify-content: space-between;
}

.set-ends i {
  font-style: normal;
  font-size: 0.64rem;
  color: #6d6683;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  margin: 0;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-4), var(--gold-3));
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  border: 2px solid #fff8dc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-4), var(--gold-3));
}

input[type='range']::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  border: 2px solid #fff8dc;
}

.set-seg {
  display: flex;
  gap: 8px;
}

.set-seg button {
  flex: 1;
  border: 2px solid var(--gold-4);
  border-radius: 10px;
  background: rgba(36, 29, 56, 0.9);
  color: var(--ink-dim);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 8px 0;
}

.set-seg button.is-on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 50%, var(--gold-3));
  border-color: var(--gold-1);
  color: #3c2a05;
}

.set-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 2px;
}

.btn-plain2 {
  flex: 1;
  border: 2px solid #453a63;
  border-radius: 12px;
  padding: 11px 8px;
  background: rgba(30, 24, 48, 0.9);
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 0.78rem;
}

.btn-gold-s {
  flex: 1;
  width: auto;
  font-size: 1rem;
  padding: 11px 8px;
  border-width: 2px;
  box-shadow: 0 4px 0 var(--gold-4), inset 0 2px 0 #fff;
}

@media (prefers-reduced-motion: reduce) {
  .btn-gold,
  .btn-hud {
    transition: none;
  }
}
