/* =====================================================================
   SPECTRE — shared components
   Reusable pieces used by several views (post cards, the listen / TTS
   bar, the post tools row). Colours come from the tokens in theme.css.
   ===================================================================== */

/* ---- post / log cards (dashboard, posts index, recent activity) ---- */
.post-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.post-card {
    position: relative;
    padding: 14px 16px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 3px solid var(--pp-dk);
    border-radius: var(--sp-radius);
    transition: border-color 0.2s, background-color 0.2s;
}
.post-card:hover { border-color: rgba(var(--pp-rgb),0.45); border-left-color: var(--pp); background: var(--sp-surface-2); }
.post-card-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 6px;
}
.post-card-title {
    min-width: 0;
    overflow: hidden;
    font-family: var(--sp-font-display);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-card-title a { color: var(--sp-text-hi) !important; text-decoration: none; }
.post-card-title a:hover { color: var(--pp-lt) !important; }
.post-card-irl-date,
.post-card-irl-time {
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
    color: var(--sp-text-dim);
}
.post-card-irl-date { font-weight: 600; color: var(--pp-lt); }
.post-card-meta {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--sp-line);
}
.post-card-authors { font-size: 0.86rem; color: var(--pp); }
.post-card-mission-name { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-align: center; color: var(--sp-text-dim); }
.post-card-mission-name a { color: var(--sp-text-dim) !important; text-decoration: none; }
.post-card-mission-name a:hover { color: var(--pp-lt) !important; }
.post-card-mission-day { font-size: 0.78rem; font-weight: 600; text-align: right; color: var(--pp); }


/* ---- listen / text-to-speech control (posts, bios, wiki) ---- */
.post-listen-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pp-lt);
    background: var(--sp-surface-2);
    border: 1px solid rgba(var(--pp-rgb),0.5);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.listen-btn:hover { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.14); border-color: var(--pp); }
.listen-btn-stop { color: #ffd899; border-color: rgba(var(--sp-warning-rgb),0.55); }
.listen-btn-stop:hover { color: #fff; background: rgba(var(--sp-warning-rgb),0.16); border-color: var(--sp-warning); }
.listen-icon { font-size: 0.7rem; line-height: 1; }
.listen-status { font-size: 0.8rem; font-style: italic; color: var(--sp-text-dim); }
.listen-voice {
    max-width: 210px;
    padding: 5px 8px;
    font-size: 0.78rem;
    color: var(--sp-text);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
}
.listen-rate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.listen-rate-input { accent-color: var(--pp); cursor: pointer; }
.listen-rate-val { min-width: 34px; font-weight: 700; color: var(--pp-lt); }
@media (max-width: 640px) { .listen-voice { max-width: 140px; } .post-listen-bar { gap: 8px; } }

/* Listen row on the post page */
.post-tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0; }
.post-tools-row .post-listen-bar { margin: 0; }

/* ---- page kicker + back link (small label above / beside a page head) ---- */
.sp-kicker {
    margin: 0 0 4px;
    font-family: var(--sp-font-display);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lc-lilac);
}
.sp-back {
    display: inline-block;
    margin: 0 0 14px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---- link rows (lists of posts, pages, revisions) ---- */
.sp-rows { display: flex; flex-direction: column; gap: 8px; margin: 0 0 1.4rem; }
.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 16px;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 3px solid var(--pp-dk);
    border-radius: var(--sp-radius);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-row:hover { color: var(--sp-text); background: var(--sp-surface-2); border-color: rgba(var(--pp-rgb),0.45); border-left-color: var(--pp); text-decoration: none; }
.sp-row.is-current { border-color: rgba(var(--pp-rgb),0.5); border-left-color: var(--pp); }
.sp-row__title { margin: 0; font-family: var(--sp-font-display); font-weight: 600; color: var(--sp-text-hi); }
a.sp-row:hover .sp-row__title { color: var(--pp-lt); }
.sp-row__meta { flex: 0 0 auto; font-size: 0.8rem; color: var(--sp-text-dim); white-space: nowrap; }
.sp-row__sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--sp-text-dim); }
.sp-empty { padding: 2rem 0; text-align: center; font-style: italic; color: var(--sp-text-dim); }

/* ---- tag chips ---- */
.sp-tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-tag:hover { border-color: var(--pp); background: rgba(var(--pp-rgb),0.08); text-decoration: none; }
.sp-tag__name { font-weight: 600; color: var(--sp-text-hi); }
.sp-tag__count {
    min-width: 22px;
    padding: 0 7px;
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    color: var(--pp-ink);
    background: var(--lc-gold);
    border-radius: 999px;
}

/* ---- member profile header + character cards ---- */
.sp-profile { display: flex; align-items: flex-start; gap: 22px; }
.sp-profile__avatar {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border: 2px solid var(--pp);
    border-radius: 50%;
    background: var(--sp-surface-2);
}
.sp-profile__avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-profile__initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: var(--sp-font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--pp);
    background: rgba(var(--pp-rgb),0.1);
}
.sp-profile__body { flex: 1 1 auto; min-width: 0; }
.sp-profile__name { margin: 0 0 4px; font-size: 1.6rem; color: var(--sp-text-hi); }
.sp-profile__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sp-profile__bio { margin: 0; color: var(--sp-text); }
.sp-profile__action { flex: 0 0 auto; }
.sp-profile__stats { display: flex; gap: 28px; margin-top: 14px; }
.sp-profile__stat { text-align: center; }
.sp-profile__stat-num { display: block; font-family: var(--sp-font-display); font-size: 1.35rem; font-weight: 700; line-height: 1.2; color: var(--pp-lt); }
.sp-profile__stat-label { display: block; font-family: var(--sp-font-display); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sp-text-dim); }

.sp-char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 0 0 1.6rem; }
.sp-char {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-char:hover { color: var(--sp-text); background: var(--sp-surface-2); border-color: rgba(var(--pp-rgb),0.5); text-decoration: none; }
.sp-char__img, .sp-char__ph {
    flex: 0 0 auto;
    width: 48px;
    height: 60px;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
}
.sp-char__img { object-fit: cover; object-position: top; }
.sp-char__ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sp-font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pp);
    background: rgba(var(--pp-rgb),0.08);
}
.sp-char__body { min-width: 0; }
.sp-char__name { margin: 0; font-family: var(--sp-font-display); font-size: 0.95rem; font-weight: 600; color: var(--sp-text-hi); }
.sp-char__line { margin: 0; font-size: 0.8rem; color: var(--sp-text-dim); }
.sp-char__rank { margin: 0; font-size: 0.8rem; color: var(--pp); }
.sp-char__tag { font-family: var(--sp-font-display); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; color: var(--lc-lilac); }

@media (max-width: 640px) {
    .sp-profile { flex-wrap: wrap; gap: 14px; }
    .sp-profile__avatar { width: 72px; height: 72px; }
    .sp-profile__action { flex-basis: 100%; }
    .sp-row { flex-wrap: wrap; gap: 4px 12px; }
}

/* ---- checkbox chips (category pickers) ---- */
.sp-check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-check-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 0.9rem;
    color: var(--sp-text);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.sp-check-chip:hover { border-color: rgba(var(--pp-rgb),0.6); }
.sp-check-chip:has(input:checked) { border-color: var(--pp); background: rgba(var(--pp-rgb),0.12); color: var(--sp-text-hi); }
.form-group label.sp-check-chip { display: inline-flex; margin: 0; font-family: var(--sp-font-body); font-size: 0.9rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--sp-text); cursor: pointer; }
.form-group label.sp-check-chip:has(input:checked) { color: var(--sp-text-hi); }
.form-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.form-row > .form-group { flex: 1 1 260px; }
.form-row > .form-group.is-narrow { flex: 0 0 140px; }
.form-error { display: block; margin-top: 5px; font-size: 0.82rem; color: #ffb4b2; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 6px; }
.form-actions .push-right { margin-left: auto; }


/* ---- LCARS theme (body.theme-lcars; see theme.css section 8) ----
   Here rather than in theme.css because this file loads later: the same
   low specificity as the rules above, so a view's own classes still win. */
:where(body.theme-lcars) .post-card,
:where(body.theme-lcars) .sp-row {
    background: var(--sp-bg);
    border: 1px solid rgba(var(--lc-peach-rgb),0.24);
    border-left: 10px solid var(--lc-peach);
    border-radius: 16px 0 0 16px;
}
:where(body.theme-lcars) .post-card:hover,
:where(body.theme-lcars) a.sp-row:hover { background: var(--sp-surface); border-color: rgba(var(--pp-rgb),0.5); border-left-color: var(--lc-orange); }
:where(body.theme-lcars) .sp-row.is-current { border-left-color: var(--lc-orange); }
:where(body.theme-lcars) .post-card-meta { border-top-color: rgba(var(--lc-peach-rgb),0.2); }
:where(body.theme-lcars) .listen-btn { color: var(--pp-ink); background: var(--lc-gold); border: 0; border-radius: 999px; font-size: 0.9rem; }
:where(body.theme-lcars) .listen-btn:hover { color: var(--pp-ink); background: var(--lc-tan); }
:where(body.theme-lcars) .listen-btn-stop { background: var(--lc-red); }
:where(body.theme-lcars) .sp-tag { background: var(--sp-bg); border: 2px solid rgba(var(--lc-lilac-rgb),0.6); }
:where(body.theme-lcars) .sp-tag__count { color: var(--pp-ink); }
:where(body.theme-lcars) .sp-profile__avatar { border: 4px solid var(--lc-orange); }


/* ---- story timeline (public Episodes page; missions/partials/timeline*) ----
   A vertical spine with one dot per episode; sub-episodes sit on their own
   nested spine, indented by --story-tl-indent. Colours are theme tokens only. */
.story-tl-switch {
    display: inline-flex;
    gap: 2px;
    margin: 0 0 1.1rem;
    padding: 3px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: 999px;
}
.story-tl-switch a {
    padding: 4px 16px;
    font-family: var(--sp-font-display);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--sp-text-dim);
    border-radius: 999px;
}
.story-tl-switch a:hover { color: var(--pp-lt); }
.story-tl-switch a.is-active { color: var(--pp-ink); background: var(--pp); }

.story-tl-section + .story-tl-section { margin-top: 1.4rem; }
.story-tl-season { margin-top: 0.6em; }
.story-tl-season__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -0.2em 0 0.6em; font-size: 0.86rem; color: var(--sp-text-dim); }
.story-tl-season__meta strong { font-family: var(--sp-font-mono); color: var(--sp-text-hi); }

.story-tl {
    --story-tl-indent: 30px;
    --story-tl-spine: 9px;              /* left edge of the 2px spine */
    position: relative;
    margin: 0;
    padding: 6px 0 2px var(--story-tl-indent);
    list-style: none;
}
.story-tl::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--story-tl-spine);
    border-left: 2px solid var(--sp-line-strong);
}
.story-tl--nested { margin-top: 12px; }
.story-tl--nested::before { border-left-style: dashed; }

.story-tl__item {
    --story-tl-dot: var(--sp-text-dim);
    position: relative;
    margin: 0;
    padding: 0 0 16px;
}
.story-tl__item:last-child { padding-bottom: 6px; }
.story-tl__item--active    { --story-tl-dot: var(--sp-success); }
.story-tl__item--upcoming  { --story-tl-dot: var(--sp-warning); }
.story-tl__item--completed { --story-tl-dot: var(--sp-text-dim); }
.story-tl__item--hiatus    { --story-tl-dot: var(--sp-danger); }
.story-tl__item--ongoing   { --story-tl-dot: var(--pp); }

.story-tl__dot {
    position: absolute;
    top: 15px;
    left: calc(var(--story-tl-spine) + 1px - var(--story-tl-indent) - 6px);  /* centred on the spine */
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--story-tl-dot);
    box-shadow: 0 0 0 3px var(--sp-bg);
}
.story-tl__item--active > .story-tl__dot { box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--story-tl-dot); }
/* Where the story is now: ONE marker per current deepest episode. An episode holding the current
   sub-episode gets a plain dot; the sub-episode's own dot gives way to a marker on the main
   (outermost) line, joined to its card by a dashed line. --story-tl-main: from an item's left edge
   back to the main line's centre (set on the outer list); --story-tl-step: each nested list's indent. */
.story-tl:not(.story-tl--nested) { --story-tl-main: calc(var(--story-tl-indent) - var(--story-tl-spine) - 1px); --story-tl-step: var(--story-tl-indent); }
.story-tl__item--holds-now { --story-tl-dot: var(--sp-text-dim); }
.story-tl__item--holds-now > .story-tl__dot { box-shadow: 0 0 0 3px var(--sp-bg); }
.story-tl__item--now.story-tl__item--sub > .story-tl__dot { visibility: hidden; }
.story-tl__now {
    position: absolute;
    top: 15px;
    left: calc(0px - var(--story-tl-main) - var(--story-tl-depth, 0) * var(--story-tl-step) - 6px);
    width: calc(var(--story-tl-main) + var(--story-tl-depth, 0) * var(--story-tl-step) + 6px);
    height: 12px;
    pointer-events: none;
    z-index: 1;
}
.story-tl__now::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--story-tl-dot);
    box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--story-tl-dot);
}
.story-tl__now::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 0;
    top: 5px;
    border-top: 2px dashed var(--story-tl-dot);
}

.story-tl__card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 10px 14px 12px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.story-tl__main { flex: 1 1 auto; min-width: 0; }
.story-tl__kicker {
    margin: 0 0 2px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.story-tl__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.story-tl__title {
    margin: 0;
    font-family: var(--sp-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.story-tl__item--sub .story-tl__title { font-size: 1.02rem; }
.story-tl__title a { color: var(--sp-text-hi); text-decoration: none; }
.story-tl__title a:hover { color: var(--pp-lt); }
.story-tl__date {
    margin-top: 3px;
    font-family: var(--sp-font-display);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--pp-lt);
}
.story-tl__stats {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    margin: 8px 0 0;
    padding: 4px 12px;
    font-size: 0.84rem;
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
}
.story-tl__stat { display: flex; gap: 6px; align-items: baseline; }
.story-tl__stat dt { margin: 0; font-weight: 400; color: var(--sp-text-dim); }
.story-tl__stat dd { margin: 0; font-family: var(--sp-font-mono); font-weight: 700; color: var(--sp-text-hi); }
.story-tl__links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.86rem; }
.story-tl__read { font-weight: 600; color: var(--pp); text-decoration: none; }
.story-tl__read:hover { color: var(--pp-lt); }
.story-tl__edit { color: var(--sp-text-dim); text-decoration: none; }
.story-tl__edit:hover { color: var(--pp-lt); }
.story-tl__thumb {
    flex: 0 0 168px;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
    background: var(--sp-surface-2);
}
.story-tl__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 640px) {
    .story-tl { --story-tl-indent: 22px; --story-tl-spine: 6px; }
    .story-tl--nested { --story-tl-indent: 16px; --story-tl-spine: 4px; }
    .story-tl:not(.story-tl--nested) { --story-tl-step: 16px; }
    .story-tl__card { gap: 10px; padding: 9px 10px 10px; }
    .story-tl__thumb { flex-basis: 84px; }
    .story-tl__title { font-size: 1.04rem; }
    .story-tl__item--sub .story-tl__title { font-size: 0.98rem; }
    .story-tl__stats { gap: 2px 12px; padding: 4px 8px; }
}

:where(body.theme-lcars) .story-tl__card {
    background: var(--sp-bg);
    border: 1px solid rgba(var(--lc-peach-rgb),0.24);
    border-left: 10px solid var(--lc-peach);
    border-radius: 16px 0 0 16px;
}
:where(body.theme-lcars) .story-tl__item--active > .story-tl__card { border-left-color: var(--lc-orange); }
:where(body.theme-lcars) .story-tl__stats { background: var(--sp-surface); border-radius: 999px; }


/* ---- Sim History (history/*, App\Support\SimHistory) ----
   Built on the story timeline above (.story-tl spine, dots and cards). Episode
   starts are chapter cards with a full-width banner; years sit on the spine.
   Theme tokens only, so every theme colours it; phone widths stack. */
.sim-hist__intro { margin: 0 0 12px; color: var(--sp-text-dim); }
.sim-hist__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.sim-hist__filters label { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 180px; max-width: 100%; }
.sim-hist__filters label > span {
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.sim-hist__filters select { width: 100%; max-width: 100%; min-width: 0; }
.sim-hist__filter-btns { display: flex; gap: 6px; }
.sim-hist__jump { margin: 0 0 14px; }
.sim-hist__jump summary { cursor: pointer; font-weight: 600; color: var(--pp); }
.sim-hist__jump-group { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-top: 8px; }
.sim-hist__jump-label {
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.sim-hist__jump-group ul { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.sim-hist__jump-group a { overflow-wrap: anywhere; }

.sim-hist .story-tl__item { scroll-margin-top: calc(var(--sp-header-h) + 12px); }
.sim-hist__item--key,
.sim-hist__item--major     { --story-tl-dot: var(--pp); }
.sim-hist__item--event,
.sim-hist__item--backstory,
.sim-hist__item--service   { --story-tl-dot: var(--sp-warning); }
.sim-hist__item--joined,
.sim-hist__item--promoted,
.sim-hist__item--award     { --story-tl-dot: var(--sp-success); }
.sim-hist__item--left      { --story-tl-dot: var(--sp-danger); }
.sim-hist__item--episode,
.sim-hist__item--opened,
.sim-hist__item--posts,
.sim-hist__item--leadership { --story-tl-dot: var(--pp-lt); }

.sim-hist__year {
    position: relative;
    margin: 4px 0 14px calc(0px - var(--story-tl-indent));
    list-style: none;
    scroll-margin-top: calc(var(--sp-header-h) + 12px);
}
.sim-hist__year span {
    display: inline-block;
    padding: 2px 12px;
    font-family: var(--sp-font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--pp-ink);
    background: var(--pp);
    border-radius: 999px;
}
.sim-hist__chapter-card { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; border-color: var(--sp-line-strong); }
.sim-hist__chapter-card .story-tl__main { padding: 10px 14px 12px; }
.sim-hist__chapter-title { font-size: 1.35rem; }
.sim-hist__chapter--sub .sim-hist__chapter-title { font-size: 1.1rem; }
.sim-hist__banner { display: block; aspect-ratio: 16 / 5; overflow: hidden; background: var(--sp-surface-2); border-bottom: 1px solid var(--sp-line); }
.sim-hist__banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sim-hist__end-line { margin: 0; padding: 2px 0; font-size: 0.86rem; color: var(--sp-text-dim); overflow-wrap: anywhere; }
.sim-hist__end-line a { color: var(--sp-text-dim); }
.sim-hist__end .story-tl__dot { top: 6px; width: 8px; height: 8px; margin-left: 2px; }
.sim-hist__note { margin: 6px 0 0; color: var(--sp-text); line-height: 1.55; overflow-wrap: anywhere; }
.sim-hist__more summary { cursor: pointer; list-style: none; }
.sim-hist__more summary::-webkit-details-marker { display: none; }
.sim-hist__more summary .sim-hist__note { display: inline; }
.sim-hist__more-label { font-size: 0.82rem; font-weight: 600; color: var(--pp); white-space: nowrap; }
.sim-hist__more[open] summary { display: none; }
.sim-hist__full { margin-top: 6px; line-height: 1.6; color: var(--sp-text); overflow-wrap: anywhere; }
.sim-hist__action-form { display: inline; margin: 0; }
.sim-hist__pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 1.4rem; }
.sim-hist__page-count { font-size: 0.84rem; color: var(--sp-text-dim); }
.sim-hist__empty { padding: 14px 16px; }
.sim-hist__rest summary { cursor: pointer; font-weight: 600; color: var(--pp); margin: 4px 0 10px; }

/* Character bio */
.sim-hist-bio__add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 12px; }
.sim-hist-bio__hint { font-size: 0.84rem; color: var(--sp-text-dim); }

/* History marks on a post, the editor's Key moment box, the entry forms */
.sim-hist-marks { margin: 18px 0; padding: 10px 14px; background: var(--sp-surface); border: 1px solid var(--sp-line); border-radius: var(--sp-radius); }
.sim-hist-marks > summary { cursor: pointer; font-family: var(--sp-font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--pp-lt); }
.sim-hist-marks--editor { margin: 6px 0 14px; }
.sim-hist-marks__form { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--sp-line); }
.sim-hist-marks--editor .sim-hist-marks__form, .sim-hist-marks--editor { border-top: 0; }
.sim-hist-marks__tick { display: flex; gap: 8px; align-items: baseline; margin: 0 0 8px; cursor: pointer; }
.sim-hist-marks__who { font-size: 0.8rem; color: var(--sp-text-dim); }
.sim-hist-marks__fields { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding-left: 12px; border-left: 3px solid rgba(var(--pp-rgb), 0.4); }
.sim-hist-marks__fields > label { display: flex; flex-direction: column; gap: 3px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sim-hist-marks__fields input[type=text], .sim-hist-marks__fields textarea { width: 100%; max-width: 560px; }
/* "Major event for:" name chips (one per character the viewer may mark) */
.sim-hist-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sim-hist-chips__label { font-size: 0.86rem; color: var(--sp-text-dim); margin-right: 2px; }
.sim-hist-chip { position: relative; display: inline-flex; cursor: pointer; margin: 0; }
.sim-hist-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.sim-hist-chip span { display: inline-block; padding: 3px 11px; border: 1px solid var(--sp-line); border-radius: 999px; font-size: 0.86rem; color: var(--sp-text-dim); background: transparent; line-height: 1.5; }
.sim-hist-chip input:checked + span { background: rgba(var(--pp-rgb), 0.22); border-color: rgba(var(--pp-rgb), 0.75); color: var(--sp-text-hi); }
.sim-hist-chip input:checked + span::before { content: "\2713\00a0"; }
.sim-hist-chip input:focus-visible + span { outline: 2px solid rgba(var(--pp-rgb), 0.9); outline-offset: 2px; }
.sim-hist-marks__promotes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sim-hist-marks__promotes li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sim-hist-marks__pick { display: flex; gap: 6px; flex-wrap: wrap; }
.sim-hist-marks__pick input { flex: 1 1 200px; min-width: 0; }
.sim-hist-marks__help, .sim-hist-form__help { display: block; margin: 0; font-size: 0.82rem; color: var(--sp-text-dim); }
.sim-hist-marks__promote { margin: 6px 0 0; }

/* Admin > Sim History */
.sim-hist-admin__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; margin-bottom: 14px; }
.sim-hist-admin__meta { flex: 1 1 320px; margin: 0 0 10px; font-size: 0.88rem; color: var(--pp-lt); }
.sim-hist-admin__new { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-hist-admin__nowrap { white-space: nowrap; }

@media (max-width: 640px) {
    .sim-hist__year { margin-left: calc(0px - var(--story-tl-indent)); }
    .sim-hist__chapter-title { font-size: 1.15rem; }
    .sim-hist__banner { aspect-ratio: 16 / 7; }
    .sim-hist__filters label { flex-basis: 100%; }
}
