:root {
  --navy: #142b4a;
  --navy-2: #23466f;
  --blue: #14529a;
  --red: #bf2f24;
  --ink: #182231;
  --muted: #687386;
  --line: #cbd3df;
  --soft: #f3f6fa;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

button { font: inherit; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 44px 32px 28px;
  border-bottom: 4px solid var(--navy);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.version-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  color: #fff;
  background: var(--red);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(25px, 3.2vw, 44px);
  line-height: 1.25;
  letter-spacing: .02em;
}

.lead { margin: 8px 0 0; color: var(--muted); }

.print-button {
  flex: none;
  padding: 10px 20px;
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.print-button:hover { background: var(--navy-2); }
.print-button:focus-visible, .shot-frame:focus-visible { outline: 3px solid #70a9e8; outline-offset: 3px; }

main { max-width: 1500px; margin: 0 auto; padding: 22px 32px 48px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.legend-dot.red { background: var(--red); }
.legend-dot.blue { background: var(--blue); }
.edit-hint { margin-left: auto; }

.version-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.version-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 8px 16px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--navy);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.version-nav a:hover,
.version-nav a.is-active {
  color: #fff;
  background: var(--navy);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--navy); }

.storyboard { width: 100%; min-width: 1050px; border-collapse: collapse; table-layout: fixed; }
.col-time { width: 7%; }
.col-art { width: 24%; }
.col-direction { width: 18%; }
.col-line { width: 24%; }
.col-telop { width: 27%; }

th {
  padding: 12px 10px;
  color: #fff;
  background: var(--navy);
  border-right: 1px solid #718096;
  font-size: 14px;
  letter-spacing: .08em;
  text-align: center;
}

th:last-child { border-right: 0; }
td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td:last-child { border-right: 0; }
tbody tr:nth-child(even) td:not(.art-cell) { background: var(--soft); }
tbody tr.comic-row td:not(.art-cell) { background: #fff4f1; }
tbody tr.comic-row .time-cell { color: var(--red); }
tbody tr.input-row td:not(.art-cell) { background: #f2f7ff; }
tbody tr.input-row .time-cell { color: var(--blue); }

.time-cell { color: var(--navy); font-size: 14px; font-weight: 800; text-align: center; white-space: nowrap; }
.direction-cell { color: #455268; font-size: 15px; font-weight: 600; }
.line-cell { font-size: 18px; font-weight: 800; }
.telop-cell { text-align: center; }

.shot-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #e8edf4;
  border: 1px solid #aeb9c9;
  border-radius: 3px;
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.shot-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.shot-frame figcaption { position: absolute; left: 5px; bottom: 4px; padding: 1px 5px; color: #fff; background: rgb(20 43 74 / 80%); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.replace-label { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgb(20 43 74 / 76%); font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .16s ease; }
.shot-frame:hover .replace-label, .shot-frame:focus .replace-label { opacity: 1; }

.telop {
  display: inline-block;
  font-weight: 900;
  font-size: clamp(17px, 1.6vw, 25px);
  line-height: 1.25;
  letter-spacing: .03em;
}

.telop-red { color: var(--red); }
.telop-blue { color: var(--blue); }
.telop-green { color: #409957; }
.telop-note { color: var(--muted); font-size: 12px; font-weight: 600; }
.telop .big { font-size: 1.35em; font-style: italic; }
.telop.big, .telop.mega { font-size: clamp(22px, 2.15vw, 34px); font-style: italic; }
.comic-row .telop { transform: rotate(-1deg); }
.comic-row .telop-cell { background-image: radial-gradient(circle at 18% 28%, rgb(191 47 36 / 14%), transparent 24%), radial-gradient(circle at 82% 70%, rgb(20 82 154 / 10%), transparent 22%); }
.input-row .telop { font-size: clamp(20px, 1.9vw, 30px); }
.input-row .telop-cell { background-image: linear-gradient(135deg, rgb(20 82 154 / 10%), transparent 55%); }

.memo-section {
  margin-top: 24px;
  padding: 22px 24px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-left: 6px solid var(--navy);
}

.memo-section h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.35;
}

.memo-section ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 28px;
  margin: 0;
  padding-left: 1.2em;
  color: #334155;
  font-size: 15px;
  font-weight: 600;
}

footer { padding: 20px 32px 32px; color: #7d8796; font-size: 10px; letter-spacing: .14em; text-align: center; }
.sp-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .page-header { align-items: flex-start; padding: 28px 18px 20px; }
  .lead { font-size: 13px; }
  .print-button { display: none; }
  main { padding: 16px 14px 32px; }
  .edit-hint { width: 100%; margin-left: 0; }
  .version-nav a { flex: 1; min-width: 0; }
  .table-wrap { overflow: visible; border: 0; }
  .storyboard { min-width: 0; }
  .storyboard colgroup, .storyboard thead { display: none; }
  .storyboard, .storyboard tbody, .storyboard tr, .storyboard td { display: block; width: 100%; }
  .storyboard tr { margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-top: 5px solid var(--navy); border-radius: 7px; box-shadow: 0 5px 16px rgb(20 43 74 / 8%); }
  .storyboard td { position: relative; padding: 10px 12px 10px 94px; border: 0; border-bottom: 1px solid #e1e6ed; text-align: left; }
  .storyboard td::before { content: attr(data-label); position: absolute; left: 12px; top: 11px; width: 70px; color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
  .storyboard .time-cell { padding: 7px 12px; color: #fff; background: var(--navy) !important; font-size: 15px; text-align: left; }
  .storyboard .time-cell::before { content: none; }
  .storyboard .art-cell { padding: 10px 12px; }
  .storyboard .art-cell::before { content: none; }
  .shot-frame { aspect-ratio: 16 / 9; }
  .storyboard td:last-child { border-bottom: 0; }
  .telop { font-size: 21px; }
  .line-cell { font-size: 18px; }
  .memo-section { padding: 18px; }
  .memo-section ul { grid-template-columns: 1fr; font-size: 14px; }
  .sp-only { display: inline; }
}

@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body { font-size: 8.5pt; line-height: 1.35; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .page-header { padding: 0 0 4mm; border-bottom-width: 2px; }
  h1 { font-size: 19pt; }
  .lead, .eyebrow { margin-top: 1mm; }
  .print-button, .legend, .version-nav, footer, .replace-label, .shot-frame figcaption { display: none !important; }
  main { padding: 4mm 0 0; }
  .table-wrap { overflow: visible; }
  .storyboard { min-width: 0; }
  th { padding: 2mm 1.5mm; font-size: 8pt; }
  td { padding: 1.2mm 1.5mm; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  .shot-frame { aspect-ratio: 16 / 9; }
  .telop { font-size: 10pt; }
  .direction-cell { font-size: 8.5pt; }
  .line-cell { font-size: 10pt; }
  .telop-note { font-size: 7.5pt; }
  .memo-section { margin-top: 5mm; padding: 4mm; break-inside: avoid; page-break-inside: avoid; }
  .memo-section h2 { font-size: 12pt; }
  .memo-section ul { grid-template-columns: 1fr 1fr; gap: 1.5mm 5mm; font-size: 8.5pt; }
}
