:root {
  color-scheme: dark;
  --bg-a: #1e32ff;
  --bg-b: #7c2cff;
  --bg-c: #111a62;
  --ink: #ffffff;
  --soft: rgba(255, 255, 255, .78);
  --muted: rgba(255, 255, 255, .58);
  --glass: rgba(255, 255, 255, .14);
  --glass-strong: rgba(255, 255, 255, .22);
  --line: rgba(255, 255, 255, .26);
  --yellow: #ffe45c;
  --pink: #ff4fd8;
  --cyan: #33f4ff;
  --green: #4dff9a;
  --red: #ff5c7a;
  --shadow: 0 26px 80px rgba(0, 0, 0, .34);
  --radius: 22px;
  font-family: "Segoe UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 228, 92, .34) 0 8%, transparent 22%),
    radial-gradient(circle at 82% 12%, rgba(51, 244, 255, .24) 0 10%, transparent 26%),
    radial-gradient(circle at 78% 86%, rgba(255, 79, 216, .26) 0 11%, transparent 28%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 54%, var(--bg-c));
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  opacity: .42;
  background:
    linear-gradient(120deg, transparent 0 44%, rgba(255, 255, 255, .20) 45% 48%, transparent 49% 100%),
    radial-gradient(circle, rgba(255,255,255,.18) 0 2px, transparent 2.5px);
  background-size: 150px 150px, 34px 34px;
}

body::after {
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.08) 22px 23px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.06) 22px 23px);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .54; transform: none !important; }

.page {
  width: min(1220px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 1000;
  letter-spacing: 0;
  color: #140b46;
  background: linear-gradient(135deg, var(--yellow), #fff 48%, var(--cyan));
  box-shadow: 0 18px 40px rgba(0, 0, 0, .26);
}

.brand h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 54px);
  line-height: .92;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--soft);
  font-weight: 800;
}

.nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.pill,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, .12);
  color: var(--ink);
  backdrop-filter: blur(18px);
  font-weight: 900;
}

.nav a[aria-current="page"] {
  background: #fff;
  color: #2c23a9;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  gap: 16px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hero-card,
.panel,
.auth-card,
.game-card,
.question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.08));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.hero-card {
  padding: clamp(22px, 4vw, 44px);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  top: -80px;
  border-radius: 50%;
  border: 30px solid rgba(255, 228, 92, .28);
}

.hero-card.narrow {
  width: min(720px, calc(100vw - 28px));
  margin: 12vh auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-card h2,
.hero-card h1 {
  margin: 0;
  font-size: clamp(38px, 8vw, 82px);
  line-height: .92;
  letter-spacing: 0;
}

.hero-card .lead {
  margin: 18px 0 0;
  color: var(--soft);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
  max-width: 650px;
}

.panel,
.auth-card,
.game-card,
.question-card {
  padding: 16px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 1000;
  font-size: 18px;
}

.stack { display: grid; gap: 12px; }
.wide-gap { gap: 18px; }

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 14px;
  min-height: 48px;
  padding: 11px 13px;
  color: #fff;
  background: rgba(10, 12, 45, .30);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder { color: rgba(255,255,255,.48); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 228, 92, .18);
}

.mega-button,
.action-button,
.ghost-button {
  border: 0;
  border-radius: 18px;
  min-height: 56px;
  padding: 13px 18px;
  color: #12084c;
  font-weight: 1000;
  background: linear-gradient(135deg, var(--yellow), #fff 48%, var(--cyan));
  box-shadow: 0 18px 40px rgba(0,0,0,.24);
  transition: transform .15s ease, filter .15s ease;
}

.mega-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  font-size: 20px;
}

.action-button:hover,
.mega-button:hover,
.ghost-button:hover { transform: translateY(-2px) scale(1.01); }

.ghost-button {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid var(--line);
}

.danger { background: linear-gradient(135deg, #ff5c7a, #ffb3c1); color: #240313; }
.success { background: linear-gradient(135deg, #4dff9a, #c7ffe0); color: #052814; }

.join-code,
.live-code {
  width: 100%;
  min-height: 82px;
  text-align: center;
  font-size: clamp(34px, 9vw, 72px);
  font-weight: 1000;
  letter-spacing: 8px;
  color: #fff;
}

.live-code {
  display: grid;
  place-items: center;
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,.36);
  background: rgba(0,0,0,.22);
  min-height: 130px;
}

.message {
  min-height: 24px;
  color: var(--yellow);
  font-weight: 900;
}

.muted { color: var(--muted); }
.soft { color: var(--soft); }
.hidden { display: none !important; }

.auth-card {
  display: grid;
  gap: 10px;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auth-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--soft);
}

.game-list {
  display: grid;
  gap: 10px;
}

.game-card {
  text-align: left;
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.game-card:hover,
.game-card.selected {
  transform: translateY(-2px);
  border-color: var(--yellow);
  background: rgba(255,255,255,.24);
}

.game-card h3 {
  margin: 0 0 5px;
  letter-spacing: 0;
}

.game-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.qr-box {
  display: grid;
  place-items: center;
  min-height: 232px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  padding: 12px;
}

.qr-box canvas,
.qr-box img {
  width: 210px;
  height: 210px;
}

.scoreboard,
.feed-list,
.members-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.score-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.18);
}

.rank {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  font-weight: 1000;
}

.rank.first { background: var(--yellow); color: #2c2300; }
.score { font-weight: 1000; font-variant-numeric: tabular-nums; }

.question-stage {
  display: grid;
  gap: 14px;
}

.question-text {
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 26px;
  padding: clamp(20px, 5vw, 44px);
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  font-size: clamp(26px, 5vw, 58px);
  font-weight: 1000;
  line-height: 1.12;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-button {
  min-height: 112px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  padding: 18px;
  font-size: clamp(18px, 2.6vw, 30px);
  font-weight: 1000;
  text-align: left;
  box-shadow: 0 16px 34px rgba(0,0,0,.22);
}

.answer-button:nth-child(1) { background: linear-gradient(135deg, #ff3b6b, #ff7c9c); }
.answer-button:nth-child(2) { background: linear-gradient(135deg, #1eb5ff, #49e6ff); }
.answer-button:nth-child(3) { background: linear-gradient(135deg, #ffb000, #ffe45c); color: #241a00; }
.answer-button:nth-child(4) { background: linear-gradient(135deg, #39d071, #8effbd); color: #052814; }
.answer-button.correct { outline: 5px solid #fff; filter: saturate(1.25); }
.answer-button.wrong { filter: grayscale(.5) brightness(.75); }

.timer-strip {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width .12s linear;
}

.creator-layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.question-card {
  display: grid;
  gap: 10px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segmented button {
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 42px;
  color: #fff;
  background: rgba(255,255,255,.14);
  font-weight: 1000;
}

.segmented button.active {
  color: #211100;
  background: var(--yellow);
}

.splash-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

@media (max-width: 900px) {
  .topbar,
  .grid-2,
  .creator-layout,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .nav { justify-content: flex-start; }
  .answer-grid,
  .choice-grid,
  .grid-3 { grid-template-columns: 1fr; }
  .hero-card h2,
  .hero-card h1 { font-size: clamp(38px, 14vw, 68px); }
}
