:root {
  --bg: #fff7d6;
  --surface: rgba(255, 255, 255, 0.82);
  --ink: #253046;
  --muted: #5e6b80;
  --line: rgba(37, 48, 70, 0.12);
  --accent: #ef7d39;
  --accent-dark: #d65f20;
  --accent-soft: #fff0d9;
  --berry: #e44f7a;
  --sky: #78c8f2;
  --mint: #8bd6a2;
  --shadow: 0 20px 44px rgba(118, 80, 22, 0.16);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(120, 200, 242, 0.45), transparent 20rem),
    radial-gradient(circle at 80% 20%, rgba(139, 214, 162, 0.45), transparent 18rem),
    radial-gradient(circle at bottom right, rgba(228, 79, 122, 0.2), transparent 22rem),
    linear-gradient(180deg, #fffbed 0%, var(--bg) 100%);
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
  text-align: center;
}

.hero {
  padding: 3rem 0 2rem;
}

.hero h1 {
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0.9) translateY(-10px); opacity: 0; }
  60% { transform: scale(1.02) translateY(2px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.hero-compact {
  padding: 0.5rem 0 1rem;
}

.hero-compact h1 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  margin-bottom: 0.5rem;
}

.hero-compact .eyebrow {
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}

.hero-compact .lede {
  font-size: 1rem;
  margin-bottom: 0;
}

.eyebrow,
.badge {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-block;
}

.eyebrow {
  background: linear-gradient(90deg, var(--accent), var(--berry));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  color: var(--berry);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 5.4rem);
  line-height: 0.92;
  max-width: 100%;
  margin-bottom: 1rem;
  margin-left: auto;
  margin-right: auto;
}

.lede {
  max-width: 56ch;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.15rem;
  color: rgba(37, 48, 70, 0.88);
}

.welcome-grid,
.deck-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  align-items: start;
  justify-items: center;
}

.single-panel {
  max-width: 42rem;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.gap-lg {
  gap: 1.25rem;
}

.panel,
.deck-link,
.flashcard,
.empty-state {
  backdrop-filter: blur(14px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel,
.empty-state {
  padding: 1.5rem;
  width: 100%;
  text-align: left;
}

.deck-list,
.card-list {
  display: grid;
  gap: 0.85rem;
}

.deck-link {
  display: grid;
  gap: 0.4rem;
  padding: 1.1rem;
  color: inherit;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.deck-link:hover,
.deck-link:focus-visible {
  transform: translateY(-4px) rotate(1deg);
  border-color: rgba(239, 125, 57, 0.45);
  background: #fffaf1;
  box-shadow: 0 12px 28px rgba(239, 125, 57, 0.2);
}

.panel-header,
.study-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.study-card {
  display: grid;
  gap: 1rem;
}

.flashcard {
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 225, 0.92));
  text-align: center;
}

.cheer {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.flashcard h3 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.answer-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.answer-form {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.problem,
.answer {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  line-height: 1;
  font-weight: 900;
}

.answer {
  color: var(--berry);
}


.answer-input {
  width: 100%;
  border: 2px solid rgba(37, 48, 70, 0.12);
  border-radius: 18px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  background: #fff;
}

.answer-input:focus {
  outline: none;
  border-color: rgba(239, 125, 57, 0.7);
  box-shadow: 0 0 0 5px rgba(239, 125, 57, 0.14);
}

.answer-correct,
.answer-wrong {
  border-top: 0;
  border-radius: 20px;
  padding: 1rem 1.1rem;
}

.submit-button {
  margin-top: 1rem;
  font-size: 1.1rem;
}

.result-overlay {
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-correct {
  background: linear-gradient(135deg, rgba(139, 214, 162, 0.3), rgba(139, 214, 162, 0.15));
  border: 2px solid var(--mint);
}

.result-wrong {
  background: linear-gradient(135deg, rgba(228, 79, 122, 0.2), rgba(228, 79, 122, 0.1));
  border: 2px solid var(--berry);
}

.result-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iconBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-correct .result-icon {
  background: var(--mint);
  color: #fff;
}

.result-wrong .result-icon {
  background: var(--berry);
  color: #fff;
}

.icon-check,
.icon-x {
  width: 36px;
  height: 36px;
}

.result-text {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.result-correct .result-text {
  color: #2d8a4e;
}

.result-wrong .result-text {
  color: var(--berry);
}

.side-flash {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  animation: sideFlash 0.6s ease-out forwards;
}

.flash-green {
  box-shadow: inset 0 0 120px 40px rgba(139, 214, 162, 0.7);
}

.flash-red {
  box-shadow: inset 0 0 120px 40px rgba(228, 79, 122, 0.5);
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes iconBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes sideFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.feedback-title,
.feedback-copy {
  margin-bottom: 0.4rem;
}

.feedback-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.next-button {
  margin-top: 0.75rem;
}

.card-row {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.card-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.alert {
  margin: 0.5rem 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #fff3e8;
  border: 1px solid rgba(239, 125, 57, 0.35);
}

.back-link,
.muted,
.deck-link span,
.deck-link small,
.card-row p {
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(37, 48, 70, 0.16);
  padding: 0.95rem 1rem;
  font: inherit;
}

button {
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

button:hover,
button:focus-visible {
  background: var(--accent-dark);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 18px rgba(214, 95, 32, 0.22);
}

.button-secondary {
  background: var(--sky);
  color: var(--ink);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: #5eb7e5;
}

.button-ghost {
  background: var(--mint);
  color: var(--ink);
}

.button-ghost:hover,
.button-ghost:focus-visible {
  background: #71c98a;
}

.play-panel {
  position: relative;
  overflow: hidden;
}

.play-panel::after {
  content: "";
  position: absolute;
  inset: auto -2rem -3rem auto;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: rgba(239, 125, 57, 0.12);
}

@media (max-width: 860px) {
  .shell {
    padding: 2rem 0 3rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .panel-header,
  .study-meta {
    align-items: stretch;
    flex-direction: column;
  }
}
