﻿@font-face {
  font-family: "ITC Benguiat";
  src:
    local("ITC Benguiat Bold"),
    local("ITC Benguiat"),
    url("fonts/itc-benguiat-bold.woff2") format("woff2"),
    url("fonts/itc-benguiat-bold.woff") format("woff");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  --ink: #ffe6ea;
  --muted: #dca8b0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Share Tech Mono", Consolas, monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(209, 59, 86, 0.24), transparent 30%),
    radial-gradient(circle at 84% 7%, rgba(255, 127, 80, 0.14), transparent 25%),
    linear-gradient(165deg, #070204 0%, #12070b 48%, #080306 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 220ms ease;
  z-index: 0;
}

body.playing-focus::before {
  background: rgba(0, 0, 0, 0.52);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  position: relative;
  z-index: 1;
}

.panel {
  width: min(1020px, 100%);
  background: linear-gradient(155deg, rgba(25, 10, 14, 0.95), rgba(18, 8, 12, 0.92));
  border: 1px solid rgba(209, 59, 86, 0.36);
  border-radius: 22px;
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.38);
  padding: 16px;
  position: relative;
  z-index: 1;
}

.panel > * {
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease;
}

.panel.game-focus .hero,
.panel.game-focus .actions,
.panel.game-focus .music-wrap,
.panel.game-focus .mode-toolbar,
.panel.game-focus .hud,
.panel.game-focus .hints,
.panel.game-focus .config-panel {
  opacity: 0.32;
  filter: saturate(0.62);
}

.panel.game-focus .canvas-wrap {
  opacity: 1;
  filter: none;
  transform: scale(1.01);
}

.hero {
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-family: "ITC Benguiat", "Cinzel Decorative", serif;
  font-size: clamp(1.5rem, 3.2vw, 2.3rem);
  color: #ff8fa2;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px rgba(255, 75, 95, 0.5);
}

.hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.dev-only {
  display: none !important;
}

body.dev-on .dev-only {
  display: block !important;
}

body.dev-on .hud {
  display: flex !important;
}

body.dev-on .hints {
  display: flex !important;
}

.mode-toolbar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mode-toolbar label {
  font-weight: 700;
  color: #ffd9df;
}

.mode-toolbar select {
  border-radius: 10px;
  border: 1px solid rgba(209, 59, 86, 0.35);
  background: rgba(20, 7, 12, 0.94);
  color: #ffeaf0;
  padding: 7px 9px;
  font-family: "Share Tech Mono", Consolas, monospace;
}

.music-dev-control {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.music-dev-control label {
  font-weight: 700;
  color: #ffd9df;
}

.music-dev-control select {
  border-radius: 10px;
  border: 1px solid rgba(209, 59, 86, 0.35);
  background: rgba(20, 7, 12, 0.94);
  color: #ffeaf0;
  padding: 7px 9px;
  font-family: "Share Tech Mono", Consolas, monospace;
}

.mode-rules {
  margin: 0;
  color: #ffb0bd;
  font-size: 0.86rem;
}

.hud {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hud p {
  margin: 0;
  background: rgba(35, 10, 16, 0.72);
  border: 1px solid rgba(209, 59, 86, 0.3);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.canvas-wrap {
  margin-top: 14px;
  display: grid;
  place-items: center;
  width: 100%;
}

#game-canvas {
  width: 100%;
  max-width: 760px;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 18px;
  border: 2px solid rgba(209, 59, 86, 0.45);
  background: linear-gradient(180deg, #15070d 0%, #10050a 100%);
  touch-action: none;
  user-select: none;
  box-shadow: 0 0 0 1px rgba(255, 75, 95, 0.12), 0 0 28px rgba(209, 59, 86, 0.28);
}

.panel.game-focus #game-canvas {
  box-shadow: 0 0 0 1px rgba(255, 120, 135, 0.16), 0 0 42px rgba(209, 59, 86, 0.62);
}

.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.music-wrap {
  margin-top: 22px;
  display: grid;
  gap: 8px;
  width: 100%;
  justify-items: center;
}

.music-label {
  margin: 0;
  color: #ffd0d8;
  font-size: 0.9rem;
}

.music-frame {
  width: min(360px, 100%);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(209, 59, 86, 0.44);
  background:
    linear-gradient(145deg, rgba(42, 12, 18, 0.95), rgba(24, 8, 12, 0.96)),
    radial-gradient(circle at 18% 12%, rgba(209, 59, 86, 0.28), transparent 45%);
  box-shadow: 0 0 24px rgba(209, 59, 86, 0.18);
  position: relative;
  overflow: hidden;
}

.music-embed {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
}

body.music-youtube .music-embed {
  height: 220px;
}

button,
.link-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: "Share Tech Mono", Consolas, monospace;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#start-btn,
#restart-btn,
#overlay-restart-btn {
  background: linear-gradient(145deg, #c13a55, #8f263d);
  color: #fff0f3;
}

.dev-btn {
  background: linear-gradient(145deg, #9f365d, #6f2447);
  color: #ffeef3;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:hover,
.link-btn:hover {
  filter: brightness(1.06);
}

.hints {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hints p {
  margin: 0;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 0.86rem;
  color: #ffd5dc;
  background: rgba(45, 12, 20, 0.58);
  border: 1px solid rgba(209, 59, 86, 0.34);
}

.config-panel {
  margin-top: 14px;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(209, 59, 86, 0.3);
  background: rgba(22, 8, 14, 0.78);
}

.config-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #ffadb9;
}

.config-panel h3 {
  margin: 12px 0 6px;
  font-size: 0.95rem;
  color: #ffd9df;
}

.meta-line {
  margin: 6px 0;
  color: #ffb0bd;
  font-size: 0.84rem;
}

.preview-box {
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(209, 59, 86, 0.35);
  background: rgba(20, 7, 12, 0.94);
  color: #ffeaf0;
  padding: 8px 10px;
  font-family: "Share Tech Mono", Consolas, monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 40;
  background: rgba(18, 6, 10, 0.78);
}

.overlay.win-toast {
  inset: auto 14px 14px auto;
  padding: 0;
  background: transparent;
  z-index: 45;
  pointer-events: none;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(620px, 100%);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(209, 59, 86, 0.42);
  background: linear-gradient(155deg, rgba(31, 10, 17, 0.97), rgba(20, 7, 12, 0.95));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
  position: relative;
}

.overlay.win-toast .overlay-card {
  width: min(420px, calc(100vw - 28px));
  pointer-events: auto;
  border-color: rgba(209, 59, 86, 0.58);
}

.overlay-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(209, 59, 86, 0.45);
  background: rgba(30, 9, 15, 0.9);
  color: #ffe5ea;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
}

.overlay-card h2 {
  margin: 0;
  color: #ff9aab;
  font-family: "ITC Benguiat", "Cinzel Decorative", serif;
}

.overlay-card p {
  margin: 10px 0 16px;
  color: #ffeef2;
  white-space: pre-wrap;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.link-btn {
  background: linear-gradient(145deg, #e0764f, #b2462c);
  color: #fff2ea;
}

.hidden {
  display: none !important;
}

@media (min-width: 701px) {
  .music-wrap {
    position: fixed;
    top: 14px;
    right: 14px;
    width: min(360px, calc(100vw - 28px));
    margin-top: 0;
    z-index: 30;
    justify-items: stretch;
  }

  .music-label {
    text-align: center;
  }

  .music-frame {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0;
    align-items: start;
  }

  .music-wrap {
    position: static;
    margin-top: 28px;
    width: 100%;
    z-index: auto;
    justify-items: center;
  }

  .panel {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    padding: 10px;
    border-left: 0;
    border-right: 0;
  }

  body.dev-on .hud {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud p {
    border-radius: 12px;
  }

  #game-canvas {
    width: 100%;
    max-width: none;
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .actions button {
    min-width: 150px;
  }

  .overlay.win-toast {
    inset: auto 10px 10px 10px;
    justify-items: center;
  }

  .overlay.win-toast .overlay-card {
    width: min(560px, 100%);
  }

  .hud p,
  .hints p {
    font-size: 0.82rem;
  }
}

@media (max-width: 420px) {
  body.dev-on .hud {
    grid-template-columns: 1fr;
  }

  .music-embed {
    height: 152px;
  }

  body.music-youtube .music-embed {
    height: 200px;
  }
}

