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

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

.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: 18px;
  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.18rem;
  line-height: 1.08;
  letter-spacing: 0;
  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: 18px 26px 16px;
  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: 54px;
  height: 54px;
  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.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

#worksheet-title {
  font-size: clamp(1.85rem, 2.8vw, 2.65rem);
  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: minmax(0, 1fr) minmax(250px, 0.58fr);
  gap: 20px;
  padding: 10px 26px;
  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: 8px 26px 0;
  color: #172333;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.28;
  text-align: center;
}

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

.worksheet-body {
  padding: 14px 26px 18px;
}

.matching-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px minmax(180px, 1fr);
  gap: 16px;
  max-width: 820px;
  min-height: 420px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(35, 95, 159, 0.045), rgba(244, 154, 33, 0.055)),
    #f9fbfd;
}

.match-column {
  display: grid;
  gap: 12px;
  align-content: stretch;
  z-index: 2;
}

.match-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px 10px 18px;
  border: 1px solid #c8d6e4;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  color: #13202d;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 10px 22px rgba(23, 40, 64, 0.07);
  overflow: hidden;
}

.match-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--brand-orange), #f8b653);
}

.match-item::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  border: 1px solid #c8d6e4;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
}

.match-item.right {
  justify-content: flex-start;
  padding-left: 18px;
}

.match-item.right::before {
  right: 0;
  left: auto;
  background: linear-gradient(180deg, var(--accent), #2f9b82);
}

.match-item.right::after {
  right: auto;
  left: -4px;
}

.connector-space {
  position: relative;
  z-index: 1;
}

.solution-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.solution-line {
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.worksheet-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 26px 10px;
  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;
  }

  .matching-board {
    grid-template-columns: 1fr;
  }

  .connector-space,
  .solution-svg {
    display: none;
  }

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

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

  .worksheet-body {
    padding: 16pt 42pt 0;
  }

  .matching-board {
    grid-template-columns: 1fr 72pt 1fr;
    gap: 14pt;
    max-width: none;
    min-height: 440pt;
    padding: 15pt;
    border-radius: 4pt;
  }

  .match-column {
    gap: 10pt;
  }

  .match-item {
    min-height: 34pt;
    padding: 7pt 9pt;
    border-radius: 4pt;
    font-size: 10pt;
    box-shadow: none;
  }

  .solution-line {
    stroke-width: 1.25pt;
  }

  .worksheet-footer {
    margin-top: auto;
    padding: 9pt 42pt 10pt;
    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;
  }
}
