/* Shared presentation for the exercises, the domus and the translation workshop. */
:root {
  --ux-ink: #302d29;
  --ux-wine: #762d25;
  --ux-wine-dark: #51221c;
  --ux-ochre: #a47a38;
  --ux-line: #e2d7c6;
  --ux-cream: #fffaf2;
  --ux-sage: #edf3e8;
  --ux-green: #405e3a;
  --ux-blue: #20536c;
  --ux-shadow: 0 8px 26px rgb(74 48 24 / 6%);
  --ink: var(--ux-ink);
  --wine: var(--ux-wine);
  --wine-dark: var(--ux-wine-dark);
  --line: var(--ux-line);
  --paper: #fffdf9;
}

html { background: #fff; scroll-padding-top: 20px; }
body { background: #fff; color: var(--ux-ink); }
main, .main-wrap { min-width: 0; }
img { max-width: 100%; }
button, select, input, textarea { max-width: 100%; }
button:not(.marker):not(.plan-marker), select { min-height: 44px; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ux-blue);
  outline-offset: 4px;
}
button:disabled { cursor: default; }
.skip { z-index: 80; }
.mosaic { height: 7px; border-width: 1px; }

/* One recognizable header, with a compact but usable phone layout. */
.topbar {
  display: grid;
  grid-template-columns: auto minmax(170px, 220px) minmax(0, 1fr);
  gap: 18px 26px;
  align-items: center;
  max-width: 1480px;
  margin: 0 auto 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--ux-line);
  background: #fff;
}
.topbar > .brand {
  grid-column: 1;
  grid-row: 1;
  order: initial;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  color: var(--ux-wine-dark);
  text-align: left;
  font-size: 1.1rem;
  letter-spacing: .055em;
  line-height: 1.2;
  white-space: nowrap;
}
.topbar > .brand :is(small, span) {
  color: #65584b;
  font-size: .7rem;
  letter-spacing: .01em;
  margin-top: 4px;
}
.topbar > :is(.country-picker, .country-switch, .top-left) {
  grid-column: 2;
  grid-row: 1;
  order: initial;
  width: auto;
  min-width: 0;
  margin: 0;
  gap: 5px;
  color: #65584b;
  font-size: .72rem;
  font-weight: 700;
  text-align: left;
  white-space: normal;
}
.topbar > .top-left { display: flex; flex-direction: column; align-items: stretch; }
.topbar :is(.country-picker, .country-switch, .top-left) select {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  padding: 8px 26px 8px 11px;
  border: 1px solid #c4b397;
  border-radius: 8px;
  background: var(--ux-cream);
  color: var(--ux-ink);
  font-size: .8rem;
  font-weight: 600;
}
.topbar > :is(nav, .top-tools) {
  grid-column: 3;
  grid-row: 1;
  order: initial;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  font-size: .8rem;
  text-align: left;
}
.topbar nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  font-weight: 700;
}
.topbar nav .game-home, .analyzer-nav, .topbar .subtle-btn {
  min-height: 44px;
  border: 1px solid #d6c8b4;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ux-wine-dark);
  padding: 9px 12px;
  font-size: .8rem;
  text-align: center;
}
.topbar nav .game-home { flex: 0 1 auto; }
.topbar .size-control { background: #faf7f1; border-color: var(--ux-line); border-radius: 8px; }
.topbar .size-control button { color: var(--ux-wine-dark); }

/* Bright, calm introductions retain the existing Roman artwork. */
.hero {
  padding: clamp(24px, 3.5vw, 42px);
  gap: 28px;
  border: 1px solid #d8c3a0;
  border-radius: 22px;
  background: var(--ux-cream);
  box-shadow: var(--ux-shadow);
  margin: 8px 0 28px;
}
.hero .home-intro, .hero > div:first-child { text-align: center; }
.hero h1 { color: var(--ux-wine-dark); text-align: center; text-wrap: balance; }
.hero h1 span { color: #5c4938; font-weight: 600; }
.hero p { margin-left: auto; margin-right: auto; color: #5a5147; }
.hero .eyebrow, .intro .eyebrow { color: var(--ux-wine); }
.hero .hero-art {
  transform: none;
  border: 1px solid #bb9361;
  outline: none;
  border-radius: 12px;
  box-shadow: none;
  background: #f5ead7;
  max-height: none;
  object-fit: contain;
}
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.hero-actions > * { flex: 0 1 auto; }
.hero-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; text-decoration: none; }
.home-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin-top: 22px; color: #66533b; font-size: .78rem; }
.home-stats span { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 5px; }
.home-stats strong { color: var(--ux-wine-dark); }
.hero-tag { border-radius: 7px; }
.intro {
  max-width: none;
  margin: 0 auto 26px;
  padding: 22px 24px 26px;
  border: 1px solid var(--ux-line);
  border-radius: 16px;
  background: var(--ux-cream);
  box-shadow: none;
  text-align: center;
}
.intro h1 { color: var(--ux-wine-dark); text-align: center; text-wrap: balance; }
.intro > p { margin-left: auto; margin-right: auto; max-width: 950px; }
.intro .rules { text-align: left; max-width: 950px; margin-left: auto; margin-right: auto; }
.intro .rules > summary { text-align: center; min-height: 44px; padding: 11px 4px; }

/* Training entries and secondary activities have different visual weights. */
.learning-section { margin-top: 28px; }
.learning-section .section-heading { display: block; text-align: center; margin: 26px 0 20px; }
.learning-section .section-heading h2 { color: var(--ux-wine-dark); font-size: 1.45rem; }
.learning-section .section-heading p { margin: 8px auto 0; max-width: 760px; text-align: center; }
.module-grid { gap: 16px; }
.module-card {
  border: 1px solid #d4bea0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 3px 0 rgb(139 101 56 / 9%);
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 7px 18px rgb(84 53 28 / 10%); }
.module-card:last-child { background: #f3f6ee; border-color: #afbf9a; }
.module-card > img, .module-card > .latin-art-frame { border-bottom: 1px solid #dbc8a8; }
.module-card .module-copy { gap: 10px; padding: 17px; }
.module-card h3 { color: var(--ux-wine-dark); line-height: 1.3; }
.module-card .module-bottom { color: #526349; border-color: #eadfce; }
.module-step { display: block; color: #7a623f; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.module-status { display: block; color: var(--ux-green); font-size: .74rem; font-weight: 600; line-height: 1.4; }
.activities-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 22px 0 28px; }
.activity-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--ux-line); border-radius: 15px; background: #fff; overflow: hidden; box-shadow: var(--ux-shadow); }
.activity-card > img { display: block; width: 100%; aspect-ratio: 16 / 8; height: auto; object-fit: cover; border-bottom: 1px solid var(--ux-line); }
.activity-card > .latin-art-frame { border-bottom: 1px solid var(--ux-line); }
.activity-copy { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; padding: 22px; }
.activity-copy h3 { color: var(--ux-wine-dark); font-size: 1.18rem; line-height: 1.3; }
.activity-copy p { color: #61574b; font-size: .87rem; line-height: 1.6; }
.activity-link { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; margin-top: auto; padding: 11px 15px; border: 1px solid #c4b18e; border-radius: 8px; background: #fbf7ed; color: var(--ux-wine-dark); text-decoration: none; font-size: .87rem; font-weight: 700; }
.activity-link:hover { background: #f1e7d5; border-color: var(--ux-ochre); }
.learning-help { border: 1px solid #d2ddc4; border-radius: 12px; background: #f7faf3; margin: 24px 0; padding: 3px 20px 12px; }
.learning-help > summary { min-height: 44px; padding: 14px 0 8px; font-weight: 700; color: var(--ux-green); }
.learning-help p { margin: 12px 0; font-size: .88rem; line-height: 1.65; }
.home-note { background: var(--ux-sage); border-color: #c6d2b9; border-left-color: #6a8054; }
.resume-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 18px 22px; margin: 20px 0 26px; border: 1px solid #cfbd9b; border-left: 5px solid var(--ux-ochre); border-radius: 11px; background: #fffaf0; }
.resume-copy { flex: 1 1 220px; min-width: 0; }
.resume-copy h2, .resume-copy h3, .resume-copy strong { color: var(--ux-wine-dark); font-size: 1rem; }
.resume-copy p { color: #625343; font-size: .84rem; margin-top: 5px; }
.resume-banner button { flex: 0 1 auto; }
.progress-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 24px; padding: 14px 18px; margin: 20px 0; border-block: 1px solid var(--ux-line); color: #5d6656; font-size: .8rem; text-align: center; }
.progress-summary p { margin: 0; }
.progress-summary button { font-size: .8rem; }

/* Exercise and memo focus. */
.ready, .quiz-panel, .result { border-width: 1px; box-shadow: var(--ux-shadow); }
.ready { background: #fffdf9; }
.ready-copy h1 { text-align: center; }
.ready-illustration { background: #faf3e6; }
.quiz-layout { gap: 22px; }
.quiz-body .sentence-panel { background: #fcf7ed; border-color: #dfcba9; }
.quiz-body .choice { min-height: 58px; border-radius: 10px; line-height: 1.45; }
.quiz-body .choice > span:not(.choice-letter):not(.choice-symbol) { min-width: 0; overflow-wrap: anywhere; }
.quiz-body .choice:not(.correct):not(.wrong) { background: #f7fafb; }
.quiz-body .choice:hover:not(:disabled) { border-color: var(--ux-blue); background: #edf4f6; }
.feedback { scroll-margin-block: 24px; line-height: 1.65; }
.feedback p { overflow-wrap: anywhere; }
.memo { border-width: 1px; border-radius: 13px; background: #fffdf8; }
.memo h2 { text-align: center; color: var(--ux-wine-dark); margin-bottom: 18px; }
.memo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.memo-actions > * { flex: 0 1 auto; }
.manipulations { padding: 18px 20px; margin: 22px 0; border: 1px solid #b8c9aa; border-left: 4px solid #667e50; border-radius: 9px; background: #f4f8ee; }
.manipulations h3 { color: var(--ux-green); font-size: 1.1rem; margin-bottom: 12px; }
.manipulations p { font-size: .92rem; line-height: 1.7; }
.manipulations p + p { margin-top: 13px; }
.table-wrap, .table-scroll { max-width: 100%; overscroll-behavior-inline: contain; }
.table-wrap caption { line-height: 1.5; }
.result-content > h2 { color: var(--ux-wine-dark); }
.review-item { border-color: var(--ux-line); }
.review-item summary { line-height: 1.5; }

/* Harmonize the house activities without changing their scale or hit areas. */
.plan-card, .puzzle-card, .room-panel, .notebook-group, .hypothesis, .vocabulary, .all-words {
  min-width: 0;
  border-width: 1px;
  border-color: #d8cbb7;
  border-radius: 13px;
  box-shadow: none;
}
.plan-card, .puzzle-card, .room-panel { background: #fffdf8; }
.plan-card, .puzzle-card { box-shadow: var(--ux-shadow); }
.plan-card h2, .puzzle-card h2, .room-panel h2 { color: var(--ux-wine-dark); }
.room-illustration, .room-art { border-width: 1px; border-color: #cdb594; border-radius: 10px; }
.progress-card, .casebar { background: #f1f5eb; border: 1px solid #cbd7bc; border-radius: 11px; padding: 16px 20px; }
.casebar { margin-top: 20px; }
.progress-card strong, .casebar strong { color: var(--ux-green); }
.marker, .plan-marker { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
.map-scroll, .plan-scroll { overscroll-behavior-inline: contain; }
.places > summary { min-height: 44px; padding-block: 10px; }
.room-list button { min-height: 52px; }
.clue-quiz legend { font-size: .9rem; }
.clue-quiz label { min-height: 44px; align-items: center; font-size: .86rem; padding: 10px 12px; }
.clue-quiz .quiz-feedback:not(:empty) { font-size: .85rem; line-height: 1.6; }
.clue-result { font-size: .85rem; line-height: 1.6; }
.notebook-choices, .evidence-list, .word-help { min-width: 0; }
.note-option > :not(.mark) { min-width: 0; overflow-wrap: anywhere; }
.back-to-plan { min-height: 44px; padding: 12px 0; }

/* The analysis workshop keeps its functional blue; backgrounds match the games. */
.search-panel { background: #f8faf6; border-radius: 13px; border-color: #c4d0bb; border-top-color: var(--ux-green); }
.word-detail { border-radius: 13px; }
.word-header { background: #f7f3ea; }
.translation-help { border-radius: 13px; background: #f6f8f1; border-color: #dce3d4; }
.start-help > div { background: #fffaf2; border: 1px solid var(--ux-line); border-radius: 11px; padding: 21px; }
.start-help h2 { color: var(--ux-wine-dark); }
.search-panel, .analysis-layout, .start-help { min-width: 0; }
.word-detail, .translation-help, .start-help > div { min-width: 0; }
footer { background: #faf7f1; color: #62584c; border-top: 1px solid var(--ux-line); line-height: 1.65; }
footer summary { min-height: 44px; padding-block: 10px; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: minmax(0, 1fr) minmax(170px, 240px); gap: 12px 24px; }
  .topbar > :is(nav, .top-tools) { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .topbar > .brand { text-align: left; }
  .activities-grid { gap: 16px; }
  .activity-copy { padding: 18px; }
}
@media (max-width: 740px) {
  .topbar { margin-bottom: 10px; padding: 14px 18px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 25px 22px; border-radius: 17px; }
  .hero .hero-art { width: min(100%, 520px); margin: 0 auto; max-height: none; object-fit: contain; }
  .hero h1 { font-size: clamp(1.9rem, 7vw, 2.7rem); }
  .hero p { max-width: 580px; }
  .hero-actions > * { flex: 1 1 170px; }
  .home-stats { gap: 7px 14px; }
  .intro { padding: 22px 18px; }
  .intro h1 { font-size: clamp(1.85rem, 7vw, 2.6rem); }
  .activities-grid { grid-template-columns: 1fr; gap: 18px; }
  .activity-card { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(0, 1fr); }
  .activity-card > img { height: 100%; aspect-ratio: auto; object-fit: cover; border-bottom: 0; border-right: 1px solid var(--ux-line); }
  .activity-card > .latin-art-frame { align-self: center; }
  .activity-copy { padding: 20px; }
  .learning-section .section-heading { margin: 24px 0 18px; }
  .learning-section .section-heading .quiet { max-width: none; font-size: .86rem; }
  .quiz-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, .5fr); gap: 10px; align-items: stretch; }
  .quiz-side .score-box { grid-column: 1; padding: 11px 13px; margin: 0; min-width: 0; }
  .quiz-side .score-line { display: flex; gap: 7px; font-size: .8rem; line-height: 1.4; margin: 2px 0; }
  .quiz-side .score-line strong { font-size: 1.05rem; }
  .quiz-side .memo-button { grid-column: 2; align-self: stretch; min-width: 0; margin: 0; padding: 10px; font-size: .82rem; line-height: 1.4; }
  .quiz-side .progress-track { margin: 8px 0 0; }
  .quiz-layout { gap: 14px; }
  .quiz-body .choice { min-height: 55px; padding: 13px; font-size: 1rem; }
  .quiz-body .sentence { font-size: 1.4rem; }
  .memo-actions > * { flex: 1 1 180px; width: auto; }
  .ready-copy { padding: 23px; }
  .progress-card, .casebar { padding: 14px 16px; }
}
@media (max-width: 600px) {
  .topbar { grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 12px; padding: 14px 16px; }
  .topbar > .brand { width: auto; font-size: 1rem; }
  .topbar > :is(.country-picker, .country-switch, .top-left) { width: auto; align-items: stretch; font-size: .66rem; }
  .topbar :is(.country-picker, .country-switch, .top-left) select { font-size: .76rem; }
  .topbar > nav { width: 100%; flex-direction: row; gap: 6px 12px; justify-content: center; margin: 0; }
  .topbar > nav .game-home { flex: 0 1 auto; font-size: .78rem; }
  .topbar > nav a:not(.game-home) { min-height: 44px; font-size: .78rem; }
  .topbar > .top-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; width: 100%; margin: 0; }
  .top-tools > * { width: 100%; min-width: 0; justify-content: center; }
  .topbar .size-control { justify-content: center; padding: 0 4px; }
  .topbar .size-control button { flex: 1; }
  .topbar .share-text { display: inline; }
  .topbar .share-btn { font-size: .76rem; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .module-card .module-copy { padding: 13px; }
  .module-card h3 { min-height: 0; font-size: 1rem; }
  .module-card p { font-size: .8rem; }
  .module-card .module-bottom { gap: 5px; font-size: .7rem; }
  .activity-card { display: flex; }
  .activity-card > img { height: auto; aspect-ratio: 16 / 8; border-right: 0; border-bottom: 1px solid var(--ux-line); }
  .activity-copy { padding: 21px; }
  .resume-banner { padding: 17px; }
  .resume-banner button { flex: 1 1 100%; width: 100%; }
  .resume-copy { flex-basis: 100%; }
  .progress-summary { gap: 7px 14px; padding: 12px; }
  .progress-card button, .casebar .quiet-button { font-size: .83rem; }
  .casebar .progress-wrap { min-width: 0; max-width: 100%; }
  .marker, .plan-marker { width: 44px; height: 44px; }
  .room-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clue-quiz label { font-size: .9rem; }
  .start-help > div { padding: 20px; }
  .learning-help, .manipulations { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 410px) {
  .module-grid { grid-template-columns: 1fr; }
  .module-card .module-copy { padding: 17px; }
  .module-card h3 { font-size: 1.1rem; }
  .module-card p { font-size: .88rem; }
  .module-step { font-size: .72rem; }
  .topbar > .brand :is(small, span) { display: block; font-size: .62rem; }
  .hero { padding: 22px 17px; }
  .hero-actions { gap: 9px; }
  .quiz-top { align-items: baseline; gap: 7px; }
  .quiz-top .counter { white-space: nowrap; }
  .quiz-side .score-box { padding: 10px; }
  .quiz-side .memo-button { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  @page { margin: 15mm; }
  html, body { background: #fff !important; }
  .topbar, .mosaic, .resume-banner, .progress-summary, .toast, .memo-actions, .skip { display: none !important; }
  .hero, .ready, .quiz-panel, .result, .memo, .plan-card, .puzzle-card, .activity-card { box-shadow: none; }
  main, .main-wrap { max-width: none; margin: 0; padding: 0 !important; }
  body.print-memo > :not(main), body.print-memo main > :not(#memo) { display: none !important; }
  body.print-memo #memo { display: block !important; border: 0; padding: 0; margin: 0; }
  body.print-memo .table-wrap { overflow: visible; }
  body.print-memo table { min-width: 0; width: 100%; }
  body.print-memo .noun-selector { margin: 15px 0; }
  body.print-memo .manipulations, body.print-memo tr { break-inside: avoid; }
  body.print-result > :not(main), body.print-result main > :not(.result) { display: none !important; }
  body.print-result .result { border: 0; }
  body.print-result .result-top, body.print-result .result-content { padding: 10px 0; }
  body.print-result .result-top { display: block; }
  body.print-result .result-top img, body.print-result .result-top .latin-art-frame, body.print-result .actions { display: none !important; }
  body.print-result .review-item { break-inside: avoid; border: 1px solid #bbb; margin: 12px 0; }
  body.print-result .review-item .review-detail { display: block !important; }
  body.print-result .review-item::details-content { content-visibility: visible; display: block; }
  body.print-result .review-question, body.print-result .review-sentence { display: block; }
  body.print-result .result-number { font-size: 2rem; }
}
