/* ── Campaign flow (full page) ── */
/* Above the story editor's 350, since the flow covers the app entirely while it
   runs — the film is the opening beat and nothing should sit over it. */
.campaign-flow {
    position: fixed; inset: 0;
    display: none;
    z-index: 400;
    background: var(--bg);
}
.campaign-flow.open { display: flex; }

body.campaign-flow-open { overflow: hidden; }

.campaign-flow-close {
    position: absolute; top: 1rem; right: 1.25rem;
    z-index: 2;
    background: none; border: none;
    color: var(--muted); cursor: pointer;
    font-size: 1rem; padding: 6px 10px; border-radius: 4px;
    transition: color 0.15s;
}
.campaign-flow-close:hover { color: var(--cream); }

.campaign-stage {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1.5rem;
    padding: 2.5rem 2rem;
    overflow-y: auto;
}

/* ── The film ── */
/* Sized to the frame rather than the viewport: width is whichever of the three
   is smallest, so the box is always exactly 16:9 and the video fills it edge to
   edge. Fitting it to the whole screen instead is what produced black pillars
   down both sides on anything wider than 16:9. */
.campaign-stage-film { padding: 2rem; justify-content: center; }
.campaign-film {
    position: relative;
    width: min(88vw, 1040px, calc(76vh * 16 / 9));
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 24px 60px var(--shadow-lg);
}
.campaign-intro-video { display: block; width: 100%; height: 100%; }
.campaign-skip,
.campaign-play {
    position: absolute;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: #f2ece2; cursor: pointer;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.12em; text-transform: uppercase;
    backdrop-filter: blur(4px);
    transition: border-color 0.15s, color 0.15s;
}
.campaign-skip {
    bottom: 1rem; right: 1rem;
    padding: 0.5rem 1rem; font-size: 0.7rem;
}
.campaign-play {
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    padding: 0.9rem 2.25rem; font-size: 0.85rem;
}
.campaign-skip:hover,
.campaign-play:hover { border-color: #fff; color: #fff; }

.campaign-mute {
    position: absolute; top: 1rem; right: 3.5rem;
    z-index: 2;
    background: none; border: none;
    cursor: pointer; font-size: 1rem;
    padding: 6px 8px; border-radius: 4px;
    opacity: 0.55;
    transition: opacity 0.15s;
}
.campaign-mute:hover { opacity: 1; }

/* ── Steps ── */
/* Fixed height: the heading block holds a count, a title of one or two lines and
   an optional subtitle, so left to itself it changed height between steps and
   shunted the whole screen up and down. */
.campaign-step-head {
    text-align: center;
    max-width: 46rem;
    min-height: 8.5rem;
    display: flex; flex-direction: column; justify-content: center;
}
.campaign-step-count {
    font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 0.6rem;
}
.campaign-step-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem; font-weight: 300; letter-spacing: 0.08em;
    color: var(--accent);
}
.campaign-step-sub {
    margin-top: 0.75rem;
    font-size: 0.83rem; line-height: 1.7; color: var(--muted);
}

.campaign-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
    width: 100%; max-width: 54rem;
}
.campaign-grid.wide { max-width: 66rem; }

/* An even grid gave the quill a full column of its own, which shoved the two
   pictures off centre to make room for it. Centred flow instead: the art keeps a
   fixed width, the quill takes only what it needs, and the block reads centred. */
.campaign-grid.quilled {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 0.85rem;
}
.campaign-grid.quilled .campaign-tile.has-art { flex: 0 0 15rem; }
.campaign-grid.quilled .campaign-tile-quill   { flex: 0 0 2.6rem; width: 2.6rem; }
/* An empty twin of the quill, leading the row. Centring a row that ends in a
   quill centres the quill too, which walks the pictures off to the left; a
   matching spacer on the other side puts the pictures back on the page's axis. */
.campaign-grid.quilled::before {
    content: '';
    flex: 0 0 2.6rem;
}

/* Art tiles that aren't overlays put their words under the picture, so those
   words centre under it rather than hanging off its left edge. */
.campaign-tile.has-art:not(.overlay) .campaign-tile-label,
.campaign-tile.has-art:not(.overlay) .campaign-tile-note { text-align: center; }

.campaign-tile {
    position: relative;
    display: flex; flex-direction: column; gap: 0.35rem;
    padding: 0.95rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--wash);
    cursor: pointer;
    text-align: start;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.campaign-tile:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-wash); }
.campaign-tile.picked {
    border: 2px solid var(--gold);
    background: var(--gold-wash-2);
    box-shadow: 0 0 0 3px var(--gold-wash), 0 8px 24px var(--shadow-lg);
}
/* Art tiles: the unpicked ones sit back so the chosen one comes forward. */
.campaign-tile.has-art:not(.picked) .campaign-tile-art { filter: saturate(0.8) brightness(0.82); }
.campaign-tile.has-art.picked .campaign-tile-art { filter: saturate(1.15) brightness(1.05); }
.campaign-tile.has-art.picked::after {
    content: '✓';
    position: absolute; top: 0.5rem; right: 0.7rem;
    color: var(--gold); font-size: 0.95rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.campaign-tile.has-art { padding: 0; }
.campaign-tile-art {
    display: block; width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    transition: filter 0.2s;
}
.campaign-tile.has-art .campaign-tile-label,
.campaign-tile.has-art .campaign-tile-note { padding: 0 0.95rem; }
.campaign-tile.has-art .campaign-tile-label { padding-top: 0.7rem; }
.campaign-tile.has-art .campaign-tile-note  { padding-bottom: 0.9rem; }
/* With no note under it, the label is the whole caption strip, so it needs the
   bottom padding the note would otherwise have supplied — without it the words
   sit low in the band instead of centred in it. */
.campaign-tile.has-art .campaign-tile-label:last-child { padding-bottom: 0.7rem; }

/* Overlay variant — name and description ride on the art, held back until the
   pointer is on the tile so the picture gets the first look. */
.campaign-tile.overlay.has-art { display: block; position: relative; }
.campaign-tile.overlay .campaign-tile-label,
.campaign-tile.overlay .campaign-tile-note {
    position: absolute; left: 0; right: 0;
    padding: 0 1rem;
    color: #f3ece1;
    opacity: 0;
    transition: opacity 0.25s;
    text-align: center;
}
.campaign-tile.overlay .campaign-tile-label {
    top: 50%; transform: translateY(-125%);
    font-size: 1.3rem;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9);
}
.campaign-tile.overlay .campaign-tile-note {
    top: 50%; transform: translateY(-10%);
    font-size: 0.76rem; line-height: 1.5;
    color: #ddd4c6;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95);
}
.campaign-tile.overlay:hover:not(:disabled) .campaign-tile-art,
.campaign-tile.overlay:focus-visible .campaign-tile-art,
.campaign-tile.overlay.picked .campaign-tile-art { filter: brightness(0.4); }
.campaign-tile.overlay:hover:not(:disabled) .campaign-tile-label,
.campaign-tile.overlay:hover:not(:disabled) .campaign-tile-note,
.campaign-tile.overlay:focus-visible .campaign-tile-label,
.campaign-tile.overlay:focus-visible .campaign-tile-note,
.campaign-tile.overlay.picked .campaign-tile-label,
.campaign-tile.overlay.picked .campaign-tile-note { opacity: 1; }
.campaign-tile.overlay.picked .campaign-tile-label { color: var(--gold); }
/* No hover on a touch screen, so there the words simply stay up. */
@media (hover: none) {
    .campaign-tile.overlay .campaign-tile-label,
    .campaign-tile.overlay .campaign-tile-note { opacity: 1; }
    .campaign-tile.overlay .campaign-tile-art { filter: brightness(0.4); }
}

.campaign-tile-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem; letter-spacing: 0.05em; color: var(--cream);
}
.campaign-tile.picked .campaign-tile-label { color: var(--gold); }
.campaign-tile-note { font-size: 0.74rem; line-height: 1.55; color: var(--muted); }

/* Crossed out, not hidden — the option still says what it is and why it's shut. */
.campaign-tile.barred {
    cursor: not-allowed;
    opacity: 0.35;
    border-style: dashed;
}
.campaign-tile.barred .campaign-tile-art { filter: grayscale(1); }
.campaign-tile.barred .campaign-tile-label { text-decoration: line-through; }

/* ── Scales ── */
.campaign-scales {
    display: flex; flex-direction: column; gap: 0.2rem;
    width: 100%; max-width: 40rem;
}
.campaign-units {
    justify-self: end;
    background: none;
    border: 1px solid var(--border-strong); border-radius: 999px;
    color: var(--muted); cursor: pointer;
    padding: 0.3rem 0.8rem;
    font-family: 'Nunito', sans-serif; font-size: 0.7rem; letter-spacing: 0.1em;
    transition: border-color 0.15s, color 0.15s;
}
.campaign-units:hover { border-color: var(--gold); color: var(--gold); }

/* One rule per boundary. Bordering both edges of every section drew the bottom of
   one and the top of the next as two lines a pixel apart. */
.campaign-group {
    border-top: 1px solid var(--seam);
    padding: 0.6rem 0;
}
/* No rule above the first section — the panel heading is already its top edge. */
.campaign-scales .campaign-group:first-of-type { border-top: none; }
.campaign-group:last-child { border-bottom: 1px solid var(--seam); }
.campaign-group.off { opacity: 0.4; }

.campaign-group-name {
    display: flex; align-items: center; gap: 0.85rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem; letter-spacing: 0.1em; color: var(--accent);
    padding: 0 0.2rem 0.3rem;
}
/* The section switch already dims the whole block, so its rows don't dim again. */
.campaign-group.off .campaign-scale { opacity: 1; }

.campaign-scale {
    display: grid;
    grid-template-columns: auto 8.5rem 1fr 5rem;
    align-items: center;
    gap: 0.85rem;
    padding: 0.4rem 0.2rem;
    transition: opacity 0.15s;
}
/* Ungrouped rows carry no rules at all — the switch and the label already
   separate them, and a stripe per row was the clutter. */
/* Dimmed, not removed — the player can see what they declined to say. */
.campaign-scale.off { opacity: 0.4; }

.campaign-scale-toggle {
    width: 15px; height: 15px;
    flex-shrink: 0;
    border: 1px solid var(--border-strong); border-radius: 4px;
    background: none; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.campaign-scale-toggle.on { background: var(--gold); border-color: var(--gold); }

.campaign-scale-label {
    font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted);
}
.campaign-scale-read {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem; color: var(--cream); text-align: end;
    font-variant-numeric: tabular-nums;
}

.campaign-scale-range {
    width: 100%;
    accent-color: var(--gold);
    cursor: pointer;
}
.campaign-scale-range:disabled { cursor: not-allowed; }

/* What the number means. A 1-to-9 slider says nothing on its own, so the band
   the value falls in surfaces while the row is under the pointer. */
.campaign-scale { position: relative; }
.campaign-scale-hint {
    position: absolute;
    left: 50%; bottom: calc(100% - 0.5rem);
    transform: translateX(-50%);
    padding: 0.3rem 0.7rem;
    background: var(--panel2);
    border: 1px solid var(--gold);
    border-radius: 6px;
    color: var(--cream);
    font-size: 0.76rem; white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 3;
}
.campaign-scale:hover .campaign-scale-hint,
.campaign-scale:focus-within .campaign-scale-hint { opacity: 1; }
.campaign-scale.off:hover .campaign-scale-hint { opacity: 0; }

/* A grouped row is switched by its heading, so it has no switch column. The
   trailing auto column is for the unit switch, on the one row that carries it. */
.campaign-scale.in-group { grid-template-columns: 8.5rem 1fr 5rem auto; }
.campaign-scale.in-group.is-choice { grid-template-columns: 8.5rem 1fr; }

/* A pill row needs the width a slider doesn't, so it drops the reading column
   and wraps across the rest of the line. */
.campaign-scale.is-choice { grid-template-columns: auto 8.5rem 1fr; }
.campaign-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.campaign-pills .pill-toggle { font-size: 0.72rem; padding: 0.25rem 0.6rem; }
.campaign-row-input {
    grid-column: 3;
    width: 100%; max-width: 16rem;
    margin-top: 0.4rem;
    background: var(--input-dark);
    border: 1px solid var(--border-strong); border-radius: 6px;
    padding: 0.4rem 0.6rem;
    color: var(--cream);
    font-family: 'Nunito', sans-serif; font-size: 0.82rem;
    outline: none;
}
.campaign-row-input:focus { border-color: var(--gold); }

.campaign-free-input {
    width: 100%; max-width: 22rem;
    background: var(--input-dark);
    border: 1px solid var(--border-strong); border-radius: 6px;
    padding: 0.6rem 0.85rem;
    color: var(--cream);
    font-family: 'Nunito', sans-serif; font-size: 0.9rem;
    outline: none;
}
.campaign-free-input:focus { border-color: var(--gold); }
/* Sized to the rows above it rather than to a tile, since that is what it reads
   as a continuation of. */
.campaign-free-area {
    max-width: 40rem;
    min-height: 5rem; resize: vertical;
    line-height: 1.5;
}

/* ── Ring ── */
/* The track is padded by half its own width so the first and last cards can
   still reach the middle; scroll-snap settles each one there. */
.campaign-ring {
    position: relative;
    display: flex; align-items: center;
    width: 100%; max-width: 76rem;
}
.campaign-ring-track {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 1.5rem calc(50% - 10rem);
    scrollbar-width: none;
}
.campaign-ring-track::-webkit-scrollbar { display: none; }

.campaign-ring-item {
    flex: 0 0 20rem;
    scroll-snap-align: center;
    display: flex; flex-direction: column; gap: 0.4rem;
    padding: 0 0 1rem;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--wash);
    cursor: pointer; text-align: center;
    overflow: hidden;
    opacity: 0.35;
    transform: scale(0.8);
    transition: opacity 0.28s ease, transform 0.28s ease, border-color 0.2s;
}
.campaign-ring-item.centre { opacity: 1; transform: scale(1); }
/* A gold hairline was too quiet to read as "chosen" against art. Two pixels of
   gold, a lift off the page, and a warm cast over the picture. */
.campaign-ring-item.picked {
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 3px var(--gold-wash), 0 10px 30px var(--shadow-lg);
    background: var(--gold-wash-2);
}
.campaign-ring-item.picked .campaign-ring-art {
    filter: saturate(1.15) brightness(1.05);
}
.campaign-ring-item:not(.picked) .campaign-ring-art { filter: saturate(0.8) brightness(0.82); }
.campaign-ring-item.barred { opacity: 0.18; cursor: not-allowed; }

.campaign-ring-art {
    display: block; width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    margin-bottom: 0.55rem;
}
.campaign-ring-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem; letter-spacing: 0.06em; color: var(--cream);
    padding: 0 1rem;
}
.campaign-ring-item.picked .campaign-ring-label { color: var(--gold); }
.campaign-ring-note {
    font-size: 0.78rem; line-height: 1.6; color: var(--muted);
    padding: 0 1.1rem;
}
/* A tick on the picked ones, so a choice stays legible once it drifts off-centre. */
.campaign-ring-item.picked::after {
    content: '✓';
    position: absolute; top: 0.6rem; right: 0.9rem;
    color: var(--gold); font-size: 0.9rem;
}
.campaign-ring-item { position: relative; }

.campaign-ring-arrow {
    flex-shrink: 0;
    background: none; border: none;
    color: var(--muted); cursor: pointer;
    font-size: 2rem; line-height: 1; padding: 0 0.5rem;
    transition: color 0.15s;
}
.campaign-ring-arrow:hover { color: var(--gold); }

.campaign-ring-count {
    position: absolute; bottom: -0.35rem; left: 0; right: 0;
    text-align: center;
    font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted);
}

/* ── Character panel ── */
.campaign-character {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    width: 100%; max-width: 52rem;
    align-items: start;
}
.campaign-portrait { display: flex; flex-direction: column; gap: 0.6rem; }
.campaign-portrait-frame {
    position: relative;
    width: 100%; aspect-ratio: 3 / 4;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--wash);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.campaign-portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.campaign-portrait-frame.drawing img { opacity: 0.25; }
.campaign-portrait-frame .modal-loading-spinner { position: absolute; }
.campaign-portrait-btns { display: flex; gap: 0.5rem; }
.campaign-portrait-btns > * { flex: 1; text-align: center; }
/* The input is the click target; the label is what anyone can see. */
.campaign-upload { cursor: pointer; }
.campaign-upload input { display: none; }

.campaign-bio { display: flex; flex-direction: column; gap: 0.75rem; }
.campaign-bio-name {
    width: 100%;
    padding: 0 0 0.15rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.9rem; font-weight: 300; letter-spacing: 0.06em;
    color: var(--accent);
}
/* Capped where the ten-row field it replaced ended, so a long bio scrolls
   rather than pushing the buttons under it off the panel. */
.campaign-bio-text {
    width: 100%;
    max-height: 15.75rem; overflow-y: auto;
    background: var(--input-dark);
    border: 1px solid var(--border-strong); border-radius: 8px;
    padding: 0.85rem 1rem;
    color: var(--text);
    font-family: 'Nunito', sans-serif; font-size: 0.9rem; line-height: 1.75;
    white-space: pre-wrap;
}

.campaign-nav { display: flex; gap: 0.75rem; align-items: center; }
.campaign-nav .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 768px) {
    .campaign-stage { padding: 3.25rem 1rem 2rem; gap: 1.25rem; }
    .campaign-step-title { font-size: 1.5rem; }
    .campaign-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; }
    .campaign-stage-film { padding: 1rem; }
    .campaign-character { grid-template-columns: 1fr; gap: 1.25rem; }
    .campaign-portrait { max-width: 220px; margin: 0 auto; }
    .campaign-scale { grid-template-columns: auto 1fr; row-gap: 0.4rem; }
    .campaign-scale-range, .campaign-pills, .campaign-row-input { grid-column: 1 / -1; }
    .campaign-scale-read { grid-column: 2; text-align: start; }
}

@media (max-width: 768px) {
    .campaign-ring-track { padding: 1rem calc(50% - 7.5rem); gap: 0.75rem; }
    .campaign-ring-item  { flex: 0 0 15rem; }
    .campaign-ring-arrow { display: none; }
}

/* The write-your-own option: a quill at the end of the row, rather than the word
   "Other" repeated down every line of the panel. */
.campaign-quill {
    background: none;
    border: none;
    padding: 0.25rem 0.4rem;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.65;
    transition: opacity 0.15s, color 0.15s;
}
.campaign-quill:hover  { opacity: 1; color: var(--gold); }
.campaign-quill.active { opacity: 1; color: var(--gold); }

/* Same idea one level up: in a step whose other options carry art, the
   write-your-own option is a quill sitting at the foot of the row, not a
   same-sized tile standing empty next to the pictures. */
.campaign-tile-quill {
    align-self: end;
    justify-self: start;
    width: auto;
    padding: 0.4rem 0.6rem;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 1.4rem; line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
}
.campaign-tile-quill:hover  { opacity: 1; color: var(--gold); background: none; }
.campaign-tile-quill.picked { opacity: 1; color: var(--gold); background: none; }
