:root {
  --ink: #f6eedf;
  --ink-dim: #b9b3c9;
  --panel: rgba(14, 12, 28, 0.86);
  --panel-edge: rgba(255, 220, 170, 0.28);
  --accent: #ffcf8a;
  --shadow: rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05060f;
  color: var(--ink);
  font-family: ui-sans-serif, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
}
#view {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  cursor: default; touch-action: manipulation;
}
#view.hot { cursor: pointer; }
#boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  font-size: 42px; letter-spacing: 0.2em; color: #f6eedf;
  background: #05060f; transition: opacity 1.2s ease; pointer-events: none; z-index: 5;
}
#boot.gone { opacity: 0; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui canvas { display: block; }

/* title card */
.title {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: opacity 1.6s ease, transform 1.6s ease;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}
.title.gone { opacity: 0; transform: translate(-50%, -12px); }
.title-hint { margin-top: 10px; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* HUD */
.hud {
  position: absolute; left: 18px; bottom: 16px;
  display: flex; flex-direction: column; gap: 6px;
  transition: opacity 0.6s ease;
}
.hud-row { display: flex; align-items: center; gap: 10px; }
.hud-tags { font-size: 13px; color: var(--ink-dim); text-shadow: 0 1px 2px #000; letter-spacing: 0.08em; }
.hud-found { pointer-events: auto; cursor: help; width: max-content; }
.btns {
  position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px;
  pointer-events: auto; transition: opacity 0.6s ease;
}
.btn {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 6px;
  padding: 6px 9px; cursor: pointer; display: grid; place-items: center;
}
.btn:hover { border-color: var(--accent); }
#ui.idle .hud, #ui.idle .btns { opacity: 0.0; }
#ui.cinema .hud, #ui.cinema .btns, #ui.cinema .toasts, #ui.cinema .tip { opacity: 0 !important; }

/* hover label */
.tip {
  position: absolute; left: 0; top: 0; padding: 7px 9px 6px;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 6px;
  opacity: 0; transition: opacity 0.12s ease; white-space: nowrap;
  box-shadow: 0 6px 20px var(--shadow);
}
.tip.on { opacity: 1; }
.tip-sub { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }

/* toasts */
.toasts { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 999px;
  padding: 7px 16px; font-size: 14px; color: var(--accent); letter-spacing: 0.04em;
  animation: toastIn 0.35s cubic-bezier(.2, .9, .3, 1.2) both; box-shadow: 0 6px 20px var(--shadow);
}
.toast.out { animation: toastOut 0.6s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* help */
.help {
  position: absolute; right: 16px; bottom: 64px; width: min(430px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 10px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 7px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; box-shadow: 0 10px 30px var(--shadow);
}
.help.on { opacity: 1; transform: none; pointer-events: auto; }
.help-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
.help-val { font-size: 13px; color: var(--ink-dim); }

/* game card */
.card-wrap {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto;
  background: rgba(4, 4, 12, 0.0); transition: background 0.3s ease;
}
.card-wrap.on { background: rgba(4, 4, 12, 0.55); }
.card {
  position: relative; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(180deg, rgba(24, 20, 44, 0.97), rgba(12, 10, 24, 0.97));
  border: 1px solid var(--panel-edge); border-top: 4px solid var(--game, #ffcf8a); border-radius: 12px;
  padding: 20px 22px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: translateY(14px) scale(0.97); transition: opacity 0.25s ease, transform 0.3s cubic-bezier(.2, .9, .3, 1.1);
}
.card-wrap.on .card { opacity: 1; transform: none; }
.card-head { display: flex; flex-direction: column; gap: 8px; }
.card-kicker { font-size: 13px; color: var(--accent); margin: 8px 0 12px; letter-spacing: 0.1em; }
.card-shot { width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.08); background: #0a0a14; }
.card-tag { font-size: 15px; line-height: 1.45; margin: 14px 0 8px; }
.card-list { margin: 0 0 16px; padding-left: 18px; color: var(--ink-dim); font-size: 13.5px; line-height: 1.6; }
.card-acts { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-play {
  display: inline-grid; place-items: center; padding: 10px 18px; border-radius: 8px;
  background: var(--accent); box-shadow: 0 4px 0 #b8864a; text-decoration: none; transition: transform 0.1s ease;
}
.card-play:hover { transform: translateY(-1px); }
.card-play:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8864a; }
.card-play.soon { background: #8a8698; box-shadow: 0 4px 0 #5a5668; }
.card-hub { color: var(--ink-dim); font-size: 13px; text-decoration: none; }
.card-hub:hover { color: var(--accent); }
.card-x { position: absolute; top: 12px; right: 12px; background: none; border: 0; cursor: pointer; opacity: 0.7; padding: 4px; }
.card-x:hover { opacity: 1; }

@media (max-width: 640px) {
  .title { top: 12%; }
  .hud-tags { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .title, .toast, .card, .help { transition: none; animation: none; }
}

/* recording indicator */
.rec-dot {
  position: absolute; top: 14px; right: 16px; padding: 4px 10px; border-radius: 999px;
  background: rgba(20, 8, 12, 0.8); color: #ff5a5a; font-size: 13px; letter-spacing: 0.1em;
  opacity: 0; transition: opacity 0.2s ease;
}
.rec-dot.on { opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
#ui.cinema .rec-dot.on { opacity: 0.35; }
