:root {
  --bg: #f4efe5;
  --bg-strong: #eadcc4;
  --surface: rgba(255, 252, 247, 0.86);
  --surface-strong: #fffaf1;
  --ink: #1f2a22;
  --muted: #5f695f;
  --line: rgba(31, 42, 34, 0.12);
  --accent: #cb5f3c;
  --accent-deep: #8c2f18;
  --accent-soft: #f6c8b6;
  --success: #2d7a51;
  --shadow: 0 20px 50px rgba(68, 44, 17, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(203, 95, 60, 0.18), transparent 26%),
    radial-gradient(circle at right 20%, rgba(45, 122, 81, 0.16), transparent 24%),
    linear-gradient(180deg, #f7f1e7 0%, #efe4d4 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-panel,
.panel,
.card-stage {
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.eyebrow,
.field-label,
.card-caption,
.stat-label,
.pill {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.eyebrow {
  color: var(--accent-deep);
  font-weight: 800;
  margin: 0 0 12px;
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 4vw, 4.8rem);
  line-height: 0.94;
  max-width: 11ch;
}

.hero-text,
.panel-copy,
#cardHint,
#cardExample,
#quizFeedback,
#bankCount {
  color: var(--muted);
}

.hero-text {
  margin: 18px 0 0;
  max-width: 58ch;
  line-height: 1.6;
}

.hero-actions,
.study-actions,
.toggle-group,
.quiz-row,
.sync-actions,
.bank-header,
.card-toolbar,
.audio-tools,
.audio-toggle {
  display: flex;
  gap: 12px;
  align-items: center;
}

.quiz-row,
.sync-actions {
  align-items: stretch;
}

.hero-actions {
  margin-top: 22px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.mark-action,
.ghost-button,
.toggle {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.primary-action:hover,
.secondary-action:hover,
.mark-action:hover,
.ghost-button:hover,
.toggle:hover {
  transform: translateY(-1px);
}

.primary-action {
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.secondary-action,
.ghost-button {
  background: rgba(31, 42, 34, 0.06);
  color: var(--ink);
}

.mark-action {
  background: rgba(45, 122, 81, 0.14);
  color: var(--success);
  font-weight: 800;
}

.toggle {
  background: rgba(31, 42, 34, 0.06);
  color: var(--muted);
}

.toggle.active {
  background: var(--ink);
  color: white;
}

.hero-panel {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.stat-card {
  background: rgba(255, 250, 241, 0.9);
  border-radius: 20px;
  padding: 18px 20px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
}

.stat-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.app-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.control-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.panel,
.card-stage {
  padding: 20px;
}

.mini-panel {
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.96), rgba(242, 232, 214, 0.96));
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 10px;
}

.quiz-row input,
.sync-actions input {
  flex: 1 1 220px;
  min-width: 0;
}

.quiz-row button,
.sync-actions button {
  flex: 0 0 auto;
}

.study-column {
  display: grid;
  gap: 24px;
  min-width: 0;
  position: relative;
  z-index: 1;
  isolation: isolate;
  margin-left: 12px;
}

.study-column .card-stage,
.study-column .word-bank {
  box-shadow: 0 14px 28px rgba(68, 44, 17, 0.08);
}

.card-stage {
  padding: 22px;
  min-width: 0;
}

.card-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.audio-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.audio-toggle {
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 42, 34, 0.06);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.audio-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.audio-toggle span {
  font-size: 0.92rem;
}

.pill {
  background: rgba(31, 42, 34, 0.08);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
}

.flashcard {
  position: relative;
  min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 420ms ease;
  cursor: pointer;
}

.flashcard.revealed {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  padding: 28px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid rgba(31, 42, 34, 0.08);
  backface-visibility: hidden;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
}

.card-front {
  background:
    linear-gradient(135deg, rgba(203, 95, 60, 0.12), transparent 55%),
    var(--surface-strong);
}

.card-back {
  transform: rotateY(180deg);
  background:
    linear-gradient(135deg, rgba(45, 122, 81, 0.12), transparent 55%),
    var(--surface-strong);
}

#cardFrench,
#cardDutch {
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 1;
}

.study-actions {
  margin-top: 20px;
  flex-wrap: wrap;
}

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

.quiz-feedback {
  min-height: 24px;
  margin: 12px 0 0;
}

.quiz-actions {
  margin-top: 14px;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none;
}

.sync-actions {
  margin-top: 12px;
  flex-wrap: wrap;
}

#syncCodeInput {
  margin-top: 0;
  text-transform: uppercase;
}

.word-bank {
  overflow: hidden;
  min-width: 0;
}

.bank-header {
  justify-content: space-between;
  margin-bottom: 16px;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.word-chip {
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.95);
  border: 1px solid rgba(31, 42, 34, 0.08);
  padding: 14px;
  cursor: pointer;
}

.word-chip.known {
  background: rgba(45, 122, 81, 0.11);
}

.word-chip.practice {
  background: rgba(203, 95, 60, 0.14);
}

.word-chip strong,
.word-chip span {
  display: block;
}

.word-chip strong {
  font-size: 1.05rem;
}

.word-chip span {
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 960px) {
  .hero,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .study-column {
    margin-left: 0;
  }

  .word-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-panel,
  .panel,
  .card-stage {
    border-radius: 22px;
  }

  .card-face {
    min-height: 320px;
  }

  .quiz-row,
  .sync-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
