:root {
  color-scheme: light;
  --ink: #173f35;
  --ink-soft: #557068;
  --paper: #fffdf8;
  --cream: #f3efe4;
  --line: #d9dfd8;
  --green: #2e765b;
  --green-pale: #e8f4ed;
  --red: #b43c41;
  --red-pale: #fff0f0;
  --gold: #d9a74f;
  --shadow: 0 24px 80px rgba(21, 55, 46, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(229, 189, 113, 0.22), transparent 25rem),
    radial-gradient(circle at 95% 90%, rgba(88, 144, 116, 0.18), transparent 30rem),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 24px;
  color: #87948f;
  font-size: 0.72rem;
  text-align: center;
}

.site-footer a { color: inherit; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--ink-soft); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dossier-select {
  position: relative;
  padding: 5px 2px;
  border: 0;
  border-radius: 4px;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.dossier-select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.results-button {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(23, 63, 53, 0.16);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.7);
  font-weight: 700;
}

.results-button span {
  padding: 5px 10px;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-size: 0.78rem;
}

.quiz-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(370px, 0.92fr);
  min-height: 690px;
  overflow: hidden;
  border: 1px solid rgba(23, 63, 53, 0.1);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.image-panel {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  padding: 18px;
  background: #dfe8e0;
}

.image-frame {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  place-items: center;
  border-radius: 20px;
  background: #ccd8cf;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 180ms ease;
}

.image-frame img.loaded { opacity: 1; }

.image-loader {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(23, 63, 53, 0.15);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.image-loader.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.answer-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 74px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

h1 { font-size: clamp(2.25rem, 4vw, 4rem); }
h2 { font-size: 2rem; }

.subtitle {
  margin: 15px 0 36px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.answer-block + .answer-block { margin-top: 25px; }

[hidden] { display: none !important; }

.choice-block { min-width: 0; margin: 25px 0 0; padding: 0; border: 0; }
.choice-block legend { margin-bottom: 9px; font-size: 0.86rem; font-weight: 800; }
.choice-options { display: grid; gap: 8px; }
.answer-block .choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}
.choice-option input { margin: 0; flex-shrink: 0; accent-color: var(--green); }
.choice-option:has(input:checked) { border-color: var(--green); background: var(--green-pale); }
.wrong .choice-option:has(input:checked) { border-color: var(--red); background: var(--red-pale); }
.revealed .choice-option:has(input:checked) { border-color: var(--gold); background: #fff9eb; }
.choice-option:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }

.answer-block label {
  display: block;
  margin-bottom: 9px;
  font-size: 0.86rem;
  font-weight: 800;
}

.input-wrap { position: relative; }

.input-wrap input {
  width: 100%;
  padding: 14px 48px 14px 15px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: white;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}

.input-wrap input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(46, 118, 91, 0.1);
}

.status-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  display: grid;
  width: 25px;
  height: 25px;
  transform: translateY(-50%);
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
}

.answer-block.correct input {
  border-color: var(--green);
  background: var(--green-pale);
}
.answer-block.correct .status-icon { background: var(--green); }
.answer-block.correct .status-icon::before { content: "✓"; }

.answer-block.wrong input {
  border-color: var(--red);
  background: var(--red-pale);
}
.answer-block.wrong .status-icon { background: var(--red); }
.answer-block.wrong .status-icon::before { content: "×"; }

.answer-block.revealed input {
  border-color: var(--gold);
  background: #fff9eb;
}
.answer-block.revealed .status-icon { color: #765618; background: #f1d695; }
.answer-block.revealed .status-icon::before { content: "i"; font-family: Georgia, serif; }

.feedback {
  min-height: 19px;
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.79rem;
}
.correct .feedback { color: var(--green); }
.wrong .feedback { color: var(--red); }

.field-actions {
  display: flex;
  gap: 10px;
  margin-top: 9px;
}

.check-button, .reveal-button {
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 800;
}

.check-button { border: 0; color: white; background: var(--green); }
.reveal-button { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.check-button:disabled, .reveal-button:disabled { cursor: default; opacity: 0.45; }

.next-button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  margin-top: 34px;
  padding: 16px 19px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--ink);
  font-weight: 800;
}

button { transition: transform 120ms ease, opacity 120ms ease, background 120ms ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }

dialog {
  position: relative;
  width: min(760px, calc(100% - 30px));
  height: min(780px, calc(100vh - 30px));
  height: min(780px, calc(100dvh - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 100px rgba(9, 35, 28, 0.35);
}

dialog::backdrop { background: rgba(17, 42, 35, 0.65); backdrop-filter: blur(4px); }
dialog[open] { display: flex; flex-direction: column; }
.dialog-header, .dialog-note, .dialog-actions { flex-shrink: 0; }

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 30px 16px;
}

.close-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  font-size: 1.5rem;
}

.dialog-note { margin: 0; padding: 0 30px 20px; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.5; }
.table-wrap { flex: 1; min-height: 0; overflow: auto; border-block: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; border-bottom: 1px solid #e9ece7; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; z-index: 1; color: var(--ink-soft); background: #f5f4ed; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
td { font-size: 0.87rem; }
.result-correct td { background: rgba(46, 118, 91, 0.09); }
.result-correct td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.result-wrong td { background: rgba(180, 60, 65, 0.09); }
.result-wrong td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.flower-cell strong { display: block; }
.flower-cell span { display: block; margin-top: 2px; color: var(--ink-soft); font-family: Georgia, serif; font-size: 0.78rem; font-style: italic; }
.flower-link {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}
.flower-link:hover strong { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 20px 30px 26px; }
.reset-button, .done-button { padding: 11px 16px; border-radius: 10px; font-weight: 800; }
.reset-button { border: 1px solid #ecc9c9; color: var(--red); background: transparent; }
.done-button { border: 0; color: white; background: var(--ink); }

.image-viewer {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: auto;
  padding: 28px 30px 32px;
  background: var(--paper);
}

.viewer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.viewer-header h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.viewer-header p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.viewer-header p.common-only { font-family: inherit; font-size: 0.82rem; font-style: normal; }

.viewer-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.viewer-images img {
  width: 100%;
  height: 520px;
  object-fit: contain;
  border-radius: 16px;
  background: #e5ebe5;
}

@media (max-width: 800px) {
  .app-shell { width: min(100% - 22px, 620px); padding-top: 16px; }
  .topbar { margin-bottom: 14px; }
  .quiz-card { grid-template-columns: 1fr; }
  .image-panel { min-height: auto; }
  .image-frame { height: min(54vh, 440px); flex: none; }
  .answer-panel { padding: 34px 24px 30px; }
  h1 { font-size: 2.35rem; }
  .subtitle { margin-bottom: 28px; }
}

@media (max-width: 470px) {
  .brand-group { flex-direction: column; align-items: flex-start; gap: 2px; }
  .results-button { padding-left: 13px; font-size: 0.82rem; }
  .brand { font-size: 1.25rem; }
  .image-frame { height: 42vh; min-height: 280px; }
  .dialog-header, .dialog-actions { padding-inline: 18px; }
  .dialog-note { padding-inline: 18px; }
  th, td { padding-inline: 12px; }
  .image-viewer { padding: 22px 18px; }
  .viewer-images { grid-template-columns: 1fr; }
  .viewer-images img { height: min(55vh, 460px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: 1ms !important; }
}

/* A single column keeps the course image above the name and description. */
.app-shell, .site-footer { width: min(760px, calc(100% - 32px)); }
.quiz-card { display: flex; flex-direction: column; min-height: 0; }
.image-panel { min-height: 0; padding: 16px; }
.image-frame { flex: none; height: clamp(240px, 42vh, 400px); background: white; }
.image-frame img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: 100%; }
.answer-panel { padding: 30px clamp(22px, 5vw, 48px) 34px; }
h1 { font-size: clamp(2.2rem, 6vw, 3rem); }
.subtitle { margin: 12px 0 20px; font-size: 0.9rem; }
.tool-description { margin: 24px 0 0; color: var(--ink-soft); line-height: 1.6; white-space: pre-line; }
.next-button { margin-top: 24px; }
#viewer-image { display: block; width: 100%; height: min(52vh, 420px); object-fit: contain; background: white; border-radius: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 470px) {
  .brand { font-size: 1.15rem; gap: 7px; }
  .results-button { gap: 7px; padding: 9px 10px; }
  .image-frame { height: 34vh; min-height: 220px; }
}
