:root {
  color-scheme: light;
  --ink: #18202f;
  --muted: #647084;
  --line: #dfe4ec;
  --panel: #ffffff;
  --field: #f7f9fc;
  --accent: #19725f;
  --accent-dark: #115244;
  --danger-bg: #fff0f0;
  --danger: #9d2727;
  --success-bg: #ebf8ef;
  --success: #1e6b37;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #eef2f6;
}

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

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(24, 32, 47, 0.12);
}

.brand,
.topbar,
.topbar nav,
.stat-grid {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
}

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

.brand h1 {
  margin-bottom: 3px;
  font-size: 26px;
}

.brand p,
.section-head p,
.info-panel p {
  color: var(--muted);
  margin-bottom: 0;
}

.form-stack,
.panel-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

label span {
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus {
  outline: 3px solid rgba(25, 114, 95, 0.18);
  border-color: var(--accent);
}

select:focus,
textarea:focus {
  outline: 3px solid rgba(25, 114, 95, 0.18);
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.message {
  margin-bottom: 16px;
  padding: 12px 13px;
  border-radius: 6px;
  font-weight: 700;
}

.message.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.message.success {
  background: var(--success-bg);
  color: var(--success);
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.wordmark {
  font-weight: 800;
  letter-spacing: 0;
}

.topbar nav {
  flex-wrap: wrap;
  gap: 18px;
  font-weight: 700;
}

.topbar form {
  margin: 0;
}

.link-button {
  padding: 0;
  color: var(--accent);
  background: transparent;
}

.link-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.page {
  width: min(100% - 32px, 1040px);
  margin: 40px auto;
}

.page.narrow {
  width: min(100% - 32px, 560px);
}

.section-head {
  margin-bottom: 22px;
}

.section-head h1 {
  margin-bottom: 8px;
  font-size: 34px;
}

.stat-grid {
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.stat-grid article,
.info-panel,
.panel-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat-grid article {
  flex: 1 1 150px;
  min-height: 118px;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.stat-grid strong {
  font-size: 34px;
}

.stat-grid span {
  color: var(--muted);
  font-weight: 700;
}

.info-panel,
.panel-form {
  padding: 24px;
}

.info-panel h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf1f5;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel-form.compact {
  border: 0;
  padding: 0;
}

.grid-form label:has(textarea),
.grid-form button,
.panel-form h2,
.option-list,
.full-span {
  grid-column: 1 / -1;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.checkline input {
  width: auto;
}

.row-card,
.option-row {
  display: grid;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row-card {
  grid-template-columns: 1fr auto auto;
  padding: 16px;
}

.row-card div {
  display: grid;
  gap: 5px;
}

.row-card span,
small,
.eyebrow {
  color: var(--muted);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.button-link.secondary {
  background: #2f5877;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-row {
  grid-template-columns: 110px 1fr 120px;
  padding: 14px;
}

.learning-card {
  display: grid;
  gap: 18px;
}

.learning-card h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.32;
}

.choices,
.choice-form {
  display: grid;
  gap: 10px;
  margin: 0;
}

.choices {
  padding-left: 24px;
}

.choices li,
.answer-box,
.memory {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfd;
}

.choice-button {
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.choice-button:hover {
  background: #edf7f4;
  color: var(--ink);
}

mark {
  padding: 1px 4px;
  border-radius: 4px;
  background: #ffe08a;
  color: var(--ink);
}

.result-panel {
  display: grid;
  gap: 12px;
  text-align: center;
}

.result-panel strong {
  font-size: 44px;
}

.admin-shortcuts {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.json-box {
  min-height: 260px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.45;
}

.json-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.audio-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.audio-row {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 360px) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.audio-row div {
  display: grid;
  gap: 8px;
}

.audio-row span {
  color: var(--muted);
  font-size: 14px;
}

.audio-row audio {
  width: 100%;
}

.audio-meta-form {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
  align-items: end;
}

.audio-meta-form button {
  grid-column: 1 / -1;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #741919;
}

.question-image-preview,
.learning-image {
  margin: 0;
  display: grid;
  gap: 8px;
}

.question-image-preview img,
.learning-image img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-image-preview span {
  color: var(--muted);
  font-size: 14px;
}

.image-upload-form {
  margin-top: 16px;
}

@media (max-width: 680px) {
  .topbar,
  .topbar nav,
  .stat-grid {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 16px;
  }

  .two-col,
  .grid-form,
  .row-card,
  .option-row,
  .audio-row {
    grid-template-columns: 1fr;
  }
}
