:root {
  --gold: #e8a000;
  --gold-deep: #c88800;
  --gold-soft: #f6d48a;
  --charcoal: #2f2f2a;
  --ink: #3a3a34;
  --cement: #8f8f80;
  --cement-dark: #6e6e64;
  --stone: #d8d5cc;
  --cream: #f4f1ea;
  --paper: #fffcf7;
  --white: #ffffff;
  --success: #2f7a52;
  --success-soft: #e7f4ec;
  --danger: #b5463a;
  --danger-soft: #f8e8e5;
  --shadow: 0 12px 30px rgba(47, 47, 42, 0.08);
  --radius: 18px;
  --touch: 56px;
  --max: 520px;
  --font: "Roboto", "Helvetica Neue", Arial, sans-serif;
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/roboto.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/roboto.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/roboto.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/roboto.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--charcoal);
  background: var(--cream);
  min-height: 100dvh;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  appearance: none;
  border: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.app {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(244, 241, 234, 0.96)),
    repeating-linear-gradient(
      135deg,
      rgba(143, 143, 128, 0.07) 0 8px,
      rgba(232, 160, 0, 0.05) 8px 16px
    );
}

.app::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--gold) 0 18px,
    var(--charcoal) 18px 28px
  );
  z-index: 5;
}

.decor {
  position: absolute;
  pointer-events: none;
  opacity: 0.16;
  z-index: 0;
}

.decor-crane {
  top: 36px;
  right: -20px;
  width: min(42vw, 260px);
}

.decor-skyline {
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  opacity: 0.12;
}

.decor-mixer {
  left: -28px;
  bottom: 70px;
  width: min(38vw, 210px);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max));
  margin: 0 auto;
  min-height: 100dvh;
  padding: 28px 20px 32px;
  display: flex;
}

.screen {
  display: none;
  width: 100%;
  margin: auto;
  animation: rise 0.35s ease;
}

.screen.active {
  display: block;
}

.logo {
  width: min(220px, 62vw);
  margin: 0 auto 18px;
}

.logo-sm {
  width: 120px;
  margin: 0 auto 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.hero-title {
  font-size: clamp(1.45rem, 6vw, 2rem);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.lead {
  margin: 14px 0 0;
  color: var(--cement-dark);
  text-align: center;
  font-size: 1.02rem;
  line-height: 1.45;
}

.card {
  background: var(--paper);
  border: 1px solid rgba(143, 143, 128, 0.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.gold-rule {
  width: 72px;
  height: 4px;
  margin: 14px auto 0;
  background: var(--gold);
  border-radius: 99px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--touch);
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, opacity 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--charcoal);
  box-shadow: 0 8px 0 var(--gold-deep);
}

.btn-primary:hover {
  background: #f0ac12;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stone);
}

.btn .arrow {
  font-size: 1.15em;
  line-height: 1;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--stone);
  border-radius: 12px;
  background: var(--white);
  color: var(--charcoal);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 160, 0, 0.18);
}

.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
}

.field-error {
  min-height: 1.1em;
  margin: 0;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 500;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 2px 8px;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--ink);
}

.check input {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  accent-color: var(--gold);
  flex: 0 0 22px;
}

.progress-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  text-align: center;
}

.progress-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cement-dark);
}

.dots {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: transparent;
}

.dot.done,
.dot.current {
  background: var(--gold);
}

.bar {
  height: 8px;
  overflow: hidden;
  background: var(--stone);
  border-radius: 99px;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 0.35s ease;
}

.question-text {
  margin: 0 0 16px;
  font-size: clamp(1.15rem, 4.6vw, 1.42rem);
  font-weight: 700;
  line-height: 1.35;
}

.options {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 14px 16px;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid rgba(143, 143, 128, 0.28);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(47, 47, 42, 0.05);
  color: var(--charcoal);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  touch-action: manipulation;
}

.option:hover {
  border-color: var(--gold);
}

.option:active {
  transform: scale(0.99);
}

.option.selected {
  border-color: var(--gold);
  background: #fff8e8;
  box-shadow: 0 0 0 3px rgba(232, 160, 0, 0.16);
}

.option-mark {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--cement);
  border-radius: 50%;
  position: relative;
}

.option.selected .option-mark {
  border-color: var(--gold);
}

.option.selected .option-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--gold);
}

.feedback-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 2rem;
}

.feedback-icon.ok {
  background: var(--success-soft);
  color: var(--success);
  animation: pop 0.45s ease;
}

.feedback-icon.bad {
  background: var(--danger-soft);
  color: var(--danger);
  animation: shake 0.4s ease;
}

.feedback-title {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.correct-line {
  margin: 10px 0 0;
  text-align: center;
  color: var(--cement-dark);
  font-size: 0.98rem;
}

.capsule {
  margin: 18px 0;
  padding: 16px 16px 18px;
}

.capsule h3 {
  margin-bottom: 8px;
  color: var(--gold-deep);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}

.capsule p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.score-ring {
  width: 148px;
  height: 148px;
  margin: 8px auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 58%, transparent 59%),
    conic-gradient(var(--gold) 0 var(--p, 0%), var(--stone) var(--p, 0%) 100%);
  box-shadow: var(--shadow);
}

.score-ring strong {
  font-size: 2rem;
  font-weight: 900;
}

.score-line {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.result-msg {
  margin: 8px 0 0;
  text-align: center;
  color: var(--gold-deep);
  font-size: 1.2rem;
  font-weight: 700;
}

.leaderboard {
  margin: 18px 0 0;
  padding: 16px 16px 10px;
}

.leaderboard h3 {
  margin: 0 0 12px;
  text-align: center;
  color: var(--gold-deep);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--white);
  border: 1.5px solid rgba(143, 143, 128, 0.22);
}

.leaderboard-item.is-current {
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  border-color: var(--gold);
  background: #fff8e8;
}

.leaderboard-item .place {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.9rem;
  background: var(--stone);
  color: var(--charcoal);
}

.leaderboard-item.rank-1 .place {
  background: var(--gold);
  color: var(--charcoal);
}

.leaderboard-item.rank-2 .place {
  background: #c8c8c0;
}

.leaderboard-item.rank-3 .place {
  background: #c49a6c;
  color: var(--white);
}

.leaderboard-item .who {
  min-width: 0;
  display: grid;
}

.leaderboard-item .who strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.leaderboard-item .who small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cement-dark);
  font-size: 0.78rem;
}

.leaderboard-item .you {
  display: none;
}

.leaderboard-item.is-current .you {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-item .pts {
  font-weight: 900;
  font-size: 1.05rem;
  white-space: nowrap;
}

.thanks {
  margin: 16px 0 18px;
  text-align: center;
  color: var(--cement-dark);
  line-height: 1.45;
}

.types {
  margin-top: 16px;
  padding: 16px 18px;
}

.types h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.types ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.types li {
  position: relative;
  padding-left: 18px;
  color: var(--ink);
}

.types li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(47, 47, 42, 0.2);
  border-top-color: var(--charcoal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.hidden {
  display: none !important;
}

.form-error {
  margin: 0;
  color: var(--danger);
  text-align: center;
  font-size: 0.9rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 768px) {
  .shell {
    padding-top: 42px;
    padding-bottom: 48px;
  }

  .panel,
  .capsule,
  .types {
    padding: 24px;
  }
}

@media (max-width: 380px) {
  .shell {
    padding: 24px 16px 24px;
  }

  .hero-title {
    font-size: 1.32rem;
  }
}
