/* Animated webtoon reader */
/* Layout: a single vertical strip of panels on white, like a phone webtoon reader,
   with a slim transport bar pinned to the bottom of the screen. */
:root {
    --page: #f3f3ef;
    --paper: #fbfbf8;
    --ink: #111111;
    --ink-soft: #5b5b57;
    --rule: #d6d6d0;
    --accent: #e0341f;
    --bar: #111111;
    --bar-ink: #f4f4ef;
    --font-display: 'Bangers', 'Impact', 'Arial Black', sans-serif;
    --font-body: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --page: #1a1a19;
        --ink-soft: #b4b4ad;
        --rule: #3a3a37;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --page: #1a1a19;
    --ink-soft: #b4b4ad;
    --rule: #3a3a37;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font-ui);
}

.wt-top {
    max-width: 760px;
    margin: 0 auto;
    padding-block: 12px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
}

.wt-top a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
}

.wt-top a:hover { text-decoration: underline; }

.wt-top .tag {
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    font-size: 1rem;
    color: var(--ink-soft);
}

.wt-strip {
    max-width: 792px;
    margin: 0 auto;
    padding-bottom: 140px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    position: relative;
}

.wt-panel {
    position: relative;
    margin: 0;
    background: var(--paper);
    overflow: hidden;
}

.wt-panel.bare { background: var(--paper); }

.wt-panel canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Start overlay over the title panel. */
.wt-start {
    position: absolute;
    left: 50%;
    top: 33%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 26px 12px;
    border: 4px solid var(--ink);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 5vw, 2rem);
    letter-spacing: 0.06em;
    box-shadow: 6px 6px 0 var(--ink);
    cursor: pointer;
}

.wt-start:hover { transform: translateX(-50%) translateY(-2px); }
.wt-start:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.wt-start svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.wt-start[hidden] { display: none; }

/* Transport bar. */
.wt-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: var(--bar);
    color: var(--bar-ink);
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
}

.wt-bar-inner {
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "play progress opts";
    align-items: center;
    gap: 10px;
}

.wt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    border: 2px solid var(--bar-ink);
    border-radius: 6px;
    background: transparent;
    color: var(--bar-ink);
    font: 600 0.875rem var(--font-ui);
    cursor: pointer;
}

.wt-btn svg { width: 20px; height: 20px; fill: currentColor; }
.wt-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wt-btn[aria-pressed="false"] { opacity: 0.55; }

.wt-play { grid-area: play; background: var(--accent); border-color: var(--accent); }

.wt-progress {
    grid-area: progress;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.wt-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
}

.wt-meta .chapter {
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    font-size: 0.875rem;
}

.wt-track {
    position: relative;
    height: 16px;
    cursor: pointer;
    touch-action: none;
}

.wt-track::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
}

.wt-fill {
    position: absolute;
    left: 0;
    top: 6px;
    height: 4px;
    border-radius: 2px;
    background: var(--accent);
}

.wt-ticks span {
    position: absolute;
    top: 3px;
    width: 2px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
}

.wt-opts {
    grid-area: opts;
    display: flex;
    gap: 6px;
}

.wt-chapters {
    min-height: 44px;
    max-width: 9.5rem;
    border: 2px solid var(--bar-ink);
    border-radius: 6px;
    background: var(--bar);
    color: var(--bar-ink);
    font: 600 0.8125rem var(--font-ui);
    padding: 0 6px;
}

@media (max-width: 560px) {
    .wt-bar-inner {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "play progress" "opts opts";
        row-gap: 6px;
    }
    .wt-opts { justify-content: flex-end; }
    .wt-chapters { flex: 1 1 auto; max-width: none; }
}

/* Transcript and notes under the strip. */
.wt-after {
    max-width: 760px;
    margin: 0 auto;
    padding-block: 8px 180px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    color: var(--ink);
}

.wt-after h2 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0.04em;
    font-size: 1.75rem;
    margin: 0 0 8px;
}

:root[data-theme="dark"] .wt-after,
:root[data-theme="dark"] .wt-after h2 { color: var(--ink-soft); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .wt-after,
    :root:not([data-theme="light"]) .wt-after h2 { color: var(--ink-soft); }
}

.wt-after details {
    border-top: 1px solid var(--rule);
    padding-block: 12px;
}

.wt-after summary {
    cursor: pointer;
    font-weight: 600;
}

.wt-after p,
.wt-after li {
    max-width: 65ch;
    line-height: 1.55;
}

.wt-script h3 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin: 18px 0 6px;
}

.wt-script p { margin: 4px 0; }
.wt-script .who { font-weight: 700; }
.wt-script .nar { font-style: italic; }

@media (prefers-reduced-motion: reduce) {
    .wt-start:hover { transform: translateX(-50%); }
}
