:root {
  --ink: #171a3f;
  --muted: #58607a;
  --line: #dce4f0;
  --surface: #ffffff;
  --page: #f6f8fd;
  --brand-blue: #28257f;
  --brand-blue-dark: #17145e;
  --brand-lime: #d7ee27;
  --brand-lime-dark: #9bc21f;
  --gold: #f5b429;
  --green: #13a15d;
  --blue: #28257f;
  --shadow: 0 18px 50px rgba(23, 20, 94, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(215, 238, 39, 0.18) 25%, transparent 25%) 0 0 / 28px 28px,
    radial-gradient(circle at 12% 16%, rgba(215, 238, 39, 0.34), transparent 28rem),
    radial-gradient(circle at 86% 18%, rgba(40, 37, 127, 0.16), transparent 24rem),
    linear-gradient(135deg, #ffffff 0%, var(--page) 62%, #edf2fb 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.quiz-panel,
.ranking-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.quiz-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  padding: 28px;
}

.topbar,
.ranking-header,
.progress-row,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-logo {
  display: block;
  width: 158px;
  height: auto;
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--brand-blue);
  box-shadow: 0 10px 24px rgba(23, 20, 94, 0.16);
}

.hub-shell {
  width: min(1060px, calc(100vw - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
}

.hub-hero {
  display: grid;
  gap: 22px;
  min-height: 44vh;
  align-content: center;
}

.hub-hero p {
  max-width: 720px;
  font-size: 1.2rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.hub-card {
  display: grid;
  gap: 10px;
  min-height: 220px;
  align-content: end;
  padding: 22px;
  border-radius: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 22px 22px,
    var(--brand-blue);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.hub-card.accent {
  color: var(--brand-blue-dark);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(135deg, var(--brand-lime), #bce225);
}

.hub-card.compact {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.hub-card span {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hub-card strong {
  font-size: clamp(1.35rem, 2.4vw, 2.1rem);
  line-height: 1;
}

.hub-card small {
  color: inherit;
  opacity: 0.78;
  font-size: 1rem;
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-lime-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-blue);
  font-weight: 900;
}

.hero-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 32px 0;
}

.phrase-card {
  min-height: 112px;
  display: flex;
  align-items: end;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 22px 22px,
    var(--brand-blue);
  color: #fff;
  font-size: clamp(1.25rem, 2.5vw, 2.2rem);
  font-weight: 900;
  line-height: 1;
}

.phrase-card.accent {
  color: var(--brand-blue-dark);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(135deg, var(--brand-lime), #bce225);
}

.intro-screen,
.question-screen,
.lead-screen,
.saved-screen {
  margin-top: auto;
  max-width: 760px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: 18px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--brand-blue);
  background: rgba(215, 238, 39, 0.34);
  font-weight: 800;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  font-weight: 850;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 999px;
  color: var(--brand-blue-dark);
  background: var(--brand-lime);
  font-weight: 850;
  text-decoration: none;
}

.audio-button {
  min-height: 50px;
  margin: 8px 0 6px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--brand-blue);
  font-weight: 850;
}

.timer-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--brand-blue);
  background: rgba(215, 238, 39, 0.34);
  font-weight: 850;
}

.result-breakdown {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.result-breakdown span {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
}

.primary-button {
  padding: 0 24px;
  color: var(--brand-blue-dark);
  background: var(--brand-lime);
  box-shadow: 0 10px 24px rgba(155, 194, 31, 0.3);
}

.secondary-button {
  padding: 0 22px;
  color: var(--ink);
  background: #e8edf4;
}

.text-button {
  min-height: 40px;
  padding: 0 12px;
  color: var(--brand-blue);
  background: transparent;
}

.progress-row {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 10px;
  margin-bottom: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.progress-fill {
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-lime));
  transition: width 220ms ease;
}

.answers {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.answer-button {
  min-height: 72px;
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
}

.answer-button.correct {
  border-color: var(--green);
  background: #eaf8f2;
}

.answer-button.wrong {
  border-color: var(--gold);
  background: #fff8df;
}

.feedback {
  margin-top: 18px;
  padding: 16px;
  border-left: 5px solid var(--blue);
  border-radius: 14px;
  background: #edf3ff;
  color: var(--ink);
  font-weight: 700;
}

.score-ring {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  width: 126px;
  height: 126px;
  margin-bottom: 18px;
  border: 10px solid rgba(215, 238, 39, 0.42);
  border-radius: 50%;
  color: var(--brand-blue);
  background: #fff;
  font-weight: 950;
}

.score-ring span {
  font-size: 3.6rem;
  line-height: 1;
}

.score-ring small {
  color: var(--muted);
  font-size: 1rem;
}

.privacy-note {
  max-width: 520px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.thanks-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(135deg, var(--brand-blue-dark), var(--brand-blue));
  box-shadow: var(--shadow);
}

.level-result {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border: 8px solid rgba(215, 238, 39, 0.55);
  border-radius: 50%;
  background: #fff;
  color: var(--brand-blue);
  text-align: center;
}

.level-result span {
  font-size: 3.2rem;
  font-weight: 950;
  line-height: 1;
}

.level-result small {
  color: var(--brand-blue-dark);
  font-weight: 900;
}

.thanks-copy .eyebrow {
  color: var(--brand-lime);
}

.thanks-copy h2,
.thanks-copy p {
  color: #fff;
}

.level-insight,
.invite-box {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 16px;
  background: #fff;
}

.level-insight h3,
.invite-box h3 {
  margin: 0 0 8px;
  color: var(--brand-blue);
  font-size: 1.2rem;
}

.level-insight p,
.invite-box p {
  margin: 0;
}

.invite-box {
  border-color: rgba(215, 238, 39, 0.8);
  background: linear-gradient(135deg, rgba(215, 238, 39, 0.24), #fff 48%);
}

.lead-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
}

select {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 750;
}

input:focus {
  border-color: var(--brand-blue);
  outline: 3px solid rgba(40, 37, 127, 0.16);
}

.ranking-panel {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  padding: 22px;
  overflow: auto;
}

.ranking-header h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

.winner-card {
  display: grid;
  gap: 6px;
  margin: 22px 0;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(135deg, var(--brand-blue-dark), var(--brand-blue));
}

.winner-card strong {
  font-size: 1.55rem;
  line-height: 1.05;
}

.winner-card small,
.winner-kicker {
  color: rgba(255, 255, 255, 0.76);
}

.winner-kicker {
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.ranking-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.rank-position {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-blue);
  font-weight: 900;
}

.rank-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.rank-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.rank-score {
  font-size: 1.25rem;
  font-weight: 950;
}

.hidden {
  display: none !important;
}

.admin-shell {
  width: min(1180px, calc(100vw - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--brand-blue);
  background: #eaf0f7;
  font-weight: 850;
  text-decoration: none;
}

.admin-actions,
.admin-summary,
.admin-table-wrap {
  margin-bottom: 18px;
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(23, 20, 94, 0.1);
}

.admin-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, 0.8fr) auto auto auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
}

.danger-button {
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #b42318;
  font-weight: 850;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
}

.admin-summary div {
  display: grid;
  gap: 4px;
  padding: 18px;
  background: #fff;
}

.admin-summary span {
  color: var(--brand-blue);
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 950;
  line-height: 1;
}

.admin-summary small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--brand-blue);
  background: rgba(215, 238, 39, 0.2);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-table td {
  color: var(--ink);
  font-weight: 720;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100vw - 24px));
    padding: 12px 0;
  }

  .quiz-panel {
    min-height: calc(100vh - 24px);
    padding: 20px;
  }

  .ranking-panel {
    position: fixed;
    inset: 12px;
    z-index: 10;
    height: auto;
    transform: translateY(calc(100% + 24px));
    transition: transform 220ms ease;
  }

  .ranking-panel.open {
    transform: translateY(0);
  }

  .hero-strip {
    grid-template-columns: 1fr;
    margin: 24px 0;
  }

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

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-logo {
    width: 136px;
  }

  .admin-shell {
    width: min(760px, calc(100vw - 24px));
    padding: 12px 0 28px;
  }

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

  .admin-topbar {
    display: grid;
  }

  .admin-actions {
    align-items: stretch;
  }

  .admin-summary {
    grid-template-columns: 1fr;
  }

  .thanks-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-lockup {
    display: grid;
    gap: 14px;
  }

  .phrase-card {
    min-height: 92px;
  }

  .action-row {
    display: grid;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .level-result {
    width: 118px;
    height: 118px;
  }

  .level-result span {
    font-size: 2.7rem;
  }
}
