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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1030;
  color: #fff;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hidden { display: none !important; }

/* ---------- loading ---------- */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1030;
  z-index: 50;
  transition: opacity .6s;
}
.loading.fade { opacity: 0; pointer-events: none; }
.loading-inner { text-align: center; letter-spacing: .1em; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 16px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: #ffd27a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- title ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4vh 6vw;
  background: linear-gradient(90deg, rgba(8,12,40,.78) 0%, rgba(8,12,40,.35) 45%, rgba(8,12,40,0) 70%);
  z-index: 20;
}
.title-card { max-width: 460px; }
.title-card h1 {
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: .12em;
  color: #fff4d8;
  text-shadow: 0 0 18px rgba(255,190,90,.8), 0 0 40px rgba(80,120,255,.6);
}
.subtitle { margin: 6px 0 28px; opacity: .85; letter-spacing: .08em; }
.title-card h2 {
  font-size: 14px;
  font-weight: normal;
  letter-spacing: .2em;
  opacity: .7;
  margin-bottom: 10px;
}

.theme-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.theme-item {
  text-align: left;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  font: inherit;
  transition: background .2s, border-color .2s, transform .2s;
}
.theme-item:hover { background: rgba(255,255,255,.16); transform: translateX(4px); }
.theme-item.active { border-color: #ffd27a; background: rgba(255,210,122,.18); }
.theme-item strong { display: block; font-size: 16px; }
.theme-item span { font-size: 12px; opacity: .75; }

.btn-primary {
  font: inherit;
  font-size: 20px;
  letter-spacing: .3em;
  padding: 14px 48px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #3b2300;
  background: linear-gradient(180deg, #ffe7a8, #ffb84d);
  box-shadow: 0 0 24px rgba(255,190,90,.6);
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 0 36px rgba(255,190,90,.9); }

.howto { list-style: none; margin-top: 26px; font-size: 13px; line-height: 2; opacity: .85; }
.howto .key {
  display: inline-block;
  min-width: 150px;
  color: #ffd27a;
}

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud-stats {
  position: absolute;
  left: 20px; bottom: 20px;
  display: flex; gap: 22px;
  font-size: 26px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.hud-stats small { font-size: 13px; opacity: .8; }
.hud-buttons {
  position: absolute;
  right: 16px; top: 16px;
  display: flex; gap: 8px;
  pointer-events: auto;
}
.hud-buttons button {
  font: inherit;
  font-size: 14px;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(10,16,50,.45);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.hud-buttons button:hover { background: rgba(40,56,120,.6); }

.zone-caption {
  position: absolute;
  top: 14%;
  width: 100%;
  text-align: center;
  font-size: clamp(22px, 3vw, 36px);
  letter-spacing: .4em;
  text-shadow: 0 0 16px rgba(255,200,120,.8), 0 2px 6px rgba(0,0,0,.6);
  opacity: 0;
  transition: opacity 1.4s;
}
.zone-caption.show { opacity: 1; }

.hint {
  position: absolute;
  bottom: 22px;
  width: 100%;
  text-align: center;
  font-size: 14px;
  opacity: .8;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
  transition: opacity 1s;
}
.hint.fade { opacity: 0; }

body.ui-hidden .hud-stats,
body.ui-hidden .hint,
body.ui-hidden .zone-caption { opacity: 0 !important; }
body.ui-hidden .hud-buttons { opacity: .15; }
body.ui-hidden .hud-buttons:hover { opacity: 1; }
