:root {
  --bg-0: #e8efe9;
  --bg-1: #f4f7f4;
  --ink: #16302a;
  --ink-soft: #3d5a52;
  --muted: #5f746c;
  --line: rgba(22, 48, 42, 0.12);
  --card: rgba(255, 255, 255, 0.78);
  --primary: #1a3a32;
  --primary-soft: rgba(26, 58, 50, 0.08);
  --yes: #1f7a4d;
  --yes-bg: rgba(31, 122, 77, 0.1);
  --translate: #c46a12;
  --translate-bg: rgba(196, 106, 18, 0.1);
  --no: #c0392b;
  --no-bg: rgba(192, 57, 43, 0.1);
  --danger: #a32020;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(22, 48, 42, 0.08);
  --font: "Manrope", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 120, 96, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 148, 70, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
}

button,
input,
a {
  font: inherit;
}

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

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(20px + var(--safe-top))
    18px
    calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-start {
  justify-content: center;
}

.page-login {
  justify-content: flex-start;
  padding-top: calc(28px + var(--safe-top));
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-block.compact {
  gap: 8px;
}

.brand-mark {
  margin: 0;
  font-size: clamp(1.85rem, 6vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--primary);
  line-height: 1.05;
}

.brand-mark.small {
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.brand-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  line-height: 1.45;
  color: var(--ink);
  max-width: none;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.section-label {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.steps-list li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  line-height: 1.45;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 14px 18px;
  min-height: 52px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #f6faf7;
  box-shadow: 0 10px 24px rgba(26, 58, 50, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: #244a40;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.55);
}

.back-link {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  width: fit-content;
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 20px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.field input {
  width: 100%;
  min-height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus {
  border-color: rgba(26, 58, 50, 0.45);
  box-shadow: 0 0 0 4px rgba(26, 58, 50, 0.1);
}

.form-error {
  margin: 0;
  color: var(--danger);
  background: rgba(163, 32, 32, 0.08);
  border: 1px solid rgba(163, 32, 32, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.eval-error {
  position: sticky;
  bottom: calc(12px + var(--safe-bottom));
}

.page-eval {
  gap: 14px;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.eval-top {
  display: grid;
  gap: 8px;
}

.eval-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.eval-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.question {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 4.4vw, 1.45rem);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 18px 16px;
  display: grid;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(52dvh, 520px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.card.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
}

.card.is-entering {
  opacity: 0;
  transform: translateY(-8px) scale(0.99);
}

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

.card-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-value {
  margin: 0;
  font-size: clamp(1rem, 3.6vw, 1.12rem);
  line-height: 1.55;
  color: var(--ink);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.answer-buttons {
  display: grid;
  gap: 10px;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  padding-top: 4px;
  background: linear-gradient(180deg, transparent, rgba(232, 239, 233, 0.95) 22%);
}

.btn-answer {
  background: transparent;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.25;
}

.btn-yes {
  color: var(--yes);
  border-color: var(--yes);
  background: var(--yes-bg);
}

.btn-yes:hover:not(:disabled) {
  background: rgba(31, 122, 77, 0.16);
}

.btn-translate {
  color: var(--translate);
  border-color: var(--translate);
  background: var(--translate-bg);
}

.btn-translate:hover:not(:disabled) {
  background: rgba(196, 106, 18, 0.16);
}

.btn-no {
  color: var(--no);
  border-color: var(--no);
  background: var(--no-bg);
}

.btn-no:hover:not(:disabled) {
  background: rgba(192, 57, 43, 0.16);
}

.btn-answer.is-pressed {
  transform: scale(0.97);
  box-shadow: inset 0 0 0 1px currentColor;
}

.done-panel {
  margin: auto 0;
  display: grid;
  gap: 16px;
  text-align: center;
  padding: 28px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.done-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
}

@media (min-width: 640px) {
  .page {
    padding-left: 24px;
    padding-right: 24px;
  }

  .answer-buttons {
    grid-template-columns: 1fr 1.35fr 1fr;
    align-items: stretch;
  }

  .btn-translate {
    order: 0;
  }

  .card {
    padding: 24px 22px;
  }

  .login-form {
    padding: 24px;
  }
}

@media (max-width: 380px) {
  .btn-answer {
    font-size: 0.92rem;
    padding: 13px 12px;
  }

  .steps-list li {
    grid-template-columns: 32px 1fr;
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
