: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;
  --mint: #d8f2e3;
  --gold: #ffe6a3;
  --coral: #ffd8ca;
  --cell: #ffffff;
  --cell-line: #25313d;
  --empty-cell: #edf3f8;
  --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;
  font-style: normal;
  font-display: swap;
}

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

@font-face {
  font-family: "Montserrat";
  src: url("assets/Montserrat-Bold.ttf") format("truetype");
  font-weight: 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;
}

.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;
  backdrop-filter: blur(12px);
}


.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,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.18rem;
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 900;
}

.brand-block p,
#status-text,
.eyebrow {
  color: var(--muted);
}

.brand-block p {
  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;
}

.activity-toolbar {
  min-height: 76px;
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(23, 40, 64, 0.06);
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

#preview-title {
  margin-top: 4px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
}

#status-text {
  font-size: 0.9rem;
  text-align: right;
}

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

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

.visual-hints {
  display: grid;
  gap: 10px;
  padding: 16px 30px 0;
}

.visual-hints[hidden] {
  display: none;
}

.visual-hints-title {
  color: var(--brand-green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.visual-hints-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.visual-hint-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(244, 154, 33, 0.08), transparent 58%),
    #fbfdff;
}

.visual-hint-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2eaf2;
}

.visual-hint-icon svg {
  width: 48px;
  height: 48px;
}

.visual-hint-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 900;
}

.worksheet-body {
  display: grid;
  grid-template-columns: minmax(520px, 1.55fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
  padding: 26px 30px 28px;
}

.grid-wrap {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 16px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(35, 95, 159, 0.045), rgba(244, 154, 33, 0.055)),
    #f9fbfd;
}

.crossword-grid {
  --size: 17;
  --grid-max: 600px;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(18px, 1fr));
  grid-template-rows: repeat(var(--size), minmax(18px, 1fr));
  width: min(100%, var(--grid-max));
  aspect-ratio: 1;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--cell);
  border: 1.4px solid var(--cell-line);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 1.2vw, 1rem);
  user-select: none;
  color: #13202d;
}

.cell.empty {
  background: transparent;
  border-color: transparent;
}

.hint-letter {
  color: var(--accent-dark);
}

.cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: clamp(0.45rem, 0.8vw, 0.64rem);
  font-weight: 800;
  color: #4c5663;
  line-height: 1;
}

.clues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 4px;
}

.clues h3 {
  font-size: 0.92rem;
  margin-bottom: 8px;
  color: #ffffff;
  background: #153d66;
  border-left: 6px solid var(--brand-orange);
  border-radius: 4px;
  padding: 7px 9px;
}

.clues ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.clues li {
  margin: 0 0 9px;
  line-height: 1.36;
  padding-left: 2px;
  color: #172233;
}

.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,
  .worksheet-body {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

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

  .worksheet,
  .control-panel {
    padding: 14px;
  }

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

  #status-text {
    text-align: left;
  }

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

  .visual-hints-list {
    grid-template-columns: 1fr;
  }

  .worksheet-footer {
    display: grid;
    padding-inline: 14px;
  }
}

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

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    background: #fff;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .control-panel,
  .activity-toolbar {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .workspace,
  .activity-panel {
    display: block;
    width: 210mm;
    max-width: none;
    margin: 0;
  }

  .worksheet {
    width: 210mm;
    min-height: 297mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .worksheet-masthead {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 118pt;
    column-gap: 18pt;
    align-items: center;
    min-height: 84pt;
    padding: 15pt 42pt 12pt;
    border-top: 8pt solid var(--brand-orange);
    border-bottom: 1pt solid #c7d6e6;
    background:
      linear-gradient(90deg, rgba(244, 154, 33, 0.08), transparent 36%),
      linear-gradient(135deg, #fffdf7 0%, #fbfdff 62%, #f4f8fb 100%);
  }

  .masthead-brand {
    display: grid !important;
    grid-template-columns: 56pt minmax(0, 1fr);
    gap: 16pt;
    align-items: center;
    min-width: 0;
  }

  .worksheet-logo {
    display: block;
    width: 56pt;
    height: 56pt;
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }

  .worksheet-kicker {
    font-size: 8.8pt;
  }

  #worksheet-title {
    max-width: 295pt;
    overflow: hidden;
    font-size: 28pt;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .issue-card {
    box-sizing: border-box;
    justify-self: end;
    align-self: center;
    width: 118pt;
    min-width: 118pt;
    padding: 7pt 0 7pt 12pt;
    border-left: 3pt solid var(--accent);
    background: transparent;
    font-size: 9pt;
    text-align: right;
  }

  .issue-card p {
    margin: 0;
    white-space: nowrap;
  }

  .student-strip {
    height: 28pt;
    padding: 0 42pt;
    border-bottom: 1pt solid #c7d6e6;
    background: #fbfdff;
    align-items: center;
    font-size: 9.2pt;
  }

  .activity-instructions {
    padding: 10pt 42pt 0;
    font-size: 12pt;
    font-weight: 400;
    line-height: 1.24;
    text-align: center;
  }

  .activity-instructions p + p {
    margin-top: 1pt;
  }

  .visual-hints {
    padding: 9pt 42pt 0;
    gap: 6pt;
  }

  .visual-hints-title {
    font-size: 8.2pt;
  }

  .visual-hints-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 9pt;
  }

  .visual-hint-card {
    grid-template-columns: 38pt 1fr;
    gap: 8pt;
    padding: 6pt;
    border-radius: 4pt;
  }

  .visual-hint-icon {
    width: 38pt;
    height: 38pt;
    border-radius: 4pt;
  }

  .visual-hint-icon svg {
    width: 31pt;
    height: 31pt;
  }

  .visual-hint-card span {
    font-size: 9.2pt;
  }

  .worksheet-body {
    display: block;
    padding: 10pt 42pt 0;
  }

  .grid-wrap {
    float: none;
    width: calc(var(--print-grid-max) + 22pt);
    max-width: 100%;
    margin: 0 auto 18pt;
    padding: 10pt;
    border: 1pt solid #dbe6f0;
    border-radius: 4pt;
    background: #f7fbff;
    overflow: hidden;
  }

  .crossword-grid {
    width: 100%;
    padding: 0;
  }

  .cell {
    border-width: 0.72pt;
    font-size: 12.2pt;
  }

  .cell-number {
    top: 1.5pt;
    left: 2pt;
    font-size: 6.2pt;
  }

  .clues {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24pt;
    padding: 0;
  }

  .clues h3 {
    min-height: 22pt;
    margin-bottom: 10pt;
    padding: 6pt 8pt 5pt 13pt;
    border-left-width: 7pt;
    border-radius: 2pt;
    font-size: 11pt;
    background: #174876;
    color: #fff;
  }

  .clues li {
    margin-bottom: 5pt;
    font-size: 8.7pt;
    line-height: 1.25;
  }

  .worksheet-footer {
    margin-top: auto;
    padding: 9pt 42pt 10pt;
    border-top: 0.8pt solid #d1dbe7;
    background: #f8fafc;
    font-size: 7.8pt;
  }
}




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