:root {
  color-scheme: dark;
  --bg-a: #030414;
  --bg-b: #061c54;
  --bg-c: #071037;
  --blue: #091d62;
  --blue-light: #174aa8;
  --gold: #f5bd38;
  --gold-soft: #ffe39a;
  --orange: #ff8c1a;
  --white: #fff9e8;
  --muted: #b8c6ee;
  --green: #42d37b;
  --red: #e65252;
  --line: rgba(255, 222, 123, 0.68);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at center 22%, rgba(42, 103, 255, 0.42), transparent 21rem),
    radial-gradient(circle at 15% 80%, rgba(245, 189, 56, 0.16), transparent 17rem),
    linear-gradient(145deg, var(--bg-a), var(--bg-b) 52%, var(--bg-c));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, 0.07) 49% 51%, transparent 52%),
    linear-gradient(0deg, transparent 0 48%, rgba(255, 255, 255, 0.05) 49% 51%, transparent 52%);
  background-size: 130px 130px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

button {
  font: inherit;
}

.start-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at center, rgba(31, 91, 212, 0.62), transparent 20rem),
    linear-gradient(145deg, #020412, #061b55 54%, #030414);
}

.start-screen[hidden],
.index-screen[hidden] {
  display: none;
}

.start-orbit {
  position: absolute;
  width: min(76vw, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 227, 154, 0.42);
  box-shadow:
    inset 0 0 44px rgba(245, 189, 56, 0.18),
    0 0 64px rgba(23, 74, 168, 0.42);
}

.start-orbit::before,
.start-orbit::after {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 249, 232, 0.22);
}

.start-orbit::after {
  inset: 23%;
  transform: rotate(45deg);
}

.start-content {
  position: relative;
  width: min(780px, 100%);
  padding: 34px;
  text-align: center;
  border: 2px solid var(--line);
  background: rgba(2, 7, 34, 0.88);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58), inset 0 0 48px rgba(23, 74, 168, 0.42);
}

.start-content h1 {
  margin-bottom: 18px;
  color: var(--white);
}

.group-info {
  display: grid;
  gap: 8px;
  margin: 0 auto 22px;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.4;
}

.group-info p {
  margin-bottom: 0;
}

.group-info strong {
  color: var(--gold-soft);
}

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

.index-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.index-card {
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 18px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 21, 74, 0.98), rgba(2, 6, 28, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 10px;
}

.index-head h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.4rem);
}

.index-note {
  color: var(--muted);
  line-height: 1.4;
}

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

.index-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 227, 154, 0.42);
  color: var(--white);
  background: linear-gradient(180deg, #09206a, #030d39);
  text-align: left;
  cursor: pointer;
}

.index-item:hover,
.index-item:focus-visible {
  border-color: var(--gold-soft);
  filter: brightness(1.16);
  outline: none;
}

.index-item span {
  color: var(--gold-soft);
  font-weight: 900;
}

.index-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.index-item small {
  color: var(--muted);
}

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

.show-stage {
  min-height: 720px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 24px;
  border: 2px solid var(--line);
  background:
    radial-gradient(circle at center 23%, rgba(20, 76, 195, 0.75), transparent 18rem),
    linear-gradient(180deg, rgba(8, 20, 74, 0.93), rgba(1, 5, 29, 0.96));
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.55), inset 0 0 70px rgba(21, 77, 183, 0.28);
}

.show-header {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.logo-ring {
  width: 142px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    repeating-conic-gradient(from 15deg, #f7c84a 0 8deg, #073891 8deg 16deg),
    radial-gradient(circle, #082c85, #020416 72%);
  border: 3px solid var(--gold-soft);
  box-shadow: 0 0 34px rgba(245, 189, 56, 0.3);
}

.logo-core {
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  border: 2px solid var(--gold-soft);
  background: radial-gradient(circle, #123f9e, #030721 74%);
  text-align: center;
}

.logo-core span {
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 1;
}

.logo-core small {
  color: var(--gold-soft);
  font-weight: 700;
}

.kicker {
  margin: 0 0 6px;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.94;
  text-shadow: 0 4px 0 #02051f, 0 0 26px rgba(255, 227, 154, 0.28);
}

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

.status-row > div,
.ladder-panel,
.study-card {
  border: 1px solid var(--line);
  background: rgba(2, 7, 34, 0.84);
}

.status-row > div {
  min-height: 62px;
  display: grid;
  align-content: center;
  padding: 10px 14px;
  box-shadow: inset 0 0 22px rgba(23, 74, 168, 0.4);
}

.status-row span,
.topic,
.note {
  color: var(--muted);
}

.status-row span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-row strong {
  color: var(--gold-soft);
  font-size: 1.45rem;
}

.question-set {
  align-self: end;
}

.question-frame {
  position: relative;
  min-height: 156px;
  display: grid;
  align-content: center;
  padding: 22px 30px;
  margin-bottom: 16px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #071b5b, #03103f);
  box-shadow: 0 0 0 4px rgba(3, 5, 19, 0.8), inset 0 0 28px rgba(24, 81, 188, 0.52);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
}

.topic {
  margin-bottom: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

#question {
  min-height: 76px;
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  line-height: 1.22;
  text-align: center;
}

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

.answer {
  position: relative;
  width: 100%;
  min-height: 78px;
  padding: 14px 22px 14px 54px;
  border: 2px solid var(--line);
  color: var(--white);
  background: linear-gradient(180deg, #09206a, #030d39);
  text-align: left;
  cursor: pointer;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
  box-shadow: inset 0 0 22px rgba(23, 74, 168, 0.42);
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.answer::before {
  content: attr(data-letter);
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-soft);
  font-weight: 900;
}

.answer:hover:not(:disabled),
.answer:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.16);
  outline: none;
}

.answer.correct {
  background: linear-gradient(180deg, #159452, #065c32);
  border-color: #a8ffd0;
}

.answer.wrong {
  background: linear-gradient(180deg, #792022, #32070d);
  border-color: #ffb1b1;
  color: #d6c5c5;
  text-decoration: line-through;
  cursor: not-allowed;
}

.answer:disabled:not(.wrong):not(.correct) {
  opacity: 0.5;
  cursor: default;
}

.feedback {
  margin-top: 16px;
  padding: 15px 18px;
  border: 2px solid var(--gold);
  background: rgba(4, 14, 54, 0.94);
  line-height: 1.5;
  box-shadow: inset 0 0 22px rgba(245, 189, 56, 0.12);
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 227, 154, 0.32);
}

.detail-grid p {
  margin-bottom: 0;
}

.detail-grid strong {
  color: var(--gold-soft);
}

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

.control {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--white);
  background: #07164d;
  cursor: pointer;
  font-weight: 700;
}

.control-main {
  color: #1b1200;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
}

.control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ladder-panel {
  min-height: 720px;
  padding: 16px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.45), inset 0 0 34px rgba(23, 74, 168, 0.34);
}

.ladder-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.84rem;
}

.money-ladder {
  display: grid;
  gap: 5px;
}

.ladder-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 18, 67, 0.76);
  font-size: 0.86rem;
}

.ladder-step strong {
  text-align: right;
}

.ladder-step.current {
  color: #1b1200;
  background: linear-gradient(90deg, var(--orange), var(--gold-soft));
  border-color: var(--gold-soft);
}

.ladder-step.done {
  color: var(--green);
  border-color: rgba(66, 211, 123, 0.6);
}

.study-card {
  margin-top: 14px;
  padding: 14px;
}

.study-card h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
  color: var(--gold-soft);
}

.study-card p {
  margin-bottom: 0;
  line-height: 1.44;
}

.note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.86rem;
}

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

  .show-stage,
  .ladder-panel {
    min-height: auto;
  }

  .money-ladder {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .millionaire-shell {
    width: min(100% - 14px, 1240px);
    gap: 12px;
    padding: 8px 0 16px;
  }

  .show-stage,
  .ladder-panel {
    padding: 12px;
    border-width: 1px;
  }

  .show-header {
    grid-template-columns: 82px 1fr;
    gap: 10px;
  }

  .logo-ring {
    width: 78px;
  }

  .logo-core span {
    font-size: 1.55rem;
  }

  h1 {
    font-size: 1.75rem;
    line-height: 1;
  }

  .kicker {
    font-size: 0.64rem;
    line-height: 1.25;
  }

  .status-row,
  .answers {
    grid-template-columns: 1fr;
  }

  .status-row {
    gap: 7px;
  }

  .status-row > div {
    min-height: 48px;
    padding: 8px 12px;
  }

  .status-row strong {
    font-size: 1.15rem;
  }

  .question-frame,
  .answer {
    clip-path: none;
  }

  .question-frame {
    padding: 18px;
    min-height: auto;
    margin-bottom: 12px;
  }

  #question {
    min-height: auto;
    font-size: 1.12rem;
    text-align: left;
  }

  .topic {
    font-size: 0.7rem;
    line-height: 1.25;
  }

  .answers {
    gap: 9px;
  }

  .answer {
    min-height: 64px;
    padding-left: 48px;
    font-size: 0.95rem;
    line-height: 1.25;
  }

  .answer::before {
    left: 18px;
  }

  .feedback {
    margin-top: 12px;
    padding: 12px;
    font-size: 0.95rem;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .control {
    width: 100%;
    padding: 0 10px;
  }

  .ladder-panel {
    min-height: auto;
  }

  .ladder-title {
    margin-bottom: 8px;
  }

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

  .ladder-step {
    grid-template-columns: 18px 1fr;
    gap: 4px;
    min-height: 28px;
    padding: 4px 5px;
    font-size: 0.72rem;
  }

  .study-card {
    margin-top: 10px;
    padding: 12px;
  }

  .study-card h2 {
    font-size: 1rem;
  }

  .study-card p {
    font-size: 0.92rem;
  }

  .start-content {
    padding: 22px 14px;
  }

  .start-content h1 {
    font-size: 2.15rem;
  }

  .start-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .index-card {
    padding: 12px;
  }

  .index-head {
    display: grid;
  }

  .index-list {
    grid-template-columns: 1fr;
  }

  .index-item {
    grid-template-columns: 28px 1fr auto;
  }
}

@media (max-width: 390px) {
  .show-header {
    grid-template-columns: 64px 1fr;
  }

  .logo-ring {
    width: 62px;
  }

  .logo-core span {
    font-size: 1.25rem;
  }

  h1 {
    font-size: 1.45rem;
  }

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

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