:root {
  --white: #fff;
  --gray-light: #e2e8f4;
  --indigo-200: #c7d2fe;
  --gray-text: #64748b;
  --orange-light: #fb923c;
  --orange: #f97316;
  --orange-dark: #ea580c;
  --indigo: #4338ca;
  --green: #10b981;
  --blue: #3b82f6;
  --navy: #312e81;
  --shadow: 0 20px 60px rgb(49 46 129 / 18%);
}
* { box-sizing: border-box; }
body {
  min-width: 320px; min-height: 100vh; margin: 0;
  background:
    repeating-linear-gradient(135deg, rgb(255 255 255 / 6%) 0 1px, transparent 1px 22px),
    linear-gradient(150deg, #312e81 0%, #4c1d95 100%);
  color: var(--navy); font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}
button, input { font: inherit; } button { cursor: pointer; }
.app-shell { width: min(100%, 1180px); min-height: 100vh; margin: 0 auto; background: #f9f8ff; box-shadow: 0 0 100px rgb(0 0 0 / 35%); }
.topbar { min-height: 108px; padding: 24px 42px; display: flex; align-items: center; gap: 22px; background: var(--navy); color: var(--white); }
.topbar h1, .topbar p, h2, p { margin: 0; } .topbar h1 { font-size: 2rem; letter-spacing: -.05em; }
/* Brand icon – schrijfblokje */
.brand-icon {
  width: 48px; height: 54px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 5px;
  padding: 7px 8px 8px 18px;
  border: 2px solid var(--indigo-200); border-radius: 10px;
  background: var(--white); position: relative; overflow: hidden;
}
.brand-icon::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 12px; background: var(--orange); border-radius: 8px 0 0 8px;
}
.brand-display { color: var(--navy); font-size: .6rem; font-weight: 900; letter-spacing: .02em; line-height: 1.4; }
.brand-icon span:not(.brand-display) { height: 3px; border-radius: 2px; background: var(--indigo-200); }
.eyebrow { margin-bottom: 4px; color: var(--indigo-200); font-size: .74rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.dark { color: var(--orange); } .hidden { display: none !important; }
.header-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.score-pill { padding: 10px 18px; border: 2px solid var(--indigo-200); border-radius: 999px; font-weight: 800; }
.version-badge { padding: 6px 10px; border: 1px solid rgb(199 210 254 / 60%); border-radius: 8px; color: var(--indigo-200); font-family: Consolas, "Courier New", monospace; font-size: .68rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.icon-button { width: 52px; height: 52px; border: 2px solid var(--indigo-200); border-radius: 50%; background: transparent; color: var(--white); font-size: 1.7rem; }
.icon-button:hover { background: var(--indigo); }
.screen { display: none; padding: 38px 42px 48px; } .screen.active { display: block; }

/* Hero */
.hero { min-height: 190px; padding: 34px 38px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; border-radius: 28px; background: var(--white); box-shadow: var(--shadow); }
.hero h2, .quiz-meta h2, .result-card h2 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -.055em; }
.hero p:not(.eyebrow), .result-card p { color: var(--gray-text); font-size: 1.1rem; }

/* Hero book decoration – schrijfblokje */
.hero-book {
  width: 155px; margin: -10px 24px -45px 30px; flex: 0 0 auto;
  border: 5px solid var(--navy); border-radius: 16px;
  background: var(--white); box-shadow: 10px 12px 0 var(--indigo-200);
  transform: rotate(5deg); overflow: hidden;
}
.hero-book-label {
  padding: 8px 12px; background: var(--orange); color: var(--white);
  font-size: .85rem; font-weight: 900; letter-spacing: .03em; text-align: center;
}
.hero-book-lines { padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.hero-book-lines span {
  display: block; padding-bottom: 7px;
  border-bottom: 2px solid var(--indigo-200);
  color: var(--navy); font-size: .82rem; font-weight: 900; letter-spacing: .1em;
}

/* Level cards */
.level-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.level-card {
  min-height: 150px; padding: 24px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  border: 2.5px solid transparent; border-radius: 24px;
  background: var(--white); color: var(--navy); text-align: left;
  box-shadow: 0 8px 25px rgb(49 46 129 / 8%);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), border-color .15s;
}
.level-card:hover, .level-card:focus-visible { border-color: var(--orange); transform: translateY(-6px) scale(1.01); }
.level-card.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  color: var(--white);
}
.level-card.featured:hover, .level-card.featured:focus-visible { border-color: #c2410c; transform: translateY(-6px) scale(1.01); }
.level-number { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: var(--navy); color: var(--white); font-size: 2rem; font-weight: 900; }
.level-card[data-level="1"] .level-number { background: var(--green); }
.level-card[data-level="2"] .level-number { background: var(--blue); }
.featured .level-number { background: var(--white); color: var(--orange); }
.dictee-card { grid-column: 1 / -1; }
.dictee-card .level-number { background: var(--indigo); }
.level-copy { display: grid; gap: 7px; } .level-copy strong { font-size: 1.45rem; }
.level-copy small { color: var(--gray-text); font-size: .95rem; line-height: 1.4; } .featured .level-copy small { color: rgb(255 255 255 / 80%); }
.card-arrow { font-size: 2rem; font-weight: 900; }

/* Progress */
.progress-track { height: 12px; margin-bottom: 24px; overflow: hidden; border-radius: 99px; background: var(--gray-light); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange) 0%, var(--orange-light) 100%); transition: width .25s ease; }

/* Buttons */
.primary-button, .secondary-button { min-height: 54px; padding: 0 28px; border: 0; border-radius: 999px; font-weight: 900; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s; }
.primary-button { background: var(--orange); color: var(--white); } .primary-button:hover { background: var(--orange-dark); transform: scale(1.05); }
.primary-button:disabled { background: var(--gray-light); color: var(--gray-text); cursor: not-allowed; transform: none; }
.secondary-button { border: 2.5px solid var(--indigo-200); background: var(--white); color: var(--navy); }
.secondary-button:hover { border-color: var(--orange); transform: scale(1.03); }

/* Quiz */
.quiz-meta { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.quiz-meta strong { padding: 10px 18px; border-radius: 999px; background: var(--navy); color: var(--white); font-size: .95rem; }
.quiz-card { padding: 40px 35px; border-radius: 32px; background: var(--white); text-align: center; box-shadow: var(--shadow); }
.quiz-prompt { color: var(--gray-text); font-weight: 800; margin-bottom: 4px; font-size: .95rem; }
.feedback { min-height: 28px; margin-top: 14px; font-size: 1.15rem; font-weight: 900; }
.feedback.good { color: var(--green); animation: bounce-in .3s ease; }
.feedback.corrected { color: var(--orange); animation: bounce-in .3s ease; }
.feedback.bad { color: var(--orange-dark); }
.retry-feedback { min-height: 52px; }
@keyframes bounce-in { 0% { transform: scale(.8); opacity: .5; } 60% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* Speaker button */
.speaker-button {
  display: flex; align-items: center; justify-content: center;
  width: 128px; height: 128px; margin: 20px auto;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  color: var(--white);
  box-shadow: 0 8px 30px rgb(249 115 22 / 35%);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.speaker-button svg { width: 56px; height: 56px; }
.speaker-button:hover, .speaker-button:focus-visible {
  transform: scale(1.12);
  box-shadow: 0 12px 40px rgb(249 115 22 / 45%), 0 0 0 10px rgb(249 115 22 / 10%);
}
.speaker-button.playing {
  animation: speaker-pulse .6s ease infinite alternate;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--navy) 100%);
  box-shadow: 0 8px 30px rgb(67 56 202 / 35%);
}
@keyframes speaker-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

/* Word input */
.word-input-wrapper { margin: 8px auto 0; width: min(100%, 420px); }
.word-input {
  width: 100%; height: 76px; padding: 14px 20px;
  border: 3px solid var(--indigo-200); border-radius: 22px;
  background: var(--white); color: var(--navy);
  text-align: center; font-size: 2.2rem; font-weight: 900; letter-spacing: .08em;
  transition: border-color .15s, transform .15s;
}
.word-input::placeholder { color: var(--gray-light); font-weight: 400; font-size: 1rem; letter-spacing: 0; }
.word-input:focus { border-color: var(--orange); outline: none; transform: scale(1.01); }
.word-input.correct { border-color: var(--green); background: #ecfdf5; }
.word-input.corrected { border-color: var(--orange); background: #fff7ed; }
.word-input.incorrect { border-color: var(--orange-dark); background: #fff7ed; }
.word-input:disabled { cursor: not-allowed; }

/* Submit button (positioned below input) */
.submit-button { margin-top: 20px; min-width: 200px; font-size: 1.1rem; }

/* Result */
.result-card { max-width: 700px; margin: 30px auto; padding: 50px; border-radius: 32px; background: var(--white); text-align: center; box-shadow: var(--shadow); }
.result-badge { width: 90px; height: 90px; margin: 0 auto 24px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%); color: var(--white); font-size: 3rem; font-weight: 900; }
.result-score { margin: 22px 0 8px !important; color: var(--navy) !important; font-size: 2rem !important; font-weight: 900; }
.mail-status { min-height: 22px; margin-top: 10px !important; font-size: .88rem !important; font-weight: 800; }
.mail-status.sent { color: var(--green) !important; }
.mail-status.failed { color: var(--orange-dark) !important; }
.result-review { margin-top: 28px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; text-align: left; }
.review-row { padding: 13px 15px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; border: 2px solid var(--indigo-200); border-radius: 14px; background: #f9f8ff; }
.review-row.incorrect { border-color: var(--orange); background: #fff7ed; }
.review-row.corrected { border-color: var(--orange); background: #fff7ed; }
.review-row span:last-child { grid-column: 2; color: var(--gray-text); font-size: .82rem; }
.review-status { grid-row: 1 / 3; align-self: center; color: var(--green); font-size: 1.35rem; font-weight: 900; }
.review-row.incorrect .review-status { color: var(--orange-dark); }
.review-row.corrected .review-status { color: var(--orange); }
.result-actions { margin-top: 30px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Dictee */
.section-heading { margin-bottom: 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2, .admin-card h2 { margin: 0 0 8px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.05em; }
.section-heading p:not(.eyebrow), .admin-card > p { color: var(--gray-text); }
.settings-button { width: 58px; height: 58px; flex: 0 0 auto; display: grid; place-items: center; border: 2px solid var(--indigo-200); border-radius: 50%; background: var(--white); color: var(--navy); box-shadow: 0 8px 20px rgb(49 46 129 / 10%); }
.settings-button:hover { border-color: var(--orange); color: var(--orange-dark); transform: rotate(20deg); }
.settings-button svg { width: 28px; height: 28px; }
.dictee-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.dictee-date-card { min-height: 120px; padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 2px solid transparent; border-radius: 24px; background: var(--white); color: var(--navy); text-align: left; box-shadow: 0 8px 25px rgb(49 46 129 / 8%); }
.dictee-date-card:hover { border-color: var(--orange); transform: translateY(-4px); }
.dictee-date-card strong { display: block; font-size: 1.35rem; }
.dictee-date-card small { color: var(--gray-text); }
.empty-state { grid-column: 1 / -1; padding: 45px 24px; border: 2px dashed var(--indigo-200); border-radius: 24px; color: var(--gray-text); text-align: center; }
.dictee-player-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 22px; align-items: start; }
.admin-card { padding: 30px; border-radius: 28px; background: var(--white); box-shadow: var(--shadow); }
.compact-card { max-width: 540px; margin: 30px auto; }
.admin-card form, .admin-card label { display: block; }
.admin-card label { margin: 18px 0 7px; font-weight: 900; }
.admin-card label small { color: var(--gray-text); font-weight: 400; }
.admin-input { width: 100%; padding: 14px 16px; border: 2px solid var(--indigo-200); border-radius: 15px; background: var(--white); color: var(--navy); }
.admin-input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 4px rgb(249 115 22 / 12%); }
.admin-textarea { min-height: 210px; resize: vertical; line-height: 1.6; }
.form-message { min-height: 24px; margin: 12px 0 !important; color: var(--orange-dark) !important; font-size: .9rem !important; font-weight: 800; }
.form-message.success { color: var(--green) !important; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.download-progress { margin: 18px 0; }
.download-progress .progress-track { margin-bottom: 8px; }
.download-progress strong { color: var(--gray-text); font-size: .9rem; }
.admin-card h3 { margin-top: 0; font-size: 1.35rem; }
.admin-dictee-list { display: grid; gap: 10px; }
.admin-dictee-row { padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--gray-light); border-radius: 15px; }
.admin-dictee-row small { color: var(--gray-text); }
.admin-row-actions { display: flex; gap: 6px; }
.small-button { padding: 8px 10px; border: 0; border-radius: 9px; background: var(--indigo-200); color: var(--navy); font-weight: 900; }
.small-button.danger { background: #fee2e2; color: #b91c1c; }

:focus-visible { outline: 4px solid var(--orange-light); outline-offset: 3px; }

@media (max-width: 900px) {
  .screen { padding: 24px; }
  .topbar { padding: 20px 24px; }
  .hero { padding: 24px; }
  .hero-book { display: none; }
  .quiz-card { padding: 24px; }
  .result-card { padding: 30px 20px; }
  .result-review { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .level-grid { grid-template-columns: 1fr; }
  .level-card.featured { grid-column: 1; }
  .topbar { gap: 14px; }
  .topbar h1 { font-size: 1.5rem; }
  .dictee-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .admin-card { padding: 22px; }
}
