/* V1-UI-001 — production visual layer derived from the approved Limassol v2 HTML.
   The production curriculum and engine remain in content.js and engine.js. */

:root {
  --paper: #fbf4df;
  --card: #fffdf5;
  --white: #fffefa;
  --ink: #20343e;
  --muted: #4d6059;
  --line: #d7d2bf;
  --blue: #087bb3;
  --blue-deep: #056293;
  --pale: #e3f3fa;
  --leaf: #dceba9;
  --leaf-strong: #4d7841;
  --leaf-soft: #eff5de;
  --sun: #f7c94b;
  --sun-soft: #fff2c2;
  --pink: #d9427d;
  --pink-ink: #9b1f52;
  --pink-soft: #ffe9ef;
  --terracotta: #d87948;
  --terracotta-ink: #93411f;
  --green: #376d36;
  --greenbg: #e8f3c8;
  --red: #98234f;
  --redbg: #ffe9ef;
  --bg: var(--paper);
  --radius: 18px;
  --outline: 2px solid var(--ink);
  --hard-shadow: 4px 4px 0 var(--ink);
  --soft-shadow: 3px 3px 0 #d9cfaa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --display: "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: absolute;
  z-index: 20;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--blue) 0 40%, var(--sun) 40% 64%, var(--leaf-strong) 64% 83%, var(--pink) 83% 100%);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
summary {
  touch-action: manipulation;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
  opacity: 1;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 4px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
}

p,
h1,
h2,
h3,
h4,
li,
.answer,
.wordrow,
.route-card,
.minicards button,
.progress-row {
  overflow-wrap: break-word;
}

.shell {
  width: min(1220px, calc(100% - 64px));
  max-width: none;
  margin-inline: auto;
  padding: 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 23px;
  border-bottom: 2px solid var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 50px;
  height: 50px;
  flex: none;
  border: var(--outline);
  border-radius: 13px !important;
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-4deg);
}

.brand > div {
  min-width: 0;
}

.brand > div::after {
  content: "LIMASSOL EDITION";
  display: inline-block;
  margin-top: 6px;
  color: var(--blue-deep);
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand h1 {
  margin: 0;
  font: 800 1.375rem/1.25 var(--display);
  letter-spacing: -.025em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.5;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.tabs button {
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition: background .14s ease, transform .14s ease, box-shadow .14s ease;
}

.tabs button:hover {
  background: #eee7d2;
}

.tabs button.active {
  border-color: var(--ink);
  background: var(--blue);
  color: white;
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.rankbar {
  margin: 25px 0 27px;
  padding: 17px 21px;
  display: flex;
  align-items: center;
  gap: 17px;
  border: var(--outline);
  border-radius: 16px;
  background: var(--leaf-soft);
  box-shadow: 3px 3px 0 #cad59d;
}

.rankicon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  border: var(--outline);
  border-radius: 50%;
  background: var(--leaf);
  font-size: 2rem;
}

.rankcopy {
  flex: 1;
  min-width: 0;
}

.rankcopy b {
  font: 800 1.25rem/1.35 var(--display);
  letter-spacing: -.02em;
}

.rankcopy p {
  margin: 4px 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.55;
}

progress {
  display: block;
  width: 100%;
  height: 10px;
  margin: 10px 0;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #e2e5d4;
  accent-color: var(--leaf-strong);
}

progress::-webkit-progress-bar {
  background: #e2e5d4;
}

progress::-webkit-progress-value {
  background: var(--leaf-strong);
}

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  margin: 0 0 50px;
}

.sidebar {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: var(--outline);
  border-radius: 15px;
  background: #f5ecd4;
  box-shadow: var(--soft-shadow);
}

.settings-panel {
  border: 0;
}

.settings-summary {
  display: none;
  min-height: 54px;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-panel[open] .settings-summary > span:last-child {
  transform: rotate(180deg);
}

.settings-inner {
  padding: 20px 17px 16px;
}

.label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.courses {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 14px;
}

.courses button {
  min-width: 0;
  min-height: 48px;
  padding: 9px 0;
  border: var(--outline);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 2px 0 #d7cfba;
  font-size: 1rem;
  font-weight: 800;
}

.courses button:hover {
  background: var(--sun-soft);
}

.courses button.active {
  background: var(--blue);
  color: white;
  box-shadow: 2px 2px 0 var(--ink);
  transform: translateY(-1px);
}

.course-note {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.55;
}

.course-note strong {
  color: var(--ink);
  font-size: 1rem;
}

.course-note p {
  margin: 5px 0 0;
}

.theme-control {
  display: block;
  margin: 18px 0 21px;
  font-size: .9375rem;
  font-weight: 700;
}

select,
.dictsearch,
input.answer-input {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  border: var(--outline);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

select {
  margin-top: 8px;
  padding: 10px 34px 10px 12px;
}

.topics {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topic {
  width: 100%;
  min-height: 48px;
  padding: 10px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 1rem;
  line-height: 1.45;
}

.topic:hover {
  background: #ebe1c7;
}

.topic.active {
  border-color: var(--ink);
  background: var(--blue);
  color: white;
  font-weight: 750;
  box-shadow: 2px 2px 0 var(--ink);
}

.side-rule {
  height: 1px;
  margin: 22px 0 16px;
  background: #d8cdb3;
}

.side-note {
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.65;
}

.side-note::before {
  content: "";
  display: block;
  width: 58px;
  height: 5px;
  margin-bottom: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue) 0 30%, transparent 30% 35%, var(--sun) 35% 65%, transparent 65% 70%, var(--pink) 70% 100%);
}

.side-note strong {
  color: var(--ink);
}

main {
  min-width: 0;
}

.lesson-hero {
  position: relative;
  margin-bottom: 18px;
  padding: 24px 26px;
  border: var(--outline);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--hard-shadow);
}

.lesson-hero::before,
.card::before {
  content: "";
  position: absolute;
  top: -2px;
  right: 24px;
  left: 24px;
  height: 5px;
  border: 1.5px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--blue) 0 58%, var(--sun) 58% 78%, var(--pink) 78% 100%);
}

.lesson-hero h2 {
  margin: 14px 0 10px !important;
  font: 800 1.875rem/1.3 var(--display);
  letter-spacing: -.025em;
}

.lesson-hero p,
.legend {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--pale);
  color: var(--blue-deep);
  font-size: .875rem;
  font-weight: 800;
  line-height: 1.4;
}

.card {
  position: relative;
  padding: 27px 29px 23px;
  border: var(--outline);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 5px 5px 0 var(--ink);
}

.card h2 {
  font-size: 1.75rem;
  line-height: 1.3;
}

.card h3 {
  font-size: 1.25rem;
  line-height: 1.4;
}

.cardtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.5;
}

.modegrid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0;
}

.modegrid button,
.primary,
.secondary {
  min-height: 48px;
  padding: 10px 14px;
  border: var(--outline);
  border-radius: 9px;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.4;
  box-shadow: 2px 2px 0 var(--ink);
  transition: background .14s ease, transform .14s ease, box-shadow .14s ease;
}

.modegrid button,
.secondary {
  background: var(--card);
}

.modegrid button:hover,
.secondary:hover,
.primary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.modegrid button.active {
  background: var(--sun);
  color: var(--ink);
}

.primary {
  background: var(--blue);
  color: white;
}

.secondary {
  margin: 2px 3px 6px 0;
}

.primary:active,
.secondary:active,
.modegrid button:active,
.answer:active:not(:disabled),
.token:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.textbtn {
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.textbtn:hover {
  color: var(--blue-deep);
}

.checkline {
  min-height: 44px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.checkline input {
  width: 22px;
  height: 22px;
  flex: none;
  accent-color: var(--blue);
}

.score-note,
.save {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}

.save {
  min-height: 23px;
  margin: 18px 3px 0;
}

.save::before {
  content: "✓ ";
  color: var(--leaf-strong);
  font-weight: 800;
}

.save.error {
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  border-left: 5px solid var(--pink);
  border-radius: 9px;
  background: var(--pink-soft);
  color: var(--pink-ink);
}

.save.error::before {
  content: "! ";
  color: var(--pink-ink);
}

.qtitle {
  margin: 12px 0 19px;
  font: 800 1.625rem/1.35 var(--display);
  letter-spacing: -.025em;
  outline: 0;
}

.scene-frame {
  position: relative;
  margin: 20px 0 18px;
  padding: 22px 23px;
  border: var(--outline);
  border-radius: 12px;
  background: var(--pale);
  box-shadow: 3px 3px 0 #bedce7;
}

.scene-frame::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 27px;
  width: 13px;
  height: 13px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--pale);
  transform: rotate(45deg);
}

.scene-frame .greek-prompt,
.greek-prompt {
  margin: 0;
  color: var(--ink);
  font: 2.25rem/1.45 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.gap {
  display: inline-block;
  min-width: 3em;
  margin: 0 4px;
  border-bottom: 3px solid var(--blue);
  color: var(--blue-deep);
  text-align: center;
}

.response-cue,
.glossary,
.translation {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.response-cue {
  margin: 0 0 14px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.answer {
  position: relative;
  min-width: 0;
  min-height: 68px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: var(--outline);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 2px 2px 0 #d8d2bf;
  text-align: left;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5;
  transition: background .14s ease, transform .14s ease, box-shadow .14s ease;
}

.answer:hover:not(:disabled) {
  background: var(--sun-soft);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.answer .number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1.5px solid #b7c2bf;
  border-radius: 5px;
  background: #f0f4ef;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
}

.answer .value,
.answer.long .value {
  min-width: 0;
  font-size: inherit;
  line-height: inherit;
  overflow-wrap: break-word;
}

.answer.good {
  background: var(--leaf);
  box-shadow: 2px 2px 0 var(--leaf-strong);
}

.answer.good .number {
  border-color: var(--ink);
  background: var(--leaf-strong);
  color: white;
}

.answer.good::after,
.answer.bad::after {
  flex: none;
  padding: 3px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: .875rem;
  font-weight: 800;
  line-height: 1.3;
}

.answer.good::after {
  content: "✓ Верно";
  color: #315f32;
}

.answer.bad {
  background: var(--pink-soft);
  box-shadow: 2px 2px 0 var(--pink);
}

.answer.bad .number {
  border-color: var(--ink);
  background: var(--pink-ink);
  color: white;
}

.answer.bad::after {
  content: "× Ответ";
  color: var(--pink-ink);
}

.answer.muted {
  background: #f2f0e6;
  color: var(--muted);
  box-shadow: none;
  opacity: 1;
}

.type-row {
  display: flex;
  align-items: stretch;
  gap: 11px;
}

input.answer-input {
  min-width: 0;
  padding: 12px 15px;
  background: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

input.answer-input:disabled {
  background: #f2f0e6;
  color: var(--muted);
}

.token-area {
  min-height: 68px;
  margin: 13px 0;
  padding: 13px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 9px;
  border: 2px dashed #9eaa9f;
  border-radius: 12px;
  background: #faf7e9;
}

.token {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: var(--outline);
  border-radius: 8px;
  background: var(--pale);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 1.125rem;
}

.keyboard {
  margin-top: 18px;
}

.keyboard summary,
.reference summary,
.progress summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.5;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.keys button {
  min-width: 44px;
  min-height: 44px;
  border: var(--outline);
  border-radius: 7px;
  background: var(--card);
  box-shadow: 2px 2px 0 #d8d2bf;
  font-size: 1.125rem;
}

.hintbox {
  margin: 16px 0;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-left: 5px solid var(--sun);
  border-radius: 9px;
  background: var(--sun-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.hintbox small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .875rem;
}

.feedback {
  margin-top: 20px;
  padding: 17px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--sun-soft);
  font-size: 1rem;
  line-height: 1.65;
  animation: limassol-appear .18s ease;
}

.feedback.correct {
  border-left: 6px solid var(--leaf-strong);
  background: var(--leaf-soft);
}

.feedback.wrong {
  border-left: 6px solid var(--pink);
  background: var(--pink-soft);
}

.feedback h3 {
  margin: 0 0 7px;
  font-size: 1.125rem;
  line-height: 1.45;
}

.feedback p {
  margin: 6px 0;
}

.feedback .solution {
  color: var(--blue-deep);
  font: 1.75rem/1.45 Georgia, "Times New Roman", serif;
}

.feedback small {
  color: var(--muted);
  font-size: .875rem;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.actions.wrap {
  flex-wrap: wrap;
}

.passage {
  margin: 18px 0;
  padding: 18px 20px;
  border: var(--outline);
  border-left: 7px solid var(--blue);
  border-radius: 10px;
  background: var(--pale);
  font: 1.4375rem/1.65 Georgia, "Times New Roman", serif;
}

.badphrase {
  text-decoration: underline wavy var(--pink-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}

.dialog-line {
  margin: 11px 0;
  padding: 11px 15px;
  border: 1.5px solid var(--ink);
  border-left: 7px solid var(--terracotta);
  border-radius: 9px;
  background: var(--sun-soft);
}

.dialog-line p {
  margin: 4px 0;
  font: 1.375rem/1.5 Georgia, "Times New Roman", serif;
}

.dialog-line small {
  color: var(--muted);
  font-size: .875rem;
}

.minicards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin: 20px 0;
}

.minicards button,
.route-card,
.progress-row,
.stat,
.reference details {
  min-width: 0;
  border: var(--outline);
  border-radius: 13px;
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
}

.minicards button {
  min-height: 96px;
  padding: 18px;
  text-align: left;
}

.minicards button[aria-pressed="true"] {
  background: var(--sun-soft) !important;
  border-color: var(--ink) !important;
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.minicards strong {
  display: block;
  font-size: 1.0625rem;
  line-height: 1.45;
}

.minicards small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.5;
}

.reference + .reference {
  margin-top: 28px;
}

.reference h2,
.progress h2 {
  margin: 0 0 12px;
  font: 800 1.8125rem/1.3 var(--display);
  letter-spacing: -.025em;
}

.reference h3,
.progress h3 {
  margin: 27px 0 11px;
  font-size: 1.25rem;
  line-height: 1.4;
}

.reference p,
.progress p {
  font-size: 1rem;
  line-height: 1.65;
}

.reference details {
  margin-bottom: 14px;
  padding: 18px 20px;
  box-shadow: 3px 3px 0 #d8d2bf;
}

.reference details[open] {
  box-shadow: 3px 3px 0 var(--ink);
}

.tablewrap {
  max-width: 100%;
  margin-top: 16px;
  overflow-x: auto;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: normal;
}

th {
  background: var(--sun-soft);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 800;
}

.dictsearch {
  margin: 14px 0;
  padding: 12px 14px;
}

.wordrow {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}

.wordrow b {
  min-width: 0;
  font: 1.25rem/1.5 Georgia, "Times New Roman", serif;
}

.wordrow span {
  min-width: 0;
  color: var(--muted);
  text-align: right;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin: 22px 0 24px;
}

.stat {
  padding: 20px 17px;
  box-shadow: 3px 3px 0 var(--ink);
}

.stat:nth-child(1) { background: var(--pale); }
.stat:nth-child(2) { background: var(--leaf-soft); }
.stat:nth-child(3) { background: var(--sun-soft); }
.stat:nth-child(4) { background: var(--pink-soft); }

.stat b {
  display: block;
  margin: 0;
  font: 800 2.125rem/1.2 var(--display);
}

.stat span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0 25px;
}

.route-card {
  padding: 21px;
}

.route-card:nth-child(2n) {
  background: var(--leaf-soft);
}

.route-card h3 {
  margin: 10px 0 7px;
  font-size: 1.25rem;
}

.route-card p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.rows {
  display: grid;
  gap: 13px;
}

.progress-row {
  padding: 18px 20px;
  box-shadow: 3px 3px 0 #d8d2bf;
}

.rowhead {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.5;
}

.rowhead small {
  color: var(--muted);
  font-size: .875rem;
  text-align: right;
}

.summaryscore {
  margin: 24px 0;
  color: var(--blue-deep);
  font: 800 4rem/1.2 var(--display);
  letter-spacing: -.05em;
}

.summaryscore small {
  color: var(--muted);
  font-size: 1.375rem;
  letter-spacing: 0;
}

.summary-list {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.empty {
  padding: 40px 22px;
  text-align: center;
}

.empty h2,
.empty h3 {
  font-size: 1.5rem;
}

.empty p {
  color: var(--muted);
}

.resetbox {
  margin-top: 15px;
  padding: 16px;
  border: var(--outline);
  border-left: 7px solid var(--pink);
  border-radius: 10px;
  background: var(--pink-soft);
}

.resetbox button {
  margin: 6px 8px 0 0;
}

.welcome-dialog {
  width: min(500px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 36px;
  overflow: auto;
  border: var(--outline);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
}

.welcome-dialog::backdrop {
  background: rgba(32, 52, 62, .44);
  backdrop-filter: blur(3px);
}

.welcome-dialog img {
  border: var(--outline);
  border-radius: 13px !important;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-4deg);
}

.welcome-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: var(--outline);
  border-radius: 8px;
  background: var(--card);
  font-size: 1.75rem;
  line-height: 1;
}

.welcome-dialog h2 {
  margin: 24px 0 8px;
  color: var(--blue-deep);
  font: 2.25rem/1.3 Georgia, "Times New Roman", serif;
}

.welcome-dialog #welcomeTranslation {
  margin: 0 0 22px;
  font-size: 1.25rem;
}

.welcome-body {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.welcome-greek {
  color: var(--blue-deep);
  font: 1.5rem/1.5 Georgia, "Times New Roman", serif;
}

.welcome-start {
  width: 100%;
  margin-top: 16px;
}

.welcome-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.welcome-progress > div {
  padding: 12px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--sun-soft);
  text-align: center;
}

.welcome-progress b {
  display: block;
  color: var(--blue-deep);
  font-size: 1.75rem;
}

.welcome-progress span {
  color: var(--muted);
  font-size: .875rem;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border: var(--outline);
  border-radius: 10px;
  background: var(--ink);
  color: var(--card);
  box-shadow: 3px 3px 0 var(--sun);
  transform: translateX(-50%);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

footer {
  padding: 18px 0 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #d4ccb5;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}

@keyframes limassol-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1130px) {
  .shell {
    width: calc(100% - 44px);
  }

  .layout {
    grid-template-columns: 226px minmax(0, 1fr);
    gap: 23px;
  }

  .answers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  .shell {
    width: calc(100% - 36px);
  }

  .header {
    flex-wrap: wrap;
    padding: 24px 0 20px;
  }

  .tabs {
    margin-left: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .settings-summary {
    display: flex;
  }

  .settings-panel[open] .settings-summary {
    border-bottom: 1px solid #d8cdb3;
  }

  .settings-panel:not([open]) .settings-inner {
    display: none;
  }

  .settings-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 24px;
  }

  .settings-inner > .label,
  .settings-inner > .courses,
  .settings-inner > .course-note,
  .settings-inner > .theme-control {
    grid-column: 1;
  }

  .settings-inner > .label:nth-of-type(2),
  .settings-inner > .topics {
    grid-column: 2;
  }

  .settings-inner > .label:nth-of-type(2) {
    grid-row: 1;
  }

  .settings-inner > .topics {
    grid-row: 2 / span 4;
  }

  .settings-inner > .side-rule,
  .settings-inner > .side-note {
    grid-column: 1 / -1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  body {
    font-size: 1rem;
    line-height: 1.6;
  }

  .shell {
    width: calc(100% - 32px);
  }

  .header {
    gap: 18px;
    padding: 22px 0 20px;
  }

  .brand {
    width: 100%;
  }

  .brand img {
    width: 46px;
    height: 46px;
  }

  .brand h1 {
    font-size: 1.25rem;
  }

  .brand > div::after {
    font-size: .875rem;
    letter-spacing: .04em;
  }

  .tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .tabs button {
    min-width: 0;
    min-height: 54px;
    padding: 8px 4px;
    border-color: #d6cbb0;
    background: #f5ecd5;
    font-size: 1rem;
    white-space: normal;
  }

  .rankbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 14px 12px;
    gap: 10px;
    margin: 20px 0 22px;
  }

  .rankicon {
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
  }

  .rankcopy b {
    font-size: 1.125rem;
  }

  .rankbar > .secondary {
    display: inline-flex;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
  }

  .settings-inner {
    display: block;
    padding: 18px 16px;
  }

  .topics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .sidebar .label,
  .sidebar .side-rule,
  .sidebar .side-note {
    display: block;
  }

  .topic {
    max-width: none;
    white-space: normal;
  }

  .lesson-hero {
    padding: 22px 17px;
  }

  .lesson-hero h2 {
    font-size: 1.625rem;
  }

  .card {
    padding: 23px 17px 20px;
    border-radius: 14px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .card::before,
  .lesson-hero::before {
    right: 18px;
    left: 18px;
  }

  .card .qtitle {
    margin-bottom: 20px;
    font-size: 1.5rem;
    line-height: 1.35;
  }

  .scene-frame {
    padding: 19px 15px;
  }

  .scene-frame .greek-prompt,
  .greek-prompt {
    font-size: 2.125rem;
    line-height: 1.45;
  }

  .answer,
  .answer .value,
  .answer.long .value {
    min-height: 64px;
    padding: 14px 12px;
    font-size: 1.0625rem;
    line-height: 1.5;
  }

  .answer.good::after,
  .answer.bad::after {
    content: attr(data-state-label);
    width: 22px;
    height: 22px;
    padding: 0;
    display: grid;
    place-items: center;
    color: transparent;
  }

  .answer.good::after {
    content: "✓";
    color: #315f32;
  }

  .answer.bad::after {
    content: "×";
    color: var(--pink-ink);
  }

  .type-row {
    flex-direction: column;
  }

  .type-row .primary {
    width: 100%;
  }

  input.answer-input {
    min-height: 52px;
    font-size: 1rem;
  }

  .actions {
    flex-wrap: wrap;
    gap: 12px;
  }

  .actions .primary {
    min-width: min(100%, 10rem);
    margin-left: auto;
  }

  .minicards,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  }

  .wordrow {
    align-items: flex-start;
  }

  .wordrow b,
  .wordrow span {
    max-width: 50%;
  }

  .rowhead {
    flex-direction: column;
    gap: 4px;
  }

  .rowhead small {
    text-align: left;
  }

  .summaryscore {
    font-size: 3.5rem;
  }

  .welcome-dialog {
    padding: 31px 20px 24px;
  }

  .welcome-dialog h2 {
    font-size: 2rem;
  }

  .welcome-progress {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 380px) {
  .shell {
    width: calc(100% - 24px);
  }

  .tabs {
    gap: 5px;
  }

  .tabs button {
    font-size: .9375rem;
  }

  .courses {
    gap: 5px;
  }

  .courses button {
    font-size: .9375rem;
  }

  .card {
    padding-inline: 14px;
  }

  .scene-frame {
    padding-inline: 12px;
  }

  .answer {
    gap: 9px;
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
