/* METREAL VOL.2 — mini game "ICE AGE BREAKER" (#game-root)
 * Uses tokens from style.css (--red, --cyan, --white, --muted, --line) with fallbacks.
 */
.game {
  --game-red: var(--red, #ff3d4a);
  --game-cyan: var(--cyan, #3ad7f0);
  --game-white: var(--white, #f4f4f6);
  --game-muted: var(--muted, #9a9ca8);
  --game-line: var(--line, rgba(255, 255, 255, .14));
  --game-bg: #07080c;
  --game-ease: cubic-bezier(.2, .8, .2, 1);
  --game-mono: 'Space Mono', ui-monospace, Menlo, Consolas, monospace;
  --game-display: 'Montserrat', 'Noto Sans JP', sans-serif;
  --game-jp: 'Noto Sans JP', sans-serif;
}

/* ---------- layout ---------- */
.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}
@media (min-width: 860px) {
  .game-grid {
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }
}

/* ---------- story video (phone frame) ---------- */
.game-video {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.game-phone {
  position: relative;
  width: min(100%, 300px, calc(70vh * 9 / 16));
  aspect-ratio: 9 / 16;
  padding: 10px;
  border: 1px solid var(--game-line);
  border-radius: 24px;
  background: #0b0c12;
}
.game-phone::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 56px;
  height: 4px;
  margin-left: -28px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .12);
  z-index: 1;
  pointer-events: none;
}
.game-phone-label {
  position: absolute;
  top: -8px;
  left: 18px;
  padding: 0 8px;
  background: var(--game-bg);
  font: 700 10px/16px var(--game-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--game-muted);
  z-index: 2;
}
.game-phone { cursor: url("../assets/cursor-link.svg") 3 2, pointer; }
.game-phone-sound { position: absolute; right: 18px; bottom: 16px; z-index: 2; font: 400 12px/1 var(--game-mono); color: var(--game-white); background: rgba(7, 8, 12, .7); padding: 6px 8px; pointer-events: none; }
.game-video-el {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 15px;
  background: #000;
}
/* ---------- stage ---------- */
.game-stage { min-width: 0; }
.game-frame {
  --game-pulse: 0;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: min(720px, 80vh);
  background: var(--game-bg);
  border: 1px solid rgba(255, 255, 255, calc(.14 + var(--game-pulse) * .6));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 599px) {
  .game-frame { aspect-ratio: 1 / 1; }
}
.game-frame.is-live { cursor: pointer; }
/* corner brackets 「 」 */
.game-frame::before,
.game-frame::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  z-index: 4;
  pointer-events: none;
}
.game-frame::before { top: 8px; left: 8px; border-top: 1px solid var(--game-white); border-left: 1px solid var(--game-white); }
.game-frame::after { right: 8px; bottom: 8px; border-right: 1px solid var(--game-white); border-bottom: 1px solid var(--game-white); }

.game-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  image-rendering: pixelated;
}
.game-canvas:focus-visible { outline: 2px solid var(--game-cyan); outline-offset: -2px; }

.game-scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ---------- overlay screens ---------- */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 12, .78);
  overflow: auto;
}
.game-overlay[hidden] { display: none; }
.game-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 460px;
  text-align: center;
  animation: game-in .4s var(--game-ease) both;
}
.game-screen[hidden] { display: none; }
.game-screen.is-anim { animation: game-in .4s var(--game-ease) both; }
@keyframes game-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.game-tag {
  font: 400 10px/1 var(--game-mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--game-cyan);
}
.game-title {
  margin: 4px 0 0;
  font: 900 clamp(34px, 7vw, 64px)/.95 var(--game-display);
  letter-spacing: -.02em;
  text-transform: uppercase;
  color: var(--game-white);
}
.game-sub {
  margin: 0;
  font: 700 clamp(15px, 2.4vw, 20px)/1.4 var(--game-jp);
  color: var(--game-white);
}
.game-desc {
  margin: 0;
  font: 400 12px/1.8 var(--game-jp);
  color: var(--game-muted);
}
.game-best {
  margin: 4px 0 0;
  font: 400 10px/1.6 var(--game-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--game-muted);
}

/* buttons */
.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 28px;
  box-sizing: border-box;
  border: 1px solid var(--game-white);
  background: transparent;
  color: var(--game-white);
  font: 700 12px/1 var(--game-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s var(--game-ease), color .2s var(--game-ease), border-color .2s var(--game-ease), transform .2s var(--game-ease);
}
.game-btn:hover { background: var(--game-white); color: var(--game-bg); }
.game-btn:active { transform: translateY(1px); }
.game-btn:focus-visible { outline: 2px solid var(--game-cyan); outline-offset: 3px; }
.game-btn-primary { background: var(--game-red); border-color: var(--game-red); color: #fff; }
.game-btn-primary:hover { background: #fff; border-color: #fff; color: var(--game-red); }
.game-btn-ghost { padding: 12px 18px; border-color: var(--game-line); color: var(--game-muted); font-size: 11px; }
.game-btn-ghost:hover { background: transparent; border-color: var(--game-white); color: var(--game-white); }
.game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

/* story */
.game-story-text {
  margin: 0;
  font: 700 clamp(18px, 3.6vw, 28px)/1.5 var(--game-jp);
  color: var(--game-white);
}
.game-story-sub {
  margin: 0;
  font: 700 clamp(13px, 2.2vw, 16px)/1.6 var(--game-jp);
  color: var(--game-red);
}
.game-story-sub[hidden] { display: none; }
.game-story-dots { display: flex; gap: 8px; }
.game-story-dots i {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, .18);
  transition: background .3s var(--game-ease);
}
.game-story-dots i.is-on { background: var(--game-cyan); }

/* result */
.game-rank { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.game-rank-k { font: 400 10px/1 var(--game-mono); letter-spacing: .22em; color: var(--game-muted); }
.game-rank-v {
  font: 900 clamp(64px, 15vw, 112px)/1 var(--game-display);
  letter-spacing: -.02em;
  color: var(--game-white);
}
.game-result-msg {
  margin: 0;
  font: 700 clamp(14px, 2.4vw, 18px)/1.6 var(--game-jp);
  color: var(--game-white);
}
.game-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  margin: 4px 0 0;
  background: var(--game-line);
  border: 1px solid var(--game-line);
}
.game-stat {
  padding: 10px 6px;
  background: rgba(7, 8, 12, .85);
}
.game-stat dt { font: 400 9px/1 var(--game-mono); letter-spacing: .18em; color: var(--game-muted); }
.game-stat dd { margin: 6px 0 0; font: 700 16px/1 var(--game-mono); color: var(--game-white); font-variant-numeric: tabular-nums; }
.game-result-acc { margin: 0; font: 400 10px/1.6 var(--game-mono); letter-spacing: .14em; color: var(--game-muted); }
.game-result-new { margin: 0; font: 700 11px/1 var(--game-mono); letter-spacing: .22em; color: var(--game-red); }
.game-result-new[hidden] { display: none; }
@media (max-width: 420px) {
  .game-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-overlay { padding: 12px; }
  .game-screen { gap: 8px; }
  .game-btn { padding: 12px 16px; }
}

/* ---------- HUD ---------- */
.game-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  background: var(--game-line);
  border: 1px solid var(--game-line);
}
.game-hud-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 10px;
  background: #0a0b11;
  min-width: 0;
}
.game-hud-k { font: 400 10px/1 var(--game-mono); letter-spacing: .18em; color: var(--game-muted); }
.game-hud-v {
  font: 700 18px/1 var(--game-mono);
  color: var(--game-white);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.game-hud-time .game-hud-v.is-low { color: var(--game-red); }
.game-hud-bar {
  display: block;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, .08);
}
.game-hud-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--game-red);
  transition: width .15s var(--game-ease);
}
@media (max-width: 480px) {
  .game-hud { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .game-hud-item { grid-column: span 2; padding: 8px; }
  .game-hud-item:nth-child(4),
  .game-hud-item:nth-child(5) { grid-column: span 3; }
  .game-hud-v { font-size: 15px; }
}

.game-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 10px;
}
.game-bar-hint {
  font: 400 10px/1.6 var(--game-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--game-muted);
}
.game-btn-mute { min-width: 120px; }

/* ---------- reduced motion ---------- */
