:root {
  color-scheme: dark;
  --ink: #f9f7ee;
  --muted: #b7c4bd;
  --bg-a: #18252c;
  --bg-b: #26312b;
  --accent: #ff4f69;
  --gold: #ffd166;
  --cyan: #46d6c4;
  --panel: rgba(11, 18, 22, 0.72);
  --border: rgba(255, 255, 255, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 209, 102, 0.16), transparent 28rem),
    radial-gradient(circle at 86% 18%, rgba(70, 214, 196, 0.18), transparent 24rem),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 60%, #191723);
  color: var(--ink);
}

button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2vw, 24px);
}

#game {
  width: min(96vw, 1280px);
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  background: #17252a;
  image-rendering: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 18, 22, 0.78), rgba(10, 18, 22, 0.2));
}

.overlay[hidden] {
  display: none;
}

.title-lockup {
  width: min(560px, 88vw);
  margin-right: min(40vw, 460px);
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
}

.dedication {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 850;
  line-height: 1;
}

h1 {
  margin: 0;
  max-width: 11ch;
  color: var(--ink);
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  line-height: 0.9;
  letter-spacing: 0;
}

#overlayText {
  margin: 18px 0 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.16rem);
  line-height: 1.55;
}

.character-picker {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
  pointer-events: auto;
}

.character-picker[hidden] {
  display: none;
}

.character-picker legend {
  margin: 0 0 10px;
  padding: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.character-option {
  min-width: 0;
  height: 112px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 76px 20px;
  justify-items: center;
  align-items: center;
  gap: 2px;
  padding: 8px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(4, 10, 13, 0.54);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.character-option img {
  width: 56px;
  height: 76px;
  object-fit: contain;
}

.character-option span {
  min-width: 0;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 800;
}

.character-option:hover,
.character-option:focus-visible {
  border-color: rgba(255, 209, 102, 0.62);
  background: rgba(21, 31, 31, 0.82);
  outline: none;
  transform: translateY(-1px);
}

.character-option.is-selected {
  border-color: var(--gold);
  color: var(--ink);
  background: rgba(255, 209, 102, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.18);
}

.overlay-actions {
  position: absolute;
  left: max(24px, calc((100vw - min(96vw, 1280px)) / 2 + 34px));
  bottom: max(24px, calc((100svh - min(54vw, 720px)) / 2 + 34px));
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.overlay-actions button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  color: #141a1d;
  background: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(255, 209, 102, 0.22);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.overlay-actions button:hover,
.overlay-actions button:focus-visible {
  background: #ffe08d;
  box-shadow: 0 14px 28px rgba(255, 209, 102, 0.3);
  transform: translateY(-1px);
  outline: none;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .game-shell {
    min-height: 100svh;
    padding: 10px;
  }

  #game {
    width: 100%;
  }

  .overlay {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: clamp(22px, 9svh, 80px) 22px 22px;
  }

  .title-lockup {
    margin: 0;
    width: 100%;
  }

  .character-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .character-option {
    height: 96px;
    grid-template-columns: 1fr;
    grid-template-rows: 62px 18px;
    justify-items: center;
    padding: 6px;
  }

  .character-option img {
    width: 48px;
    height: 62px;
  }

  .character-option span {
    overflow-wrap: normal;
    white-space: nowrap;
    font-size: 0.63rem;
  }

  .overlay-actions {
    position: fixed;
    left: 22px;
    right: 22px;
    bottom: 22px;
    width: auto;
    margin-top: 0;
  }

  .overlay-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
