:root {
  --app-bg: #111111;
  --screen: #0d5233;
  --footer: #fdf5d8;
  --title: #e8c84a;
  --title-light: #f0e8b8;
  --white: #ffffff;
  --brown: #2c1a06;
  --cream: #fdf5d8;
  --panel: #1a6b42;
  --ok: #3dd46a;
  --bad: #f07060;
  --text: rgba(255, 255, 255, 0.93);
  --footer-height: 116px;
  --top-progress-height: 72px;
  --page-side-padding: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --top-progress-total-height: calc(var(--top-progress-height) + var(--safe-top));
  --pine-dark: #0a3a25;
  --pine-darkest: #041a10;
  --transition-duration: 250ms;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  font-family: "DM Sans", sans-serif;
  background: var(--app-bg);
  color: var(--text);
}

.phone {
  width: 390px;
  height: 844px;
  min-height: 844px;
  max-height: 844px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--screen);
  border-radius: 44px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.content.screen-exit {
  animation: fadeOut var(--transition-duration) ease-in-out forwards;
}

.content.screen-enter {
  animation: fadeIn var(--transition-duration) ease-in-out forwards;
}

.content {
  flex: 1;
  height: 100%;
  padding: calc(var(--top-progress-total-height) + 24px) var(--page-side-padding) calc(var(--footer-height) + 20px);
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(253, 245, 216, 0);
  transition: background 180ms ease;
}

.content.is-scrolling {
  scrollbar-color: rgba(253, 245, 216, 0.35) transparent;
}

.content.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(253, 245, 216, 0.35);
}

.kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
}

.kicker.ok {
  border-color: rgba(61, 212, 106, 0.75);
}

.kicker.bad {
  border-color: rgba(240, 112, 96, 0.75);
}

.phase-box {
  display: flex;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  margin-bottom: 20px;
  color: var(--white);
}

.phase-box-line {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h1,
h2,
h3 {
  margin: 0 0 16px;
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--title);
}

h1,
h2 {
  font-size: 36px;
}

h1 {
  display: inline-block;
  letter-spacing: 0.02em;
}

.h1-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  filter: blur(5px);
  animation: h1CharIn 520ms cubic-bezier(0.22, 0.85, 0.25, 1) forwards;
}

.text-reveal {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(2px);
  transition: opacity 340ms ease, transform 340ms ease, filter 340ms ease;
}

.text-reveal.text-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

@keyframes h1CharIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.h1-char {
  animation: h1CharIn 340ms ease forwards;
  animation-delay: 300ms;
}

@media (prefers-reduced-motion: reduce) {
  .h1-char {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .text-reveal,
  .text-reveal.text-visible {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

h3 {
  font-size: 34px;
  color: var(--brown);
}

p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}

.subtle {
  margin-top: -2px;
  margin-bottom: 14px;
  font-family: "DM Sans", sans-serif;
  font-style: italic;
  font-size: 16px;
  color: var(--title-light);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

.progress-track {
  height: 5px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #e8c84a;
}

.img-box {
  width: 100%;
  height: 228px;
  margin: 10px 0 22px;
  border-radius: 14px;
  background: #1a4a2a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-box.medium {
  width: 100%;
  height: 185px;
  margin: 10px 0 22px;
  padding: 14px;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.img-box.medium img {
  object-fit: contain;
  object-position: center;
}

.panel {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--panel);
}

.panel-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
}

.list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.list li {
  position: relative;
  padding: 5px 0 5px 16px;
  font-family: "DM Sans", sans-serif;
}

.list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--title);
}

.dom-grid,
.tf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.tile {
  min-height: 118px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 2.5px solid var(--brown);
  border-radius: 18px;
  background: var(--cream);
  color: var(--brown);
  font-family: inherit;
  cursor: pointer;
}

.tile .arrow {
  font-size: 26px;
  line-height: 1;
}

.tile .label {
  font-size: 17px;
  font-weight: 600;
}

.tile.active {
  background: #c99616;
}

.tile.correct {
  background: var(--ok);
  color: #352100;
}

.tile.wrong {
  background: var(--bad);
  color: #4a1300;
}

.equipment-item,
.choice {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid var(--brown);
  border-radius: 14px;
  background: var(--cream);
  color: var(--brown);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.equipment-item {
  margin-top: 12px;
  min-height: 57px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.check {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--brown);
  border-radius: 6px;
  background: #ffffff;
  flex-shrink: 0;
}

.check.on {
  border-color: #e9b820;
  background: #e9b820;
}

.check.on::after {
  content: "✓";
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--brown);
  font-size: 15px;
  font-weight: 700;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 14px;
  font-weight: 600;
}

.choice.selected {
  background: #d9cfb4;
  border-color: #5a370f;
}

.choice .tag {
  min-width: 14px;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.choice.correct {
  background: var(--ok);
  color: #422500;
}

.choice.wrong {
  background: var(--bad);
  color: #4d1600;
}

.hint-btn {
  margin-top: 16px;
  min-width: 136px;
  padding: 10px 20px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.helper {
  margin-top: 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.score {
  margin-top: 8px;
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  color: var(--ok);
}

.score.good {
  color: var(--ok);
}

.scoreline {
  height: 6px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.scoreline > div {
  width: 100%;
  height: 100%;
  background: var(--ok);
}

.scoreline.good > div {
  background: var(--ok);
}

.cert {
  margin-top: 16px;
  min-height: 272px;
  padding: 26px 20px;
  border: 2px dashed var(--panel);
  border-radius: 14px;
  background: #f0faf4;
  color: var(--brown);
  text-align: center;
}

.cert p {
  color: var(--brown);
  font-style: italic;
}

.name {
  min-height: 40px;
  margin: 10px 0 12px;
  font-family: "DM Sans", sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--brown);
}

input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px var(--page-side-padding) 18px;
  background: var(--footer);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.top-progress {
  position: absolute;
  top: var(--safe-top);
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--top-progress-height);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  padding: 24px var(--page-side-padding) 18px;
  border-radius: 0;
  background: var(--pine-dark);
  pointer-events: none;
}

.top-progress-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(253, 245, 216, 0.95);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  line-height: 1;
}

.top-progress-track {
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: rgba(253, 245, 216, 0.22);
  overflow: hidden;
}

.top-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--pine-darkest);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 0;
}

.btn-row .btn {
  flex: 1;
}

.footer > .btn {
  width: 100%;
}

.btn {
  min-height: 50px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--brown);
  box-shadow: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn.light {
  background: var(--cream);
  color: var(--brown);
  border: 2px solid var(--brown);
}

.btn.reset-ghost {
  width: 50%;
  margin: 12px auto 0;
  background: transparent;
  border: 2px solid var(--title-light);
  color: var(--title-light);
  font-weight: 600;
.btn .btn-arrow {
  font-size: 18px;
  line-height: 1;
}
}

.btn.warn {
  background: #e9b820;
  color: var(--brown);
}

.btn.disabled,
.btn:disabled {
  background: #7a6a50;
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}

.state-note {
  position: absolute;
  top: calc(var(--top-progress-total-height) + 22px);
  right: var(--page-side-padding);
  font-size: 10px;
  letter-spacing: 0.5px;
  opacity: 0.25;
  color: #ffffff;
}

.order-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-screen .header-row,
.order-screen h1,
.order-screen .kicker,
.order-screen .order-list,
.order-screen .btn.reset-ghost {
  margin: 0;
}

.order-screen .btn.reset-ghost {
  align-self: center;
}

.order-intro {
  margin: 0;
}

.question-screen .header-row {
  margin-bottom: 4px;
}

.question-screen h1 {
  margin-bottom: 8px;
}

.question-screen .kicker {
  margin-bottom: 8px;
}

.question-screen .question-prompt {
  margin: 0;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.order-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  min-height: 57px;
  border: 2px solid var(--brown);
  border-radius: 14px;
  background: var(--cream);
  color: var(--brown);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.order-item.active {
  background: #dbc79d;
  border-color: #5a370f;
}

.panel.feedback-ok {
  background: rgba(61, 212, 106, 0.18);
  border: 1px solid rgba(61, 212, 106, 0.5);
}

.panel.feedback-bad {
  background: rgba(240, 112, 96, 0.16);
  border: 1px solid rgba(240, 112, 96, 0.46);
}

.quiz-popup-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
}

.quiz-popup {
  position: relative;
  width: min(100%, 380px);
  padding: 24px 22px 20px;
  border-radius: 18px;
  border: 1px solid transparent;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.4);
}

.quiz-popup.correct {
  background: #7ee5a0;
  border-color: #2b8650;
  color: #0b2a18;
}

.quiz-popup.incorrect {
  background: #f4a398;
  border-color: #b05145;
  color: #2d0d09;
}

.quiz-popup-title {
  margin-bottom: 10px;
  padding-right: 36px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.quiz-popup p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
  color: inherit;
}

.quiz-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.quiz-popup-close-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}

.quiz-popup.correct .quiz-popup-close {
  background: rgba(19, 82, 43, 0.2);
}

.quiz-popup.incorrect .quiz-popup-close {
  background: rgba(117, 36, 28, 0.24);
}

.badge {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--brown);
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 430px) {
  body {
    padding: 12px;
  }

  .phone {
    width: 390px;
    height: 844px;
    min-height: 844px;
    max-height: 844px;
    border-radius: 24px;
  }
}
