: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);
}

.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 {
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(19, 35, 56, 0.13);
  overflow: hidden;
}

.worksheet-masthead {
  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%);
}

.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 + p {
  margin-top: 3px;
}

.word-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 {
  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 {
  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 {
  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);
}

.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;
  }

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

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

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

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

  .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;
  }

  .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;
  }
}
