:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: rgba(13, 18, 27, 0.82);
  --panel-strong: rgba(20, 29, 42, 0.94);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f7fbff;
  --muted: #a9b5c5;
  --accent: #68e1fd;
  --accent-2: #f7d774;
  --correct: #3ff29a;
  --wrong: #ff6b7a;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Yu Gothic", "Meiryo", sans-serif;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(9, 14, 21, 0.72), rgba(8, 10, 15, 0.92)),
    url("./assets/digital-nature.svg") center / cover fixed,
    var(--bg);
}

button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.quiz-stage,
.host-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.quiz-stage {
  min-height: 680px;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 4vw, 44px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.scoreboard span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.scoreboard b {
  color: var(--text);
}

.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px 0 24px;
}

.question-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.question-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(104, 225, 253, 0.4);
  color: #d9f8ff;
  background: rgba(104, 225, 253, 0.09);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 760;
}

.question-text {
  max-width: 900px;
  margin-bottom: 28px;
  font-size: clamp(26px, 3.3vw, 46px);
  font-weight: 840;
  line-height: 1.35;
}

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

.choice {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice:hover:not(:disabled),
.choice.selected {
  transform: translateY(-2px);
  border-color: rgba(104, 225, 253, 0.72);
  background: rgba(104, 225, 253, 0.14);
}

.choice-key {
  width: 40px;
  aspect-ratio: 1;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-2);
  font-weight: 900;
}

.choice-text {
  overflow-wrap: anywhere;
}

.choice.correct {
  border-color: var(--correct);
  background: rgba(63, 242, 154, 0.18);
}

.choice.wrong {
  border-color: var(--wrong);
  background: rgba(255, 107, 122, 0.12);
}

.choice.flash {
  animation: flashCorrect 760ms ease-in-out 4;
}

@keyframes flashCorrect {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(63, 242, 154, 0);
  }
  50% {
    box-shadow: 0 0 34px rgba(63, 242, 154, 0.88);
  }
}

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

.primary {
  min-width: 150px;
  color: #061015;
  background: var(--accent);
}

.secondary,
.ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.secondary {
  min-width: 150px;
}

.explanation {
  margin-top: 22px;
  padding: 18px 20px;
  border-left: 4px solid var(--accent-2);
  background: var(--panel-strong);
  line-height: 1.7;
  color: #eef5fb;
}

.host-panel {
  padding: 22px;
}

.host-panel h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.host-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.mini-grid {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.mini-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.mini-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mini-grid strong {
  font-size: 15px;
}

.ghost {
  width: 100%;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .quiz-stage {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .topbar {
    display: block;
  }

  .scoreboard {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .question-text {
    font-size: 25px;
  }
}
