:root {
  --paper: #fff;
  --cream: #fff;
  --ink: #171717;
  --red: #b51d32;
  --rule: #aaa;
  --muted: #555;
  --type-large: 1.125rem;
  --type-medium: .875rem;
  --type-small: .71875rem;
  --section-height: 1.875rem;
  --issue-gap: 6px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  -webkit-text-size-adjust: 100%;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; padding: 0 clamp(12px, 3vw, 48px); }
main, .mast { width: 100%; max-width: 1180px; margin-inline: auto; }
a { color: inherit; text-underline-offset: .16em; }
button, select, input {
  font: inherit; color: var(--ink); background: white;
  border: 1px solid var(--ink); border-radius: 0; min-height: 44px; padding: 6px 10px;
}
button, select { font-weight: 700; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
select { max-width: 100%; }
:focus-visible { outline: 3px solid #176659; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

.mast {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0 5px;
}
.mast strong { font-size: clamp(1.2rem,2.5vw,1.65rem); font-weight: 900; line-height: 1.12; letter-spacing: -.065em; }
.mast button {
  min-height: 30px; padding: 3px 9px; border: 0; background: #ffe359;
  font-weight: 800; font-size: var(--type-small); line-height: 1.25; white-space: nowrap;
}
#spread {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "lead lead" "contents context";
  grid-template-rows: auto auto; gap: var(--issue-gap);
}
#spread { position: relative; isolation: isolate; touch-action: pan-y pinch-zoom; }
.stories { display: contents; }
.issue-lead {
  grid-area: lead; display: grid; flex: none;
  grid-template-columns: clamp(84px,24%,210px) minmax(0,1fr);
  --lead-pad: clamp(7px,1.8vw,22px);
  --folio-size: clamp(2.55rem,9vw,5.5rem);
  --headline-size: clamp(1.6rem,5.9vw,3.25rem);
  background: #b21e31; color: white;
}
.issue, .feature { display: grid; align-content: center; min-width: 0; padding: var(--lead-pad); }
.issue { container-type: inline-size; border-inline-end: 1px solid #ffffff66; }
.issue > strong, .feature-work, .feature-number {
  font-size: clamp(.75rem,2.65vw,1rem); font-weight: 800; line-height: 1.2;
}
.issue h1 {
  height: var(--folio-size); margin: 0; font-size: min(var(--folio-size),50cqi); font-weight: 900; line-height: var(--folio-size); letter-spacing: -.065em;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.issue h1 small { font-size: .32em; line-height: 1; font-weight: 800; margin-inline-start: .22em; letter-spacing: 0; }
.issue h1.combined { font-size: min(calc(var(--folio-size)*.55),22cqi); letter-spacing: -.075em; }
.issue h1.combined small { font-size: clamp(.59rem,13cqi,.85rem); }
.feature { gap: 3px; }
.feature-byline, .feature-details { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.feature-work, .feature-chapter, .feature-headline, .index-strip li > * {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feature-work { margin: 0; }
.feature-number { flex: none; padding-inline-start: 8px; border-inline-start: 1px solid #ffffff75; font-variant-numeric: tabular-nums; }
.feature-headline {
  margin: 0; font-size: var(--headline-size); line-height: 1.17; font-weight: 900;
  letter-spacing: -.045em; color: #ffe359;
}
.feature-details {
  font-size: var(--type-small); height: 1.45em; line-height: 1.45;
}
.feature-details a, .feature-details button { min-width: 0; white-space: nowrap; }
.feature-details a { flex: none; }
.feature-details button { overflow: hidden; text-overflow: ellipsis; }
.feature-chapter { font-weight: 750; }
.feature-details button, .section-heading button {
  font-size: var(--type-small); line-height: 1.25; border: 0;
  min-height: 0; padding: 0; color: inherit; background: transparent;
  text-decoration: underline; text-underline-offset: .16em;
}
.print-line {
  grid-column: 1 / -1; display: flex; gap: clamp(4px,1.4vw,15px); align-items: baseline;
  padding: 3px var(--lead-pad); border-bottom: 1px solid var(--ink);
  background: white; color: var(--ink); font-size: var(--type-small); line-height: 1.4;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.print-line .price { font-weight: 850; }
.print-line .issue-date { margin-inline-end: auto; }
.print-line a { color: var(--muted); }
.index-strip { grid-area: contents; }
.around { grid-area: context; }
.index-strip, .around { min-width: 0; display: flex; flex-direction: column; }
.section-heading {
  display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--section-height); padding: 1px 5px;
  border-top: 3px solid var(--ink); border-bottom: 1px solid var(--ink);
  background: white; color: var(--ink);
}
.section-heading h2 {
  margin: 0; font-size: var(--type-large); line-height: 1.12; font-weight: 900; letter-spacing: -.045em;
}
.section-heading button {
  align-self: stretch; color: var(--red);
  font-size: var(--type-small); font-weight: 750; text-underline-offset: .19em;
}
.section-heading .basis { margin: 0; color: var(--muted); font-size: var(--type-small); line-height: 1.25; white-space: nowrap; }
.index-strip ul, .around ul { padding: 0; margin: 0; list-style: none; }
.index-strip ul {
  display: grid; flex: 1; grid-auto-rows: minmax(max-content, 1fr); border-bottom: 1px solid var(--ink);
}
.index-strip li {
  display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  align-items: center; column-gap: 8px; padding: 2px 5px;
  border-bottom: 1px solid #c8c8c8; font-size: var(--type-medium); line-height: 1.32;
}
.index-strip li:last-child { border-bottom: 0; }
.index-strip li > strong { font-weight: 800; letter-spacing: -.025em; }
.index-chapter { color: #444; font-size: var(--type-small); }
.around ul {
  display: grid; flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, 1fr); border-bottom: 1px solid var(--ink);
}
.around li {
  display: grid; min-width: 0; align-content: start; row-gap: 3px; padding: 5px;
  border-bottom: 1px solid #c8c8c8; background: white;
}
.around li:nth-child(odd) { border-right: 1px solid #c8c8c8; }
.around li:nth-last-child(-n+2) { border-bottom: 0; }
.event-meta {
  display: grid; grid-template-columns: minmax(max-content, 5.5ch) max-content minmax(0, 1fr);
  gap: 5px; align-items: baseline; min-width: 0; white-space: nowrap;
  font-size: var(--type-small); line-height: 1.25;
}
.event-date { font-family: system-ui, sans-serif; font-variant-numeric: tabular-nums; font-weight: 700; }
.event-category { color: var(--red); font-weight: 800; }
.event-window { justify-self: end; color: var(--muted); }
.event-title {
  display: block;
  font-size: var(--type-medium); line-height: 1.28; font-weight: 750; letter-spacing: -.022em;
  text-decoration: none;
}
a.event-title > .flow-text::after { content: "↗" / ""; margin-inline-start: .2em; color: #6e6365; font: .72em system-ui, sans-serif; }
a.event-title:is(:hover,:focus-visible) { text-decoration: underline; }
#year-copies {
  display: flex; align-items: baseline; gap: 2px 8px; flex-wrap: wrap;
  padding: 4px 7px; color: white; background: var(--ink); font-size: var(--type-small); line-height: 1.28;
}
#year-copies strong { font-weight: 750; }
#year-copies > :nth-child(2) {
  color: #ffe359; font-size: var(--type-medium); font-weight: 900; font-variant-numeric: tabular-nums;
  text-decoration-thickness: 1px;
}
#year-copies > :last-child { margin-inline-start: auto; color: #eee; }
.pager, .tools { display: grid; }
.pager { grid-template-columns: 1fr minmax(0, 1.65fr) 1fr; }
.tools {
  grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.pager button, .pager select, .tools button {
  width: 100%; min-width: 0; margin: 0; padding: 4px; border: 0;
  font-size: var(--type-medium); line-height: 1.2; text-align: center; white-space: nowrap;
}
.pager :is(button,select) { min-height: 42px; }
.pager select {
  appearance: none; -webkit-appearance: none;
  border-inline: 1px solid #bdbdbd; border-radius: 0; padding-inline: 14px;
  color: var(--ink); font-weight: 850; text-align-last: center;
  background: linear-gradient(45deg, transparent 48%, currentColor 50%) right 10px center / 4px 4px no-repeat,
    linear-gradient(135deg, currentColor 49%, transparent 51%) right 6px center / 4px 4px no-repeat, white;
}
.tools button { min-height: 40px; font-weight: 700; }
.tools button + button { border-inline-start: 1px solid #bdbdbd; }
.pager button:not(:disabled):is(:hover,:focus-visible), .tools button:is(:hover,:focus-visible) { background: #f2f2f2; }
body:has(#play-count:disabled) .tools [data-panel=reading] { background: var(--red); color: white; }
main { padding-bottom: 0; }

dialog {
  background: var(--paper); color: var(--ink); width: min(720px, calc(100% - 24px));
  max-height: calc(100dvh - 36px); border: 2px solid; padding: 16px; overscroll-behavior: contain;
}
dialog::backdrop { background: #241e19a0; }
dialog form, .filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
dialog label { display: grid; gap: 4px; min-width: 0; max-width: 100%; font-size: .8rem; font-weight: 800; }
dialog form button { color: white; background: var(--ink); }
.close { justify-content: end; margin: 0; }
.close button, #pause { background: white; color: var(--ink); }
.playback { padding: 10px 0 14px; border-top: 1px solid var(--rule); }
.playback input { max-width: 92px; font-size: 1rem; }
#play-status { align-self: center; flex: 1 1 240px; margin: 0; font-size: .85rem; font-weight: 700; }
#scene-index, #era, .issue-scenes { border-top: 2px solid; margin: 24px 0; padding-top: 12px; }
#events, #scenes { list-style: none; padding: 0; display: grid; gap: 8px; }
#events li, #scenes li {
  border-bottom: 1px solid var(--rule); padding: 8px 0; display: flex;
  align-items: center; flex-wrap: wrap; gap: 10px;
}
#toc li { margin-block: .45em; }
#events strong { font-size: 1.12rem; font-weight: 900; }
.meta { color: var(--muted); font-size: var(--type-small); }

.swiping { user-select:none; -webkit-user-select:none; cursor:grabbing; }
.opening-trailer {
  position: fixed; inset: 0; margin: auto; max-width: 100dvw; max-height: 100dvh;
  padding: 0; border: 0; background: var(--ink); color: white;
  width: min(100dvw, calc((100dvh - 56px) * .8));
}
.opening-trailer::backdrop { background: var(--ink); }
.opening-trailer video {
  display: block; width: 100%; aspect-ratio: 4/5; object-fit: contain; background: white;
}
.opening-trailer-actions {
  display: flex; align-items: center; gap: 4px; min-height: 56px;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px 8px;
}
.opening-trailer-actions button {
  min-height: 44px; padding: 4px 8px; font-size: .85rem; line-height: 1.2;
  background: white; color: var(--ink); border-color: white;
}
.opening-trailer-actions .trailer-sound { margin-right: auto; background: var(--ink); color: white; }
.opening-trailer-actions .trailer-sound[aria-pressed=true] { color: var(--ink); background: #ffdb46; border-color: #ffdb46; }
@media (orientation: landscape) and (max-height: 420px) {
  .opening-trailer:has(.opening-trailer-actions button:nth-child(2):not([hidden])) {
    width: min(100dvw, calc((100dvh - 104px) * .8));
  }
  .opening-trailer-actions { flex-wrap: wrap; }
  .opening-trailer-actions button:nth-child(2):not([hidden]) { order: 1; width: 100%; }
}
.opening-trailer-actions button:focus-visible { outline: 2px solid var(--red); outline-offset: -4px; }
.opening {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; pointer-events: none;
  perspective: 900px; background: #181818; animation: opening-clear 920ms linear both;
}
.opening-book {
  width: min(56vw,260px); aspect-ratio: 3/4; display: grid; grid-template-rows: auto 1fr auto; padding: 13px;
  background: var(--red); border: 3px solid var(--ink); color: white; font-weight: 900;
  box-shadow: 2px 3px #f4f4f4,4px 6px #a7a7a7,6px 9px #f4f4f4,8px 12px #999,10px 15px #e0e0e0,16px 24px 27px #0009;
  animation: book-land 780ms both;
}
.opening-book strong { align-self: center; font-size: clamp(48px,20vw,110px); line-height: .9; letter-spacing: -.08em; }
.opening-book span { border-bottom: 2px solid; padding-bottom: 5px; }
@keyframes book-land {
  0%{transform:translateY(-85vh) rotateX(25deg) rotateZ(-14deg);opacity:0} 26%{opacity:1}
  55%{transform:translateY(5px) rotateX(11deg) rotateZ(-5deg)} 66%{transform:translateY(-8px) rotateX(9deg) rotateZ(-4deg)}
  100%{transform:translateY(0) rotateX(0) rotateZ(0)}
}
@keyframes opening-clear { 0%,73%{opacity:1} 100%{opacity:0} }
@media (prefers-reduced-motion: reduce) {
  .opening { display: none; }
}
@media (min-width: 900px) {
  :root { --type-large: 1.375rem; --type-medium: 1rem; --type-small: .8125rem; --section-height: 2.2rem; --issue-gap: 10px; }
  body { padding-top: 8px; }
  .index-strip li { padding: 5px 10px; }
  .around li { padding: 8px 10px; }
  .pager, .tools { width: 100%; }
}
@media (max-width: 680px) and (orientation: portrait) {
  :root { --issue-gap: 4px; }
  body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-inline: 10px; }
  .mast { padding: 3px 0; }
  main { display: flex; flex-direction: column; flex: 1; }
  #spread { display: flex; flex-direction: column; }
  #spread { flex: 1; }
  .index-strip { flex: none; }
  .around { flex: 1 0 auto; }
  .around ul {
    grid-template-rows: repeat(3, minmax(calc(var(--type-small) * 1.25 + var(--type-medium) * 2.56 + 11px),1fr));
  }
  .index-strip li { padding-block: 1px; line-height: 1.25; }
  .around li {
    container: event-cell / size;
    grid-template-rows: max-content minmax(0,1fr);
    row-gap: 2px; padding: 4px 5px;
  }
  .event-title { align-self: start; line-height: 1.22; }

}
@media (max-width: 680px) and (orientation: portrait) and (min-height: 720px) {
  .around ul {
    grid-template-rows: repeat(3, minmax(calc(var(--type-small) * 1.25 + var(--type-medium) * 3.84 + 11px),1fr));
  }
}
@media (max-width: 680px) and (orientation: portrait) and (max-height: 650px) {
  :root { --issue-gap: 3px; --section-height: 1.65rem; }
  .index-strip li { padding-block: 1px; }
  .around li { row-gap: 1px; padding-block: 2px; }
  #year-copies { padding-block: 3px; }
}
@media (max-width: 360px) {
  body { padding-inline: 7px; }
  .event-meta { gap: 3px; grid-template-columns: minmax(max-content, 4.6ch) max-content minmax(0,1fr); }
  #year-copies { padding-inline: 4px; column-gap: 3px; }

  .pager select, .tools button { padding-inline: 1px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root { --section-height: 1.65rem; --issue-gap: 3px; }
  body { padding-top: 0; }
  .mast { padding-block: 2px; }
  .issue-lead { --lead-pad: 5px; --folio-size: 2.25rem; --headline-size: 1.45rem; }
  .index-strip li { padding-block: 2px; }
  .around li { container: event-cell / size; grid-template-rows: max-content minmax(0,1fr); row-gap: 1px; padding-block: 1px; }
  .event-title { align-self: start; line-height: 1.23; }
  .issue > strong, .feature-work, .feature-number { font-size: .79rem; }
  #year-copies { padding-block: 2px; }
  .pager :is(button,select), .tools button { min-height: 32px; }
}

@media (max-width: 680px) and (orientation: portrait) and (max-height: 590px) {
  .mast { padding-block: 2px; }
  .mast button { min-height: 25px; }
  .issue-lead { --lead-pad: 4px; --folio-size: 2.2rem; --headline-size: 1.45rem; }
  .tools button, .pager :is(button,select) { min-height: 34px; }
  .around ul { grid-template-rows: repeat(3,minmax(calc(var(--type-small) * 1.25 + var(--type-medium) * 2.56 + 5px),1fr)); }
  .around li { row-gap: 1px; padding-block: 1px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  main { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 6px; }
  #spread {
    grid-template-areas: "lead context" "contents context";
    grid-template-rows: max-content auto;
    align-items: start;
  }
  .around { align-self: stretch; }
  .print-line { gap: 5px; }
  #spread, #year-copies { grid-column: 1 / -1; }
  .pager, .tools { align-self: start; margin: 0; padding: 0; }
}

@media (max-width: 680px) and (orientation: portrait) and (max-height: 540px) {
  .around ul { --event-lines: 1; grid-template-rows: repeat(3,minmax(calc(var(--type-small) * 1.25 + var(--type-medium) * 1.28 + 5px),1fr)); }
}

#edition-picker {
  width: auto; min-width: 6.7em; min-height: 30px; padding: 2px 4px;
  border: 1px solid #8a7b43; border-radius: 0; color: #ffdf4f;
  background: #222126; line-height: 1.2;
  font-family: inherit; font-size: .85rem; font-weight: 800;
}
#contents-basis { font-size: var(--type-small); }
#extra-evidence, #other-details { margin-block: .6em; }

.index-notice { grid-column: 1 / -1; color: var(--muted); font-size: var(--type-small); }

.index-strip .index-scene {
  display: block; width: fit-content; max-width: 100%; min-height: 0; min-width: 0; padding: 0;
  border: 0; background: transparent; color: var(--red); font-size: var(--type-small);
  line-height: 1.25; text-align: start; text-decoration: underline; text-underline-offset: .18em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

body .flow-line {
  min-width: 0;
  white-space: nowrap;
  overflow: clip;
  text-overflow: clip;
}
.flow-text { display: inline-block; flex: none; }
@media (prefers-reduced-motion: reduce) {
  body .flow-overflow {
    overflow-x: auto;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .flow-overflow::-webkit-scrollbar { display: none; }
}
.mast .flow-line, #year-copies > :last-child { max-width: 100%; }
.reader-panel .flow-line { overflow-wrap: normal; }
#contents details li > .flow-line { display: block; }

/* Six fixed columns within the issue grid, using the existing three type sizes. */
.around li { grid-template-rows: max-content max-content max-content; }
.event-title { min-width: 0; margin: 0; }
button.event-title {
  appearance: none; border: 0; background: transparent; color: inherit;
  min-height: 0; padding: 0; text-align: start; font-family: inherit;
}
button.event-title > .flow-text::after {
  content: " ›" / ""; margin-inline-start: .15em; color: var(--red);
}
button.event-title:is(:hover,:focus-visible) { text-decoration: underline; }
.event-note {
  margin: 0; color: var(--muted); font-size: var(--type-small); line-height: 1.2;
}
[data-event-changed] .event-date { color: var(--red); }
#context-detail .panel-head > div { min-width: 0; }
.context-article { margin-block: 0 1.25rem; }
#context-date { font-size: var(--type-small); color: var(--muted); }
#context-note { font-weight: 700; }
#context-sources { display: flex; gap: 1em; flex-wrap: wrap; font-size: var(--type-small); }
#context-related { list-style: none; padding: 0; margin: 0; }
@media (max-width: 680px) and (orientation: portrait) and (max-height: 540px),
       (orientation: landscape) and (max-height: 345px) {
  .event-note { display: none !important; }
}
