:root {
  --bg: #f5efe5;
  --bg-soft: #fbf7f1;
  --surface: rgba(255, 251, 247, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-tint: rgba(255, 243, 227, 0.82);
  --text: #2f241d;
  --muted: #7f6a59;
  --primary: #d6672a;
  --primary-deep: #8b3e16;
  --primary-soft: #f5b989;
  --accent: #1f7a72;
  --accent-soft: #d9f1ee;
  --success: #15803d;
  --danger: #c24131;
  --border: rgba(139, 62, 22, 0.12);
  --shadow: 0 24px 80px rgba(89, 46, 18, 0.12);
  --shadow-soft: 0 12px 40px rgba(115, 73, 45, 0.09);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 10% 10%, rgba(214, 103, 42, 0.18), transparent 24rem),
    radial-gradient(circle at 92% 6%, rgba(31, 122, 114, 0.12), transparent 18rem),
    radial-gradient(circle at 80% 85%, rgba(245, 185, 137, 0.26), transparent 20rem),
    linear-gradient(180deg, #f7f0e7 0%, #fcf8f3 42%, #f6ede1 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  box-shadow: none;
}

.app-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 18px 14px 42px;
}

.hero {
  display: grid;
  gap: 20px;
  padding: 32px 24px;
  border: 1px solid rgba(29, 29, 31, 0.04);
  border-radius: 38px;
  background: #f5f5f7;
  box-shadow: 0 16px 40px rgba(29, 29, 31, 0.05);
}

.hero-copyblock {
  display: grid;
  gap: 20px;
  max-width: 34rem;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #6e6e73;
}

.hero h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #1d1d1f;
}

.hero-copy {
  display: grid;
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: #6e6e73;
}

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

.hero-feature-list p {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: #1d1d1f;
}

.hero-feature-list span {
  flex-shrink: 0;
  color: #8b5e3c;
  font-weight: 700;
}

.app-main {
  padding-top: 18px;
  view-transition-name: app-stage;
  contain: layout paint;
}

.grid {
  display: grid;
  gap: 16px;
}

.home-grid {
  align-items: start;
}

.panel-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mini-tag {
  flex-shrink: 0;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(217, 241, 238, 0.9);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
}

.card,
.loading-card,
.question-card,
.summary-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: rise-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.card::before,
.question-card::before,
.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
}

.loading-card,
.summary-card,
.question-card,
.card {
  padding: 18px;
}

.card-featured {
  background:
    linear-gradient(180deg, rgba(255, 251, 247, 0.92), rgba(249, 241, 231, 0.88)),
    var(--surface);
}

.action-card {
  background:
    linear-gradient(180deg, rgba(255, 247, 239, 0.92), rgba(255, 251, 247, 0.9)),
    var(--surface);
}

.exam-card {
  background:
    linear-gradient(180deg, rgba(236, 248, 246, 0.76), rgba(255, 251, 247, 0.92)),
    var(--surface);
}

.stats-grid,
.actions-grid,
.type-actions-grid {
  display: grid;
  gap: 12px;
}

.home-cta,
.home-cta-copyblock,
.bottom-secondary-row,
.type-strip {
  display: grid;
  gap: 12px;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-box {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 243, 235, 0.92));
  border: 1px solid rgba(139, 62, 22, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.stat-box::after {
  content: "";
  position: absolute;
  inset: auto -18px -26px auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214, 103, 42, 0.12), rgba(214, 103, 42, 0));
}

.stat-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.actions-grid {
  grid-template-columns: 1fr;
}

.home-cta {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(252, 244, 236, 0.9));
  border: 1px solid rgba(214, 103, 42, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.home-cta-label {
  margin: 0;
  color: var(--primary-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-cta-title {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.home-cta-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.home-cta-button {
  min-height: 60px;
}

.type-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.type-chip {
  display: inline-grid;
  place-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(139, 62, 22, 0.08);
  color: var(--primary-deep);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.type-card {
  background:
    linear-gradient(180deg, rgba(248, 243, 255, 0.72), rgba(255, 251, 247, 0.92)),
    var(--surface);
}

.type-actions-grid {
  grid-template-columns: 1fr;
}

.primary-action,
.secondary-action,
.ghost-action,
.nav-action,
.exam-action {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-action,
.secondary-action,
.ghost-action,
.nav-action,
.exam-action,
.bookmark-button,
.option-button,
.pill,
.stat-box {
  will-change: transform, opacity;
}

.primary-action:active,
.secondary-action:active,
.ghost-action:active,
.nav-action:active,
.exam-action:active,
.bookmark-button:active,
.option-button:active {
  transform: translateY(1px) scale(0.988);
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, #de7637, #a54b1f);
  box-shadow: 0 16px 32px rgba(173, 77, 28, 0.24);
}

.secondary-action {
  color: var(--primary-deep);
  background: rgba(255, 247, 239, 0.95);
  border: 1px solid rgba(214, 103, 42, 0.12);
}

.ghost-action {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(139, 62, 22, 0.2);
}

.danger-action {
  color: var(--danger);
}

.exam-action {
  display: grid;
  gap: 4px;
  justify-items: start;
  color: #fff;
  background: linear-gradient(135deg, #1f7a72, #15544e);
  box-shadow: 0 16px 32px rgba(21, 84, 78, 0.24);
}

.exam-action small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
  font-weight: 600;
}

.section-title,
.question-title {
  margin: 0 0 12px;
  font-size: 1.14rem;
  letter-spacing: -0.02em;
}

.microcopy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.toolbar,
.result-panel,
.bottom-bar,
.summary-grid,
.pill-row {
  display: grid;
  gap: 12px;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar-wide {
  grid-template-columns: 1fr;
}

.pill-row {
  grid-template-columns: repeat(3, max-content);
  align-items: start;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pill-row::-webkit-scrollbar {
  display: none;
}

.pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 246, 237, 0.9);
  border: 1px solid rgba(214, 103, 42, 0.09);
  color: var(--primary-deep);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill-alert {
  background: rgba(254, 234, 234, 0.96);
  color: var(--danger);
  border-color: rgba(194, 65, 49, 0.12);
}

.bookmark-button {
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 16px;
  color: var(--accent);
  background: rgba(236, 248, 246, 0.94);
  border: 1px solid rgba(31, 122, 114, 0.14);
  font-weight: 800;
}

.bookmark-button.active {
  color: #fff;
  background: linear-gradient(135deg, #248b81, #1a655e);
  box-shadow: 0 12px 24px rgba(31, 122, 114, 0.22);
}

.question-stage {
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.94), rgba(255, 247, 240, 0.88)),
    var(--surface);
}

.question-headline {
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 242, 233, 0.84));
  border: 1px solid rgba(139, 62, 22, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: soft-shift 440ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.question-title {
  margin-bottom: 10px;
}

.question-body {
  margin: 0;
  font-size: 1.14rem;
  line-height: 1.82;
  letter-spacing: -0.01em;
}

.options-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.option-button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 15px 15px;
  border-radius: 22px;
  border: 1px solid rgba(139, 62, 22, 0.08);
  background: rgba(255, 255, 255, 0.92);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

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

.option-button.selected {
  border-color: rgba(214, 103, 42, 0.42);
  background: rgba(255, 242, 230, 0.96);
  box-shadow: 0 10px 24px rgba(214, 103, 42, 0.08);
}

.option-button.correct {
  border-color: rgba(21, 128, 61, 0.26);
  background: rgba(240, 253, 244, 0.96);
}

.option-button.wrong {
  border-color: rgba(194, 65, 49, 0.22);
  background: rgba(254, 244, 242, 0.98);
}

.option-label {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(214, 103, 42, 0.1);
  color: var(--primary-deep);
  font-weight: 900;
}

.option-text {
  line-height: 1.66;
}

.option-flag {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.hint {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 247, 239, 0.88);
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.result-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 251, 235, 0.94);
  border: 1px solid rgba(214, 103, 42, 0.12);
  animation: fade-up 320ms ease both;
}

.result-panel.success {
  background: rgba(240, 253, 244, 0.96);
  border-color: rgba(22, 163, 74, 0.18);
}

.result-panel.error {
  background: rgba(254, 242, 242, 0.98);
  border-color: rgba(220, 38, 38, 0.14);
}

.result-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 900;
}

.result-copy {
  margin: 0;
  line-height: 1.68;
}

.bottom-bar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  margin-top: 18px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 44px rgba(83, 52, 30, 0.12);
  backdrop-filter: blur(20px);
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.bottom-bar-mock {
  gap: 10px;
}

.bottom-primary {
  min-height: 58px;
}

.bottom-secondary-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bottom-secondary-row-mock {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-stage {
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.94), rgba(237, 248, 246, 0.72)),
    var(--surface);
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.summary-box {
  padding: 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(139, 62, 22, 0.07);
}

.summary-box p {
  margin: 0;
}

.summary-box p + p {
  margin-top: 8px;
}

.empty-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

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

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

@keyframes soft-shift {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

::view-transition-old(app-stage),
::view-transition-new(app-stage) {
  animation-duration: 260ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(app-stage) {
  animation-name: app-fade-out;
}

::view-transition-new(app-stage) {
  animation-name: app-fade-in;
}

@keyframes app-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }

  to {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(4px);
  }
}

@keyframes app-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(6px);
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 640px) {
  .app-shell {
    padding: 26px 18px 48px;
  }

  .hero,
  .loading-card,
  .summary-card,
  .question-card,
  .card {
    padding: 24px;
  }

  .actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .type-actions-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-cta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .home-cta-button {
    width: auto;
    min-width: 190px;
    padding-inline: 22px;
  }

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

  .bottom-bar {
    max-width: 560px;
    margin-inline: auto;
  }

  .toolbar-wide {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 820px) {
  .hero {
    padding: 40px 24px;
  }

  .home-grid {
    grid-template-columns: 1.1fr 1fr;
  }

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

@media (max-width: 420px) {
  .type-strip {
    grid-template-columns: 1fr;
  }
}
