:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #667386;
  --line: #d9e2ee;
  --paper: #ffffff;
  --panel: #f4f7fb;
  --soft: #eef5fb;
  --accent: #235f9f;
  --accent-dark: #174876;
  --brand-orange: #f49a21;
  --brand-green: #24856b;
  --shadow: 0 18px 50px rgba(23, 40, 64, 0.1);
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(244, 154, 33, 0.14), transparent 28rem),
    radial-gradient(circle at top right, rgba(36, 133, 107, 0.1), transparent 30rem),
    linear-gradient(180deg, #fbfdff 0%, #eef3f8 100%),
    var(--panel);
  color: var(--ink);
  font-family: "Montserrat", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 22px;
  max-width: 1380px;
  margin: 0 auto;
}

.control-panel {
  align-self: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  position: sticky;
  top: 24px;
}


.brand-block {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(18, 32, 45, 0.05);
}
.library-link {
  width: max-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 12px;
  border: 1px solid #d8e4f1;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(18, 32, 45, 0.06);
}

.library-link::before {
  content: "";
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.brand-block > div {
  min-width: 0;
}

.brand-block > div::before {
  content: "SCOLATIO.COM";
  display: block;
  margin-bottom: 3px;
  color: var(--brand-green);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(23, 33, 43, 0.08);
  box-shadow: 0 10px 22px rgba(18, 32, 45, 0.12);
  object-fit: contain;
  padding: 6px;
}

h1 {
  font-size: 1.12rem;
  line-height: 1.08;
  font-weight: 900;
}

.brand-block p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 5px;
}

.controls {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
  font-size: 0.86rem;
}

select,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  min-height: 42px;
  padding: 0 12px;
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  align-items: center;
}

output {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.toggle-row.is-disabled {
  opacity: 0.48;
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

button:hover {
  border-color: #9db2ca;
  background: #f8fbff;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.activity-panel {
  min-width: 0;
}

.worksheet {
  position: relative;
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(19, 35, 56, 0.13);
  overflow: hidden;
}

.worksheet-masthead::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 18px;
  width: min(310px, 42%);
  aspect-ratio: 1.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 168'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M34 76c13-25 38-38 67-35 19 2 28 11 44 7 28-8 41-34 72-28 23 4 44 22 50 44' stroke='%23cfe2ee' stroke-width='3'/%3E%3Cpath d='M47 104c19-18 44-20 69-8 20 10 38 24 62 15 26-9 33-35 63-28 21 5 36 18 45 36' stroke='%23d8e9e1' stroke-width='3'/%3E%3Cpath d='M86 50c-9 14-11 29-5 45 7 20 24 27 19 46' stroke='%23d9e3ef' stroke-width='2'/%3E%3Cpath d='M194 33c-14 18-18 38-8 59 9 18 26 28 20 49' stroke='%23d9e3ef' stroke-width='2'/%3E%3Cpath d='M24 128h288M36 42h245M160 15v145' stroke='%23edf2f7' stroke-width='2'/%3E%3Cpath d='M70 70c22-10 42-5 57 9 12 12 27 15 44 4 19-13 37-13 55 0' stroke='%23bddbd0' stroke-width='2.4'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.82;
  pointer-events: none;
  z-index: 0;
}

.worksheet-masthead {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 24px 30px 20px;
  border-top: 8px solid var(--brand-orange);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(244, 154, 33, 0.08), transparent 36%),
    linear-gradient(135deg, #ffffff 0%, #fbfdff 60%, #f4f8fb 100%);
  overflow: hidden;
}

.worksheet-masthead > * {
  position: relative;
  z-index: 1;
}

.masthead-brand {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.worksheet-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(18, 32, 45, 0.12);
  padding: 6px;
}

.worksheet-kicker {
  color: var(--brand-green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

#worksheet-title {
  font-size: clamp(2rem, 3.3vw, 3.05rem);
  line-height: 1;
  color: #111827;
}

.issue-card {
  min-width: 210px;
  display: grid;
  gap: 6px;
  padding: 11px 0 11px 18px;
  border-left: 3px solid var(--accent);
  color: #28384a;
  font-weight: 800;
  text-align: right;
  background: linear-gradient(90deg, rgba(35, 95, 159, 0.04), transparent);
}

.student-strip {
  display: grid;
  grid-template-columns: 1.5fr 0.85fr;
  gap: 18px;
  padding: 14px 30px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  color: #35465a;
  font-weight: 800;
}

.student-strip p {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: end;
}

.student-strip p::after {
  content: "";
  border-bottom: 1.5px solid #27384a;
  transform: translateY(-3px);
}


.student-strip [data-print-meta] {
  min-width: 0;
  max-width: 100%;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}.activity-instructions {
  padding: 14px 30px 0;
  color: #172333;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.38;
  text-align: center;
}

.activity-instructions p:first-child {
  color: #0f2f52;
  font-size: 13px;
  font-weight: 800;
}

.activity-instructions p + p {
  margin-top: 3px;
}

.activity-instructions strong {
  font-weight: 800;
}

.word-activity,
.geo-activity {
  --row-min: 72px;
  --print-row-height: 27mm;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 22px 30px 28px;
}

.word-card,
.geo-card {
  min-height: var(--row-min);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--card-color, var(--accent));
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--card-soft, #eef5fb), transparent 40%),
    #fff;
  page-break-inside: avoid;
}

.word-number,
.geo-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--card-color, var(--accent));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.word-content,
.geo-content {
  min-width: 0;
}

.word-clue {
  color: #2d3b4c;
  font-size: 0.84rem;
  line-height: 1.3;
  font-weight: 700;
}

.letter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(2px, 0.42vw, 5px);
  margin-top: 10px;
  max-width: 100%;
  overflow: hidden;
}

.letter-box {
  width: min(24px, calc((100% - (var(--letters, 8) - 1) * 5px) / var(--letters, 8)));
  min-width: 0;
  height: 30px;
  flex: 0 1 auto;
  display: grid;
  place-items: center;
  border-bottom: 2px solid #1d2b3a;
  color: #111827;
  font-size: clamp(0.72rem, calc(1.38rem - var(--letters, 8) * 0.035rem), 1.05rem);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}

.letter-box.is-missing {
  width: min(30px, calc((100% - (var(--letters, 8) - 1) * 5px) / var(--letters, 8)));
  min-width: 0;
  border: 1.5px solid #aebed1;
  border-bottom: 2px solid var(--card-color, var(--accent));
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
}

.letter-box.is-filled {
  background: var(--card-soft, #eef5fb);
}

.geo-card {
  min-height: 116px;
  grid-template-columns: 32px minmax(0, 1fr);
}

.geo-content {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.geo-card.is-map-card {
  min-height: 220px;
}

.geo-card.is-map-card .geo-label {
  margin-bottom: 7px;
}

.geo-label {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--card-color, var(--accent));
  color: #fff;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}

.geo-prompt {
  color: #111827;
  font-size: 1.02rem;
  line-height: 1.18;
  font-weight: 900;
}

.geo-world-map {
  width: 100%;
  height: 158px;
  display: block;
  margin: 2px 0 6px;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(22, 44, 68, 0.06);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.map-bg {
  fill: #ffffff;
}

.map-image {
  opacity: 0.96;
  image-rendering: auto;
}

.map-country {
  fill: #c9cdd2;
  stroke: #ffffff;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.map-loading {
  fill: #53657a;
  font-size: 38px;
  font-weight: 800;
}

.map-flag {
  filter: drop-shadow(0 8px 14px rgba(18, 32, 45, 0.2));
  image-rendering: auto;
}

.map-marker-halo {
  fill: rgba(244, 154, 33, 0.2);
  stroke: rgba(244, 154, 33, 0.75);
  stroke-width: 4;
}

.map-marker {
  fill: #f49a21;
  stroke: #174876;
  stroke-width: 3.4;
}

.geo-map-caption {
  color: #344458;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
}

.geo-question {
  margin-top: auto;
  padding-top: 10px;
  color: #344458;
  font-size: 0.8rem;
  font-weight: 900;
}

.geo-card.is-map-card .geo-question {
  margin-top: 5px;
  color: var(--accent-dark);
  font-size: 0.92rem;
  letter-spacing: 0;
}

.geo-card.is-map-card .geo-answer-line {
  min-height: 28px;
}

.geo-answer-line {
  min-height: 30px;
  margin-top: 4px;
  border-bottom: 2px solid #243447;
  display: flex;
  align-items: end;
  padding: 0 8px 5px;
}

.geo-answer-text {
  color: var(--accent-dark);
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.1;
}

.geo-answer-text.is-hint {
  color: #516174;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.worksheet-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 30px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: #5e6b7a;
  font-size: 0.76rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .worksheet-masthead,
  .student-strip {
    display: grid;
  }

  .worksheet-footer {
    display: grid;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .control-panel,
  .account-widget {
    display: none !important;
  }

  .app-shell {
    padding: 0;
  }

  .workspace {
    display: block;
    max-width: none;
    margin: 0;
  }

  .worksheet {
    width: 210mm;
    height: 297mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  .worksheet-masthead {
    padding: 10mm 14mm 7mm;
  }

  .student-strip {
    padding: 4mm 14mm;
  }

  .activity-instructions {
    padding: 4mm 14mm 0;
  }

  .activity-instructions p:first-child {
    font-size: 9.5pt;
  }

  .word-activity,
  .geo-activity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3.2mm;
    padding: 5mm 14mm 5mm;
  }

  .word-card,
  .geo-card {
    min-height: 0;
    height: var(--print-row-height);
    padding: 3mm;
    box-shadow: none;
  }

  .word-number,
  .geo-number {
    width: 7mm;
    height: 7mm;
    font-size: 8pt;
  }

  .word-card,
  .geo-card {
    grid-template-columns: 8mm minmax(0, 1fr);
    gap: 3mm;
  }

  .geo-card.is-map-card {
    height: var(--print-row-height);
  }

  .word-clue {
    font-size: 8pt;
    line-height: 1.22;
  }

  .letter-row {
    gap: 0.8mm;
    margin-top: 2.4mm;
  }

  .letter-box {
    width: min(6.2mm, calc((100% - (var(--letters, 8) - 1) * 0.8mm) / var(--letters, 8)));
    min-width: 0;
    height: 7mm;
    font-size: clamp(6.8pt, calc(12pt - var(--letters, 8) * 0.34pt), 10pt);
  }

  .letter-box.is-missing {
    width: min(7.2mm, calc((100% - (var(--letters, 8) - 1) * 0.8mm) / var(--letters, 8)));
    min-width: 0;
  }

  .geo-label {
    padding: 1.3mm 2mm;
    font-size: 6pt;
    margin-bottom: 1.8mm;
  }

  .geo-prompt {
    font-size: 10.5pt;
    line-height: 1.16;
  }

  .geo-world-map {
    height: 34mm;
    margin: 0.5mm 0 1.2mm;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .geo-map-caption {
    font-size: 6.8pt;
  }

  .geo-question {
    margin-top: auto;
    padding-top: 2mm;
    font-size: 7.5pt;
  }

  .geo-card.is-map-card .geo-question {
    margin-top: 0.9mm;
    font-size: 8.6pt;
  }

  .geo-card.is-map-card .geo-answer-line {
    min-height: 6.2mm;
    margin-top: 0.4mm;
  }

  .geo-answer-line {
    min-height: 6.4mm;
    margin-top: 0.6mm;
    padding: 0 1.5mm 1.2mm;
  }

  .geo-answer-text {
    font-size: 8.2pt;
  }

  .worksheet-footer {
    padding: 3.5mm 14mm 4mm;
  }
}




.issue-card p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
}

.issue-card p:empty {
  display: none;
}

.issue-card p:nth-child(2) {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  color: #0f172a;
}

@media print {
  .issue-card p {
    margin: 0;
    font-size: 8pt !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
  }

  .issue-card p:empty {
    display: none !important;
  }

  .issue-card p:nth-child(2) {
    font-size: 15pt !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }
}
