:root {
  --font-body: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --ink: #1c2731;
  --ink-soft: #495766;
  --paper: #f4ead0;
  --paper-strong: #f9f2e1;
  --line: rgba(31, 39, 49, 0.12);
  --gold: #b88a3b;
  --gold-deep: #7b5721;
  --wine: #6f2f37;
  --forest: #405a49;
  --danger: #8c342d;
  --shadow: 0 28px 80px rgba(19, 30, 41, 0.18);
  --radius: 30px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 218, 145, 0.28), transparent 24%),
    radial-gradient(circle at 84% 0%, rgba(111, 47, 55, 0.16), transparent 20%),
    linear-gradient(180deg, #d6c29d 0%, #e7dbc0 30%, #ece3cb 100%);
}

a,
a:visited {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  width: min(1220px, calc(100% - 28px));
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    0
    max(42px, env(safe-area-inset-bottom))
    0;
  overflow: hidden;
}

.page-glow {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.2;
  pointer-events: none;
}

.page-glow-left {
  top: 120px;
  left: -140px;
  background: rgba(184, 138, 59, 0.58);
}

.page-glow-right {
  top: 430px;
  right: -170px;
  background: rgba(111, 47, 55, 0.38);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 34px;
  margin-bottom: 22px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 249, 236, 0.88), rgba(244, 232, 205, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(184, 138, 59, 0.18), transparent 18%),
    linear-gradient(90deg, transparent 0%, rgba(111, 47, 55, 0.05) 54%, transparent 100%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

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

.eyebrow,
.section-mark {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--gold-deep);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 0.96;
}

h1 {
  margin-top: 14px;
  font-size: clamp(3rem, 7vw, 5.4rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 2.7rem);
}

h3 {
  font-size: 1.56rem;
}

.hero-text,
.muted,
.question-text,
.feedback-text,
.leaderboard-list,
.small {
  line-height: 1.6;
}

.hero-text {
  max-width: 650px;
  margin-top: 18px;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(255, 251, 242, 0.8);
  border: 1px solid rgba(123, 87, 33, 0.14);
  box-shadow: 0 14px 26px rgba(29, 39, 52, 0.08);
}

.hero-chip-accent {
  background: linear-gradient(135deg, rgba(111, 47, 55, 0.12), rgba(184, 138, 59, 0.14));
}

.hero-chip-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--wine);
}

.hero-chip-label {
  max-width: 130px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.25;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

.platform-pill {
  color: var(--gold-deep);
  background: rgba(184, 138, 59, 0.14);
  min-width: 86px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px 12px 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 249, 237, 0.96), rgba(241, 228, 198, 0.96)),
    rgba(28, 42, 55, 0.08);
  border: 1px solid rgba(123, 87, 33, 0.18);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(32, 43, 57, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ghost-link::after {
  content: "→";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8e6528, #6f2f37);
  color: #fff8eb;
  font-size: 1rem;
  line-height: 1;
}

.ghost-link:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 47, 55, 0.26);
  box-shadow: 0 22px 42px rgba(32, 43, 57, 0.16);
}

.rules-page {
  display: grid;
  place-items: start center;
  padding-top: 12px;
}

.rules-page-card {
  width: min(920px, 100%);
}

.rules-page-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.rules-page-title {
  margin-top: 10px;
}

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

.rule-card {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(251, 245, 229, 0.96), rgba(244, 234, 208, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: 0 18px 44px rgba(28, 40, 53, 0.12);
}

.rule-card h2 {
  font-size: 1.7rem;
  margin-bottom: 10px;
}

.rule-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.rule-number {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--gold-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(320px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.play-column,
.side-column {
  display: grid;
  gap: 20px;
}

.card {
  position: relative;
  padding: 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(250, 244, 226, 0.98), rgba(243, 232, 203, 0.97)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  animation: rise-in 0.6s ease both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(123, 87, 33, 0.12);
  pointer-events: none;
}

.sync-card {
  min-height: 220px;
  display: grid;
  gap: 14px;
  align-content: center;
  justify-items: start;
}

.question-head,
.leaderboard-head,
.action-row,
.profile-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.profile-head {
  justify-content: flex-start;
  margin-bottom: 8px;
}

.avatar-shell {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 24px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 14px 28px rgba(24, 39, 53, 0.14);
  background:
    linear-gradient(135deg, rgba(184, 138, 59, 0.3), rgba(111, 47, 55, 0.22)),
    rgba(255, 252, 244, 0.96);
}

.avatar-image,
.avatar-fallback {
  width: 100%;
  height: 100%;
}

.avatar-image {
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--wine);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 18px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(64, 90, 73, 0.12);
  color: var(--forest);
  font-weight: 700;
  font-size: 0.92rem;
}

.question-text {
  margin: 0 0 18px;
  font-size: clamp(1.24rem, 3vw, 1.62rem);
  font-weight: 800;
}

.answers,
.profile-grid {
  display: grid;
  gap: 14px;
}

.answers {
  margin-top: 16px;
}

.profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0 10px;
}

.answer-button,
.primary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.answer-button:hover:not(:disabled),
.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.answer-button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.56;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.primary-button,
.ghost-button {
  padding: 14px 18px;
  border-radius: 16px;
  font-weight: 800;
}

.primary-button {
  color: #fff8eb;
  background: linear-gradient(135deg, #9e7230, #71461d);
  box-shadow: 0 16px 36px rgba(113, 70, 29, 0.28);
}

.ghost-button {
  background: rgba(28, 42, 55, 0.08);
  color: var(--ink);
}

.answer-button {
  padding: 16px 18px;
  text-align: left;
  border-radius: 20px;
  background: rgba(255, 252, 244, 0.92);
  border: 1px solid rgba(50, 60, 74, 0.14);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(33, 45, 58, 0.08);
}

.answer-button::before {
  content: attr(data-letter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 14px;
  border-radius: 999px;
  background: rgba(184, 138, 59, 0.14);
  color: var(--gold-deep);
  font-weight: 800;
}

.answer-button.selected {
  border-color: rgba(184, 138, 59, 0.72);
  background: rgba(255, 242, 212, 0.96);
}

.answer-button.correct {
  border-color: rgba(64, 90, 73, 0.68);
  background: rgba(226, 244, 228, 0.96);
}

.answer-button.wrong {
  border-color: rgba(140, 52, 45, 0.58);
  background: rgba(251, 230, 226, 0.96);
}

.feedback-card,
.empty-state {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.84);
}

.feedback-state {
  margin-bottom: 8px;
  font-weight: 800;
}

.feedback-state.success {
  color: var(--forest);
}

.feedback-state.error {
  color: var(--danger);
}

.stat-box {
  padding: 16px;
  border-radius: 20px;
  background: rgba(28, 42, 55, 0.06);
  border: 1px solid rgba(28, 42, 55, 0.08);
}

.stat-box span {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.stat-box strong {
  font-size: 1.96rem;
  font-family: var(--font-display);
}

.leaderboard-list {
  list-style: none;
  padding-left: 0;
  margin: 18px 0 10px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(50, 60, 74, 0.1);
}

.leaderboard-item:last-child {
  border-bottom: 0;
}

.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(184, 138, 59, 0.14);
  color: var(--gold-deep);
  font-weight: 800;
}

.leaderboard-item.current-player .leaderboard-rank {
  background: rgba(111, 47, 55, 0.12);
  color: var(--wine);
}

.leaderboard-name {
  font-weight: 700;
}

.leaderboard-score {
  color: var(--forest);
  font-weight: 800;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 0.92rem;
}

.is-hidden {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .profile-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
  }

  .hero,
  .card {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .hero-actions,
  .rules-page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .question-head,
  .action-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .rules-list,
  .profile-grid {
    grid-template-columns: 1fr;
  }

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