:root {
  --bg-main: #e6f0c9;
  --bg-soft: #f8f9ef;
  --surface: rgba(255, 255, 255, 0.9);
  --text-main: #1d2b2c;
  --text-soft: #4d6262;
  --primary: #0d7a79;
  --primary-dark: #0a5c5d;
  --primary-soft: rgba(13, 122, 121, 0.12);
  --accent: #7de56f;
  --line: rgba(13, 122, 121, 0.16);
  --error: #cb4f46;
  --error-soft: #fee7e4;
  --success: #318f58;
  --success-soft: #dff3e5;
  --shadow: 0 28px 48px rgba(48, 74, 52, 0.12);
  --radius-xl: 42px;
  --radius-lg: 30px;
  --radius-md: 22px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: "Hanken Grotesk", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(125, 229, 111, 0.24), transparent 30%),
    radial-gradient(circle at top right, rgba(13, 122, 121, 0.16), transparent 28%),
    linear-gradient(180deg, #eef6d2 0%, var(--bg-main) 38%, #d7e8ac 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.totem-stage {
  position: relative;
  width: min(calc((100dvh - 24px) * 9 / 16), calc(100vw - 24px), 1100px);
  height: min(calc(100dvh - 24px), calc((100vw - 24px) * 16 / 9));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(230, 240, 201, 0.4)),
    var(--bg-main);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
}

.totem-stage.has-dialog .topbar,
.totem-stage.has-dialog .progress-track,
.totem-stage.has-dialog .screen {
  filter: blur(10px);
}

.brand-orb,
.brand-grid {
  position: absolute;
  pointer-events: none;
}

.brand-orb-left {
  inset: -8% auto auto -14%;
  width: 50%;
  height: 18%;
  border-radius: 0 0 240px 0;
  background: linear-gradient(135deg, rgba(125, 229, 111, 0.48), rgba(255, 255, 255, 0));
}

.brand-orb-right {
  inset: 12% -15% auto auto;
  width: 40%;
  height: 20%;
  border-radius: 220px 0 0 220px;
  background: linear-gradient(135deg, rgba(13, 122, 121, 0.2), rgba(13, 122, 121, 0));
}

.brand-grid {
  inset: auto 0 0 0;
  height: 34%;
  opacity: 0.78;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, 0.18) 18% 38%, transparent 38% 58%, rgba(255, 255, 255, 0.16) 58% 78%, transparent 78% 100%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 18%, transparent 18% 38%, rgba(255, 255, 255, 0.1) 38% 58%, transparent 58% 100%);
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 34px 24px 18px;
  transition: filter 180ms ease;
}

.brand-logo {
  width: min(58%, 320px);
  max-height: 96px;
  object-fit: contain;
}

.totem-stage[data-screen="start"] .brand-logo,
.totem-stage:has(.screen[data-screen="start"].is-active) .brand-logo {
  width: min(72%, 400px);
  max-height: 136px;
}

.progress-track {
  position: relative;
  z-index: 2;
  height: 10px;
  margin: 6px 34px 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.56);
  transition: filter 180ms ease;
}

.totem-stage[data-screen="start"] .progress-track,
.totem-stage:has(.screen[data-screen="start"].is-active) .progress-track {
  opacity: 0;
  visibility: hidden;
}

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

.screen {
  position: absolute;
  inset: 154px 0 0;
  z-index: 2;
  display: none;
  padding: 28px 30px 34px;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  transition: filter 180ms ease;
}

.screen.is-active {
  display: flex;
}

.hero-card,
.section-intro,
.identify-layout,
.identify-actions,
.keyboard-panel,
.options-list,
.feedback-card,
.bottom-action {
  width: min(100%, 720px);
  margin-inline: auto;
}

.hero-card,
.feedback-card,
.form-card,
.dialog-panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 36px;
  box-shadow: 0 18px 34px rgba(59, 89, 66, 0.08);
  backdrop-filter: blur(10px);
}

.hero-card {
  padding: 34px 30px 30px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

h1 {
  font-size: clamp(2.4rem, 4.2vw, 3.2rem);
}

h2 {
  font-size: clamp(2rem, 3.7vw, 2.8rem);
}

h3 {
  font-size: 2rem;
}

.lead {
  margin: 16px 0 0;
  font-size: 1.24rem;
  line-height: 1.46;
  color: var(--text-soft);
}

.lead.small {
  font-size: 1.08rem;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 30px;
}

.pillar-card {
  display: grid;
  gap: 10px;
  padding: 20px 12px;
  text-align: center;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(230, 240, 201, 0.92));
}

.pillar-card strong {
  font-size: 1rem;
}

.pillar-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #3f9290, var(--primary));
}

.pillar-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-action {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.screen[data-screen="start"] {
  justify-content: center;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 52px;
}

.screen[data-screen="start"] .bottom-action {
  margin-top: 0;
}

.primary-button,
.secondary-button {
  min-height: 70px;
  padding: 18px 24px;
  border: none;
  border-radius: 26px;
  font-size: 1.24rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 16px 28px rgba(13, 122, 121, 0.22);
}

.secondary-button {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(13, 122, 121, 0.16);
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 62px;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.46;
  cursor: default;
  box-shadow: none;
}

.hint {
  margin: 0;
  text-align: center;
  font-size: 0.98rem;
  color: var(--text-soft);
}

.section-intro {
  display: grid;
  gap: 10px;
}

.identify-screen .section-intro {
  margin-top: 0;
}

.identify-screen {
  padding-top: 40px;
  padding-bottom: 18px;
  gap: 16px;
  justify-items: center;
}

.identify-screen.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-content: stretch;
}

.identify-layout {
  display: flex;
  min-height: 0;
  margin-top: 0;
  align-items: start;
  justify-content: center;
}

.form-card {
  width: 100%;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.touch-input {
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border-radius: 22px;
  border: 2px solid rgba(13, 122, 121, 0.1);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main);
  font-size: 1.08rem;
  outline: none;
  cursor: pointer;
}

.touch-input::placeholder {
  color: rgba(77, 98, 98, 0.72);
}

.touch-input.is-focused {
  border-color: var(--primary);
  box-shadow: 0 0 0 5px rgba(13, 122, 121, 0.12);
}

.identify-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 14px;
  margin-top: 0;
}

.keyboard-panel {
  display: grid;
  gap: 5px;
  padding: 4px 0 0;
  background: linear-gradient(180deg, rgba(232, 241, 209, 0.4), rgba(245, 248, 236, 0.96));
  border-top: none;
  backdrop-filter: blur(8px);
}

.keyboard-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.keyboard-row-bottom {
  grid-template-columns: repeat(3, 1fr);
}

.key {
  min-height: 32px;
  padding: 0 6px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(47, 72, 58, 0.05);
  cursor: pointer;
}

.action-key {
  background: rgba(13, 122, 121, 0.14);
  color: var(--primary-dark);
}

.quiz-intro {
  gap: 14px;
  margin-top: 26px;
}

.quiz-screen {
  align-items: center;
}

.options-list {
  display: grid;
  gap: 16px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 106px;
  padding: 22px 24px;
  border-radius: 28px;
  border: 2px solid rgba(13, 122, 121, 0.1);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 18px rgba(59, 89, 66, 0.05);
  cursor: pointer;
}

.option-card::before {
  content: "";
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  border: 2px solid rgba(13, 122, 121, 0.24);
  background: #ffffff;
}

.option-card span {
  font-size: 1.24rem;
  line-height: 1.3;
  font-weight: 600;
}

.option-card.is-selected {
  border-color: var(--primary);
  background: rgba(236, 248, 229, 0.98);
}

.option-card.is-selected::before {
  border-color: var(--primary);
  background: radial-gradient(circle, var(--primary) 0 46%, transparent 48%);
}

.option-card.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.option-card.is-incorrect {
  border-color: var(--error);
  background: var(--error-soft);
}

.feedback-card {
  max-width: 100%;
  padding: 34px 28px;
  display: grid;
  gap: 18px;
  text-align: center;
  justify-items: center;
}

.feedback-screen {
  justify-content: center;
  align-items: center;
  padding-top: 64px;
  padding-bottom: 48px;
}

.feedback-screen .bottom-action {
  width: 100%;
  max-width: 520px;
  margin-top: 0;
}

.feedback-screen .feedback-card {
  width: 100%;
  max-width: 560px;
  margin-top: auto;
  margin-bottom: auto;
}

.dialog-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  padding: 26px;
  background: rgba(20, 33, 32, 0.18);
}

.dialog-overlay.is-open {
  display: grid;
}

.dialog-panel {
  width: 100%;
  max-width: 540px;
  padding: 30px 26px;
  display: grid;
  gap: 18px;
  text-align: center;
}

.dialog-message {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.5;
  color: var(--text-soft);
}

@media (max-height: 980px) {
  .topbar {
    padding-top: 24px;
    padding-bottom: 14px;
  }

  .brand-logo {
    max-height: 84px;
  }

  .totem-stage[data-screen="start"] .brand-logo,
  .totem-stage:has(.screen[data-screen="start"].is-active) .brand-logo {
    max-height: 118px;
  }

  .screen {
    inset: 136px 0 0;
    padding: 22px 24px 26px;
    gap: 18px;
  }

  .screen[data-screen="start"] {
    padding-top: 28px;
    padding-bottom: 36px;
  }

  h1 {
    font-size: 2.06rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .lead {
    font-size: 1.08rem;
  }

  .identify-screen {
    padding-top: 34px;
    padding-bottom: 14px;
    gap: 12px;
  }

  .feedback-screen {
    padding-top: 52px;
    padding-bottom: 40px;
  }

  .identify-actions {
    gap: 10px;
  }

  .form-card {
    padding: 14px 16px;
  }

  .touch-input {
    min-height: 46px;
    font-size: 1rem;
  }

  .key {
    min-height: 30px;
    font-size: 0.78rem;
  }

  .option-card {
    min-height: 94px;
  }

  .option-card span {
    font-size: 1.1rem;
  }

  .quiz-intro {
    margin-top: 18px;
  }
}

@media (max-height: 860px) {
  .topbar {
    padding-top: 18px;
    padding-bottom: 10px;
  }

  .brand-logo {
    max-height: 72px;
  }

  .totem-stage[data-screen="start"] .brand-logo,
  .totem-stage:has(.screen[data-screen="start"].is-active) .brand-logo {
    max-height: 104px;
  }

  .progress-track {
    height: 8px;
    margin: 4px 24px 0;
  }

  .screen {
    inset: 114px 0 0;
    padding: 18px 20px 18px;
    gap: 12px;
  }

  .screen[data-screen="start"] {
    padding-top: 20px;
    padding-bottom: 24px;
    gap: 16px;
  }

  .hero-card {
    padding: 26px 24px 22px;
  }

  .pillars {
    gap: 12px;
    margin-top: 22px;
  }

  .pillar-card {
    padding: 14px 10px;
    gap: 8px;
  }

  .pillar-icon {
    width: 48px;
    height: 48px;
  }

  .pillar-icon svg {
    width: 24px;
    height: 24px;
  }

  .primary-button,
  .secondary-button {
    min-height: 58px;
    padding: 14px 20px;
    font-size: 1.08rem;
  }

  .identify-screen {
    padding-top: 22px;
    padding-bottom: 10px;
    gap: 10px;
  }

  .section-intro {
    gap: 6px;
  }

  .form-card {
    padding: 12px 14px;
    gap: 4px;
  }

  .field-label {
    font-size: 0.8rem;
  }

  .touch-input {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.94rem;
  }

  .identify-actions {
    gap: 8px;
  }

  .keyboard-panel {
    gap: 4px;
  }

  .keyboard-row {
    gap: 4px;
  }

  .key {
    min-height: 26px;
    border-radius: 12px;
    font-size: 0.72rem;
  }

  .quiz-intro {
    margin-top: 8px;
    gap: 10px;
  }
}

@media (max-width: 760px) {
  .hero-card,
  .section-intro,
  .identify-layout,
  .identify-actions,
  .keyboard-panel,
  .options-list,
  .feedback-card,
  .bottom-action {
    width: min(100%, 640px);
  }

  .screen {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .totem-stage {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
}
