/* ==========================================================================
   Elementary Tools — tool pages (loads after site.css, reuses its vars)
   ========================================================================== */

.tool-page,
.tools-index {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 3rem;
    width: 100%;
}

.tool-header { text-align: center; margin-bottom: 1.5rem; }
.tools-index > .tool-header {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 315px;
    margin-bottom: 2rem;
    padding: 3.25rem clamp(1.25rem, 5vw, 4rem);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0b1118 url('/assets/images/baker-street-evening.webp') center 46% / cover no-repeat;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
}
.tools-index > .tool-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgba(6, 11, 16, 0.86), rgba(6, 11, 16, 0.72) 48%, rgba(6, 11, 16, 0.5));
}
.tools-index > .tool-header h1 { color: #f7f2e9; }
.tools-index > .tool-header .lead { color: #d2d0cb; }
.tools-index > .tool-header .lead strong { color: #fff; }
.tools-index > .tool-header .lead a { color: #6fdbff; }
.tool-header h1 { font-size: 2.2rem; margin: 0.2rem 0 0.8rem; }
.tool-header .lead { color: var(--text-dim); max-width: 46rem; margin: 0 auto; }
.tool-header .lead strong { color: var(--text); }
.tool-eyebrow {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    color: var(--accent);
    margin: 0;
}
.tool-eyebrow a { color: inherit; text-decoration: none; }
.tool-eyebrow a:hover { text-decoration: underline; }

.tool-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}
.tool-footer h2 { color: var(--accent); font-size: 1.2rem; }
.tool-footer p { color: var(--text-dim); }
.tool-footer .content-cta { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

.tool-status { min-height: 1.4em; font-size: 0.95rem; margin: 0.8rem 0 0; }
.tool-status.ok { color: #7ddf8a; }
.tool-status.warn { color: #ffb454; }
.tool-status.busy { color: var(--accent); }

.tool-form textarea,
.tool-form input[type="text"] {
    width: 100%;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}
.tool-form textarea:focus,
.tool-form input:focus { outline: none; border-color: var(--accent); }

.tool-actions { display: flex; gap: 0.75rem; margin-top: 0.9rem; flex-wrap: wrap; }
.tool-actions button { border: none; cursor: pointer; font-family: inherit; }
.tool-actions .button-secondary { border: 1px solid var(--border); }
.tool-actions button:disabled { opacity: 0.55; cursor: wait; transform: none; }

/* --------------------------------------------------------------------------
   Shared Gemini key bar
   -------------------------------------------------------------------------- */
.gemini-key-bar {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.5rem;
}
.gemini-key-bar.key-bar-attention {
    border-color: #ffb454;
    box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.25);
}
.key-bar-status { font-size: 0.9rem; margin-bottom: 0.6rem; }
.key-bar-status.ok { color: #7ddf8a; }
.key-bar-status.warn { color: #ffb454; }
.key-bar-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.key-bar-input {
    flex: 2 1 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-family: monospace;
}
.key-bar-model {
    flex: 1 1 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.45rem 0.5rem;
    font-family: inherit;
}
.key-bar-reveal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0 0.6rem;
    cursor: pointer;
}
.key-bar-reveal:hover, .key-bar-input:focus, .key-bar-model:focus { border-color: var(--accent); outline: none; }
.key-bar-hint { font-size: 0.75rem; color: var(--text-dim); margin: 0.55rem 0 0; }

/* --------------------------------------------------------------------------
   Tools index cards
   -------------------------------------------------------------------------- */
.tools-section-title {
    text-align: center;
    font-size: 1.35rem;
    margin: 2.6rem 0 0.4rem;
    color: var(--text);
}
.tools-section-sub {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.92rem;
    max-width: 40rem;
    margin: 0 auto 1.2rem;
}
.tools-cat-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    vertical-align: middle;
    margin-left: 0.5rem;
}
.cat-pro { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.cat-fun { background: rgba(186, 104, 255, 0.12); color: #c88fff; border: 1px solid #a86fd8; }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.1rem;
}
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.3rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    transition: border-color 0.25s ease, transform 0.15s ease;
}
.tool-card-live:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card-icon { font-size: 2rem; }
.tool-card h3 { margin: 0; font-size: 1.15rem; }
.tool-card p { margin: 0; color: var(--text-dim); font-size: 0.92rem; flex: 1; }
.tool-card-cta { color: var(--accent); font-size: 0.9rem; font-weight: bold; margin-top: 0.5rem; }
.tool-card-soon { opacity: 0.75; }
.tool-card-badge {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 20px;
    padding: 0.15rem 0.6rem;
}
.tools-suggest { text-align: center; color: var(--text-dim); margin-top: 2rem; }

/* --------------------------------------------------------------------------
   Cipher Bureau
   -------------------------------------------------------------------------- */
.cipher-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1.5rem 0;
}
.cipher-tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 24px;
    padding: 0.5rem 1.1rem;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cipher-tab:hover { color: var(--text); border-color: var(--accent); }
.cipher-tab.active { background: var(--accent); color: #001018; border-color: var(--accent); font-weight: bold; }

.cipher-panel { display: none; }
.cipher-panel.active { display: block; }

.cipher-block {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.3rem;
    margin-bottom: 1.2rem;
}
.cipher-block h2 { margin: 0 0 0.5rem; font-size: 1.2rem; color: var(--accent); }
.cipher-note { color: var(--text-dim); font-size: 0.9rem; margin: 0.2rem 0 0.8rem; }
.cipher-label { display: block; font-size: 0.85rem; color: var(--text-dim); margin: 0.7rem 0 0.3rem; }
.cipher-block textarea,
.cipher-block input[type="text"] {
    width: 100%;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}
.cipher-block textarea:focus,
.cipher-block input:focus { outline: none; border-color: var(--accent); }
.cipher-block textarea[readonly] { color: var(--accent); }

.cipher-controls {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 0.8rem 0;
    font-size: 0.95rem;
}
.cipher-controls input[type="range"] { vertical-align: middle; accent-color: var(--accent); }
.cipher-radios { display: flex; gap: 0.9rem; }
.cipher-radios input { accent-color: var(--accent); }

/* Dancing men rendering */
.dm-output {
    background: #f4ecd8; /* aged paper, like the Cubitt letters */
    border-radius: 8px;
    margin-top: 0.8rem;
    padding: 1rem;
    min-height: 76px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px;
    row-gap: 10px;
}
.dm-output-small { min-height: 56px; }
.dm-glyph { width: 30px; height: 46px; }
.dm-glyph line, .dm-glyph path { stroke: #2b2013; stroke-width: 3; stroke-linecap: round; fill: none; }
.dm-glyph .dm-head { fill: none; stroke: #2b2013; stroke-width: 3; }
.dm-glyph .dm-flag { fill: #2b2013; stroke: none; }
.dm-space { width: 18px; }
.dm-literal { color: #6b5b3e; font-size: 1.2rem; align-self: center; }
.dm-placeholder { color: #8a7a5c; font-style: italic; align-self: center; }

.dm-keyboard { display: flex; flex-wrap: wrap; gap: 4px; margin: 0.6rem 0 1rem; }
.dm-key {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 4px 2px 0;
}
.dm-key:hover { border-color: var(--accent); background: var(--accent-soft); }
.dm-key .dm-glyph { width: 22px; height: 34px; }
.dm-key .dm-glyph line, .dm-key .dm-glyph path, .dm-key .dm-glyph .dm-head { stroke: var(--text); stroke-width: 3.5; }
.dm-key-wide { color: var(--text); font-family: inherit; padding: 0 0.8rem; }

.dm-chart {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
}
.dm-chart-cell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    padding: 6px 2px;
}
.dm-chart-cell .dm-glyph { width: 26px; height: 40px; }
.dm-chart-cell .dm-glyph line, .dm-chart-cell .dm-glyph path, .dm-chart-cell .dm-glyph .dm-head { stroke: var(--text); }
.dm-chart-cell span { display: block; color: var(--accent); font-weight: bold; margin-top: 2px; }

/* Caesar cracker */
.crack-results { margin-top: 1rem; }
.crack-note { color: var(--text-dim); font-size: 0.88rem; }
.crack-row {
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.4rem;
    background: var(--bg-card);
}
.crack-best { border-color: #7ddf8a; background: rgba(125, 223, 138, 0.07); }
.crack-shift { color: var(--accent); font-weight: bold; white-space: nowrap; }
.crack-text { color: var(--text); overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Moriarty's Web
   -------------------------------------------------------------------------- */
.web-results { margin-top: 1.8rem; }

.web-verdict {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.6rem;
    flex-wrap: wrap;
}
.web-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    min-height: 96px;
    border-radius: 50%;
    border: 3px solid;
}
.web-score.good { border-color: #7ddf8a; color: #7ddf8a; }
.web-score.mixed { border-color: #ffb454; color: #ffb454; }
.web-score.poor { border-color: #ff6b6b; color: #ff6b6b; }
.web-score-number { font-size: 2rem; font-weight: bold; line-height: 1; }
.web-score-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; }
.web-verdict-body { flex: 1 1 300px; }
.web-claim-heading { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); }
.web-claim-text { font-size: 1.15rem; margin: 0.3rem 0 0.6rem; }
.web-assessment { color: var(--text-dim); margin: 0; font-size: 0.95rem; }

/* Interactive canvas surfaces (ETToolCanvas — see js/shared/tool-canvas.js) */
.web-canvas-wrap, .rt-ribbon-wrap, .toby-map-wrap {
    margin: 1.4rem 0 0.4rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.web-canvas-wrap canvas, .rt-ribbon-wrap canvas, .toby-map-wrap canvas { display: block; }
.web-canvas-hint, .rt-ribbon-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
    margin: 0.45rem 0 1.2rem;
}
.web-detail-heading { margin: 1.8rem 0 0.9rem; font-size: 1.15rem; }
.web-flash, .rt-flash { animation: et-card-flash 1.1s ease; }
@keyframes et-card-flash {
    0%, 45% { outline: 2px solid var(--accent); outline-offset: 3px; }
    100% { outline: 2px solid transparent; outline-offset: 3px; }
}

.web-node {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}
.web-node p { margin: 0.25rem 0 0; font-size: 0.95rem; }
.web-node-tag { font-size: 0.68rem; letter-spacing: 1.5px; color: var(--text-dim); }

.web-node-claim {
    max-width: 30rem;
    margin: 0 auto 3.2rem;
    border-color: var(--accent);
    box-shadow: 0 0 24px rgba(0, 200, 255, 0.12);
}
.web-node-claim .web-node-tag { color: var(--accent); }

.web-premises {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.1rem;
    align-items: start;
}
.web-node-premise.strength-strong { border-left: 3px solid var(--accent); }
.web-node-premise.strength-weak { border-left: 3px solid #ffb454; }
.web-node-premise.strength-unsupported { border-left: 3px solid #ff6b6b; }
.web-node-note { color: var(--text-dim); font-size: 0.85rem !important; margin-top: 0.45rem !important; }

.fallacy-chip {
    margin-top: 0.6rem;
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.5);
    border-radius: 8px;
    font-size: 0.88rem;
}
.fallacy-chip summary {
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    color: #ff8f8f;
    font-weight: bold;
    list-style-position: inside;
}
.fallacy-body { padding: 0 0.7rem 0.6rem; }
.fallacy-body p { color: var(--text-dim); }
.fallacy-body blockquote {
    margin: 0.4rem 0 0;
    padding-left: 0.7rem;
    border-left: 2px solid rgba(255, 107, 107, 0.5);
    color: var(--text);
    font-style: italic;
}
.web-general-fallacies { margin-top: 1.6rem; }
.web-general-fallacies h2 { font-size: 1.15rem; color: #ff8f8f; }

.thread-key { white-space: nowrap; }
.thread-key.strong { color: var(--accent); }
.thread-key.weak { color: #ffb454; }
.thread-key.unsupported { color: #ff6b6b; }

/* --------------------------------------------------------------------------
   Lestrade's Lineup
   -------------------------------------------------------------------------- */
.lineup-intro {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.3rem 1.5rem;
    max-width: 40rem;
    margin: 0 auto;
}
.lineup-intro h2 { margin-top: 0; font-size: 1.2rem; color: var(--accent); }
.lineup-intro ul { color: var(--text-dim); padding-left: 1.2rem; }
.lineup-intro li { margin-bottom: 0.5rem; }
.lineup-intro button { margin-top: 0.6rem; border: none; cursor: pointer; font-family: inherit; }

.lineup-stats { text-align: center; color: var(--text-dim); font-size: 0.85rem; }

.lineup-brief {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin: 1.2rem 0;
}
.lineup-case-title { margin: 0 0 0.3rem; font-size: 1.35rem; }
.lineup-case-meta { color: var(--accent); font-size: 0.9rem; margin: 0 0 0.6rem; }
.lineup-brief p:last-child { margin-bottom: 0; color: var(--text); }

.lineup-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.lineup-budget-wrap { color: var(--text-dim); }
.lineup-budget-wrap strong { color: var(--accent); font-size: 1.2rem; }
.lineup-budget-wrap.budget-low strong { color: #ff6b6b; }
.lineup-controls button { cursor: pointer; font-family: inherit; }

.lineup-suspects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}
.suspect-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.2s ease, transform 0.15s ease;
}
.suspect-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.suspect-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.lineup-suspects.accusing .suspect-card { border-color: #ff6b6b; }
.lineup-suspects.accusing .suspect-card:hover { box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.35); }
.suspect-emoji { font-size: 1.9rem; }
.suspect-name { font-weight: bold; font-size: 1.05rem; }
.suspect-occupation { color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.suspect-bio { color: var(--text-dim); font-size: 0.85rem; }
.suspect-alibi { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

.lineup-chat {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.2rem;
}
.lineup-chat-header { margin: 0 0 0.7rem; font-size: 1.05rem; color: var(--accent); }
.lineup-chat-log {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.2rem 0.2rem 0.6rem;
}
.chat-hint { color: var(--text-dim); font-style: italic; font-size: 0.9rem; }
.chat-bubble {
    max-width: 85%;
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.45;
}
.chat-bubble.from-detective {
    align-self: flex-end;
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.4);
}
.chat-bubble.from-suspect {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.chat-bubble.typing { color: var(--text-dim); font-style: italic; }
.lineup-chat-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.lineup-chat-form input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    font-family: inherit;
}
.lineup-chat-form input:focus { outline: none; border-color: var(--accent); }
.lineup-chat-form button { border: none; cursor: pointer; font-family: inherit; padding: 0.55rem 1.1rem; }

.lineup-reveal {
    background: var(--bg-raised);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1.3rem 1.5rem;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.12);
}
.lineup-reveal h2 { margin-top: 0; }
.lineup-reveal h3 { color: var(--accent); font-size: 1rem; margin-bottom: 0.2rem; }
.lineup-reveal p { color: var(--text-dim); margin-top: 0; }
.reveal-verdict { font-size: 1.05rem; color: var(--text) !important; }
.lineup-reveal button { border: none; cursor: pointer; font-family: inherit; margin-top: 0.5rem; }

/* --------------------------------------------------------------------------
   Mycroft's Memory Palace
   -------------------------------------------------------------------------- */
.palace-journey, .palace-practice { margin-top: 1.8rem; }
.palace-title { margin: 0 0 0.2rem; }
.palace-meta { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 1rem; }

.palace-stations { list-style: none; padding: 0; margin: 0; counter-reset: station; }
.palace-station {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.9rem;
    counter-increment: station;
    position: relative;
}
.palace-station::before {
    content: counter(station);
    position: absolute;
    top: 0.9rem;
    right: 1rem;
    color: var(--border);
    font-size: 1.6rem;
    font-weight: bold;
}
.station-locus { color: var(--accent); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
.station-item { font-weight: bold; font-size: 1.1rem; margin: 0.25rem 0; }
.station-image { color: var(--text-dim); margin: 0.3rem 0; }
.station-anchor { color: var(--text-dim); font-size: 0.85rem; font-style: italic; margin: 0.2rem 0 0; }

.practice-card {
    background: var(--bg-raised);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1.4rem;
    box-shadow: 0 0 26px rgba(0, 200, 255, 0.1);
}
.practice-question { font-size: 1.1rem; margin: 0.8rem 0; }
.practice-answer { color: var(--accent); font-size: 1.25rem; margin: 0.6rem 0; }
.practice-score { font-size: 1.15rem; }
.practice-card button, .palace-practice button, .palace-journey button { border: none; cursor: pointer; font-family: inherit; }
.palace-practice .button-secondary, .palace-journey .button-secondary { border: 1px solid var(--border); }

.palace-saved { margin-top: 2.2rem; }
.palace-saved h2 { font-size: 1.2rem; color: var(--accent); }
.palace-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
}
.palace-row-info { display: flex; flex-direction: column; gap: 0.15rem; }
.palace-row-meta { color: var(--text-dim); font-size: 0.82rem; }
.palace-row-actions { display: flex; gap: 0.5rem; }
.palace-row-actions button {
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 6px;
}
.palace-row-actions .button-primary { border: none; }
.palace-delete:hover { border-color: #ff6b6b; color: #ff6b6b; }

/* --------------------------------------------------------------------------
   The Science of Deduction
   -------------------------------------------------------------------------- */
.sod-level-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.95rem;
}
.sod-level-select:focus { outline: none; border-color: var(--accent); }

.sod-puzzle { margin-top: 1.6rem; }
.sod-intro {
    font-style: italic;
    color: var(--text-dim);
    font-size: 1.05rem;
    border-left: 3px solid var(--accent);
    padding-left: 0.9rem;
}
.sod-puzzle h2 { font-size: 1.15rem; color: var(--accent); margin-bottom: 0.5rem; }
.sod-observations {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1rem 1rem 2.4rem;
    margin: 0 0 1.2rem;
}
.sod-observations li { margin-bottom: 0.5rem; color: var(--text); }
.sod-puzzle button { border: none; cursor: pointer; font-family: inherit; }

.sod-result { margin-top: 1.8rem; }
.sod-score-row { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.sod-remark {
    flex: 1 1 300px;
    margin: 0;
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    font-style: italic;
    color: var(--text);
}
.sod-remark footer { color: var(--text-dim); font-style: normal; font-size: 0.85rem; margin-top: 0.3rem; }
.sod-result h3 { color: var(--accent); font-size: 1.1rem; margin: 1.4rem 0 0.6rem; }

.sod-verdict {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
}
.sod-verdict-badge { white-space: nowrap; font-size: 0.8rem; font-weight: bold; padding-top: 0.15rem; }
.verdict-bullseye { border-left: 3px solid #7ddf8a; }
.verdict-bullseye .sod-verdict-badge { color: #7ddf8a; }
.verdict-close { border-left: 3px solid #ffb454; }
.verdict-close .sod-verdict-badge { color: #ffb454; }
.verdict-miss { border-left: 3px solid #ff6b6b; }
.verdict-miss .sod-verdict-badge { color: #ff6b6b; }
.sod-claim { margin: 0; font-weight: bold; font-size: 0.95rem; }
.sod-comment { margin: 0.25rem 0 0; color: var(--text-dim); font-size: 0.9rem; }

.sod-missed {
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.35);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
}
.sod-truth { margin: 1.4rem 0; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; }
.sod-truth summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: bold; color: var(--accent); }
.sod-truth div { padding: 0 1rem 0.8rem; }
.sod-truth p { color: var(--text-dim); margin: 0.3rem 0; }
.sod-result > button { border: none; cursor: pointer; font-family: inherit; margin-top: 0.6rem; }

/* --------------------------------------------------------------------------
   Eliminate the Impossible
   -------------------------------------------------------------------------- */
.eti-results { margin-top: 1.8rem; }
.eti-problem-card {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.1);
}
.eti-problem-card p { margin: 0.25rem 0 0; font-size: 1.05rem; }

.eti-facts {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin: 1rem 0 1.4rem;
}
.eti-facts h3 { margin: 0 0 0.4rem; font-size: 1rem; color: var(--accent); }
.eti-facts ol { margin: 0; padding-left: 1.4rem; }
.eti-facts li { margin-bottom: 0.35rem; color: var(--text); }

.eti-section-head { color: var(--accent); font-size: 1.1rem; margin: 0 0 0.7rem; }

.eti-hypothesis {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.7rem;
}
.eti-possible { border-left: 3px solid #7ddf8a; }
.eti-improbable { border-left: 3px solid #ffb454; }
.eti-impossible { border-left: 3px solid #ff6b6b; opacity: 0.8; }
.eti-impossible .eti-hyp-text { text-decoration: line-through; text-decoration-color: rgba(255, 107, 107, 0.7); }
.eti-hyp-head { display: flex; gap: 0.7rem; align-items: center; }
.eti-hyp-badge { font-size: 0.75rem; font-weight: bold; letter-spacing: 1px; }
.eti-possible .eti-hyp-badge { color: #7ddf8a; }
.eti-improbable .eti-hyp-badge { color: #ffb454; }
.eti-impossible .eti-hyp-badge { color: #ff6b6b; }
.eti-hyp-source {
    font-size: 0.7rem;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 0.05rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.eti-hyp-text { margin: 0.35rem 0 0; font-weight: bold; }
.eti-hyp-reasoning { margin: 0.3rem 0 0; color: var(--text-dim); font-size: 0.92rem; }
.eti-hyp-contradicts { margin: 0.35rem 0 0; color: #ff8f8f; font-size: 0.88rem; }

.eti-discriminator {
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.4);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin: 1.4rem 0;
}
.eti-discriminator h3 { margin: 0 0 0.3rem; font-size: 1rem; color: var(--accent); }
.eti-discriminator p { margin: 0; }

.eti-conclusion {
    background: var(--bg-raised);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    box-shadow: 0 0 26px rgba(0, 200, 255, 0.12);
}
.eti-conclusion h3 { margin: 0 0 0.4rem; color: var(--accent); }
.eti-conclusion p { margin: 0 0 0.5rem; }
.eti-quote { color: var(--text-dim); font-style: italic; font-size: 0.88rem; margin: 0.6rem 0 0 !important; }

/* --------------------------------------------------------------------------
   Watson's Case Files
   -------------------------------------------------------------------------- */
.wcf-result { margin-top: 1.8rem; }
.wcf-result h3 { margin-top: 1.6rem; }

.wcf-hole {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.7rem;
}
.wcf-critical { border-left: 3px solid #ff6b6b; }
.wcf-critical .eti-hyp-badge { color: #ff6b6b; }
.wcf-moderate { border-left: 3px solid #ffb454; }
.wcf-moderate .eti-hyp-badge { color: #ffb454; }
.wcf-minor { border-left: 3px solid #7ddf8a; }
.wcf-minor .eti-hyp-badge { color: #7ddf8a; }
.wcf-suggestion { margin: 0.4rem 0 0; color: var(--accent); font-size: 0.9rem; }

.wcf-fairplay {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
}
.wcf-fairplay-badge { white-space: nowrap; font-size: 0.8rem; font-weight: bold; padding-top: 0.15rem; }
.fairplay-pass { border-left: 3px solid #7ddf8a; }
.fairplay-pass .wcf-fairplay-badge { color: #7ddf8a; }
.fairplay-shaky { border-left: 3px solid #ffb454; }
.fairplay-shaky .wcf-fairplay-badge { color: #ffb454; }
.fairplay-fail { border-left: 3px solid #ff6b6b; }
.fairplay-fail .wcf-fairplay-badge { color: #ff6b6b; }

.wcf-idea {
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.35);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
}
.wcf-herring { background: rgba(255, 180, 84, 0.08); border-color: rgba(255, 180, 84, 0.4); }
.wcf-twist { background: rgba(148, 0, 211, 0.1); border-color: rgba(186, 104, 255, 0.4); }
.wcf-note { margin: 1.6rem 0 0; }

#wcf-chat { margin-top: 1.6rem; }
#wcf-chat button { border: none; cursor: pointer; font-family: inherit; }

/* --------------------------------------------------------------------------
   The Reichenbach Timeline
   -------------------------------------------------------------------------- */
.rt-results { margin-top: 1.8rem; }
.rt-head { text-align: center; margin-bottom: 1rem; }
.rt-title { margin: 0; }
.rt-span { color: var(--accent); font-size: 0.9rem; letter-spacing: 1px; margin: 0.2rem 0 0; }

.rt-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0 1.6rem;
}
.rt-entity-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.35rem 0.9rem 0.35rem 0.5rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.2s ease;
}
.rt-entity-chip:hover { border-color: var(--accent); }
.rt-entity-chip.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.rt-entity-emoji { font-size: 1.3rem; }
.rt-entity-label { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.rt-entity-label small { color: var(--text-dim); font-size: 0.7rem; }

.rt-rail {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.4rem;
    position: relative;
}
.rt-rail::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--border));
}
.rt-event { position: relative; margin-bottom: 1rem; transition: opacity 0.25s ease; }
.rt-event.dimmed { opacity: 0.25; }
.rt-dot {
    position: absolute;
    left: -1.4rem;
    top: 1.05rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
    box-sizing: border-box;
}
.rt-minor .rt-dot { width: 8px; height: 8px; left: calc(-1.4rem + 2px); border-color: var(--border); }
.rt-pivotal .rt-dot { background: var(--accent); box-shadow: 0 0 12px rgba(0, 200, 255, 0.7); }

.rt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}
.rt-pivotal .rt-card { border-color: var(--accent); box-shadow: 0 0 18px rgba(0, 200, 255, 0.1); }
.rt-minor .rt-card { opacity: 0.9; }
.rt-minor .rt-event-desc { font-size: 0.85rem; }
.rt-when {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 12px;
    padding: 0.1rem 0.6rem;
    margin-bottom: 0.3rem;
}
.rt-event-title { margin: 0.1rem 0 0.25rem; font-size: 1.05rem; }
.rt-minor .rt-event-title { font-size: 0.95rem; }
.rt-event-desc { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.rt-event-who { margin: 0.4rem 0 0; color: var(--text-dim); font-size: 0.8rem; }

/* --------------------------------------------------------------------------
   Professional tools (body.tool-pro): restrained, document-like, exportable
   -------------------------------------------------------------------------- */
body.tool-pro .tool-header {
    text-align: left;
    border-left: 3px solid var(--accent);
    padding-left: 1.1rem;
    margin-bottom: 2rem;
}
body.tool-pro .tool-header h1 { font-size: 1.85rem; margin: 0.15rem 0 0.6rem; }
body.tool-pro .tool-header .lead { margin: 0; max-width: 54rem; font-size: 1rem; }
body.tool-pro .tool-eyebrow { letter-spacing: 1.5px; }
body.tool-pro .web-node-claim,
body.tool-pro .eti-conclusion,
body.tool-pro .practice-card,
body.tool-pro .lineup-reveal { box-shadow: none; }
body.tool-pro .tool-footer h2 { font-size: 1.05rem; }
body.tool-pro .tool-footer p { font-size: 0.92rem; }

/* Export bar */
.export-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border);
    flex-wrap: wrap;
}
.export-bar-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-right: 0.3rem;
}
.export-bar button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}
.export-bar button:hover { border-color: var(--accent); color: var(--accent); }

/* Print: results only, ink-friendly */
@media print {
    .site-header, .site-footer, .gemini-key-bar, .tool-form, .tool-actions,
    .export-bar, .tool-footer, .tool-status, .skip-link,
    #wcf-chat, .lineup-chat, .palace-saved, .sod-controls, #sod-answer-wrap { display: none !important; }
    body { background: #fff !important; color: #111 !important; }
    .tool-page, .tools-index { padding: 0; max-width: none; }
    .tool-header { border-left-color: #111 !important; }
    .tool-header h1, .tool-header .lead, .rt-title, .palace-title { color: #111 !important; text-shadow: none !important; }
    .tool-eyebrow, .rt-span, .station-locus, .web-claim-heading { color: #444 !important; }
    .web-node, .eti-hypothesis, .eti-facts, .eti-problem-card, .eti-discriminator, .eti-conclusion,
    .wcf-hole, .wcf-fairplay, .wcf-idea, .rt-card, .palace-station, .web-verdict, .practice-card {
        background: #fff !important;
        border-color: #999 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .web-node p, .eti-hyp-text, .rt-event-title, .station-item, .sod-claim { color: #111 !important; }
    .eti-hyp-reasoning, .rt-event-desc, .station-image, .station-anchor, .sod-comment,
    .web-node-note, .web-assessment, .rt-event-who, .palace-meta { color: #333 !important; }
    .web-threads { display: none; }
    .rt-rail::before { background: #999 !important; }
    .rt-dot { border-color: #111 !important; background: #fff !important; box-shadow: none !important; }
    .rt-when { background: #eee !important; color: #111 !important; }
    a { color: #111 !important; text-decoration: none; }
}

/* --------------------------------------------------------------------------
   Hobbyist tools (body.tool-fun): gaslight atmosphere, game feel
   -------------------------------------------------------------------------- */
body.tool-fun {
    background:
        radial-gradient(1100px 520px at 50% -140px, rgba(0, 200, 255, 0.09), transparent 65%),
        radial-gradient(900px 500px at 85% 110%, rgba(148, 0, 211, 0.07), transparent 60%),
        var(--bg);
}
body.tool-fun .tool-header h1 {
    font-size: 2.5rem;
    text-shadow: 0 0 28px rgba(0, 200, 255, 0.35);
    letter-spacing: 0.5px;
}
body.tool-fun .tool-header::after {
    content: '❦';
    display: block;
    text-align: center;
    color: var(--accent);
    opacity: 0.65;
    font-size: 1.15rem;
    margin-top: 0.9rem;
}
body.tool-fun .tool-eyebrow { color: #c88fff; }
body.tool-fun .tool-eyebrow a { color: inherit; }

/* Lestrade's Lineup: case-file folder, mugshots, stamps */
body.tool-fun .lineup-brief {
    background: linear-gradient(180deg, #2b251d, #262019);
    border-color: #5a4f38;
    position: relative;
    overflow: hidden;
}
body.tool-fun .lineup-brief::before {
    content: 'CONFIDENTIAL';
    position: absolute;
    top: 14px;
    right: -34px;
    transform: rotate(35deg);
    background: rgba(160, 40, 40, 0.25);
    color: rgba(255, 120, 120, 0.85);
    border-top: 1px solid rgba(255, 120, 120, 0.5);
    border-bottom: 1px solid rgba(255, 120, 120, 0.5);
    font-size: 0.62rem;
    letter-spacing: 3px;
    padding: 3px 40px;
    pointer-events: none;
}
body.tool-fun .lineup-case-title { font-size: 1.5rem; }
body.tool-fun .lineup-case-meta { color: #d9c58a; }

body.tool-fun .suspect-card { padding: 0 0 0.9rem; overflow: hidden; }
body.tool-fun .suspect-emoji {
    display: block;
    text-align: center;
    font-size: 2.6rem;
    padding: 0.7rem 0 0.5rem;
    background:
        repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 14px),
        linear-gradient(180deg, #33302a, #2a2722);
    border-bottom: 1px solid #57503f;
    margin-bottom: 0.5rem;
}
body.tool-fun .suspect-name {
    display: block;
    text-align: center;
    background: linear-gradient(180deg, #9b7b42, #6f5527);
    color: #f8eed2;
    border-radius: 4px;
    margin: 0 0.9rem 0.3rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.98rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
body.tool-fun .suspect-occupation,
body.tool-fun .suspect-bio,
body.tool-fun .suspect-alibi { padding: 0 0.9rem; }

body.tool-fun .lineup-reveal { position: relative; overflow: hidden; }
body.tool-fun .lineup-reveal::after {
    content: 'METROPOLITAN POLICE ✦ SCOTLAND YARD';
    position: absolute;
    bottom: 22px;
    right: -30px;
    transform: rotate(-16deg);
    border: 3px double rgba(0, 200, 255, 0.28);
    color: rgba(0, 200, 255, 0.32);
    border-radius: 10px;
    padding: 8px 34px;
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    pointer-events: none;
}

/* Science of Deduction: field-notebook paper */
body.tool-fun .sod-intro {
    background: #f4ecd8;
    color: #4a3a20;
    border-left: 3px solid #8a6d3b;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    font-family: 'Georgia', serif;
}
body.tool-fun .sod-observations {
    background: #f4ecd8;
    border-color: #c9b98f;
    background-image: repeating-linear-gradient(to bottom, transparent 0 30px, rgba(138, 109, 59, 0.28) 30px 31px);
    background-attachment: local;
    line-height: 31px;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}
body.tool-fun .sod-observations li { color: #2b2013; margin-bottom: 0; }
body.tool-fun .sod-puzzle h2 { color: #d9c58a; }
body.tool-fun .sod-remark { font-family: 'Georgia', serif; }

/* Dancing Men: make them dance */
@keyframes dm-dance {
    from { transform: rotate(-7deg) translateY(0); }
    to { transform: rotate(7deg) translateY(-2px); }
}
body.tool-fun .dm-output .dm-glyph:hover,
body.tool-fun .dm-key:hover .dm-glyph,
body.tool-fun .dm-chart-cell:hover .dm-glyph {
    animation: dm-dance 0.45s ease-in-out infinite alternate;
    transform-origin: 50% 85%;
}
body.tool-fun .cipher-tab.active { box-shadow: 0 0 18px rgba(0, 200, 255, 0.35); }
body.tool-fun .cipher-block h2 { font-size: 1.3rem; }

/* --------------------------------------------------------------------------
   Tool description pages
   -------------------------------------------------------------------------- */
.desc-hero { text-align: center !important; border-left: none !important; padding-left: 0 !important; }
.desc-hero h1 { font-size: 2.4rem; }
.desc-char-plaque {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.35rem 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0.2rem 0 1rem;
}
.desc-char-plaque strong { color: var(--text); }
.desc-char-emoji { font-size: 1.2rem; }
.desc-cta { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; margin-top: 1.4rem; }
.desc-launch { font-size: 1.1rem; padding: 0.85rem 1.7rem; }
.desc-key-note { font-size: 0.85rem; color: var(--text-dim); margin-top: 1rem; }
.desc-key-note.no-key { color: #7ddf8a; }
.desc-section { margin-top: 2.4rem; }
.desc-section h2 { text-align: center; font-size: 1.4rem; margin-bottom: 1.2rem; }
.desc-note p {
    max-width: 44rem;
    margin: 0 auto;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
    border-top: 1px solid var(--border);
    padding-top: 1.4rem;
}
.desc-bottom-cta { text-align: center; }

/* Character badge on tool cards */
.tool-card-char {
    font-size: 0.78rem;
    color: var(--text-dim);
    border-top: 1px dashed var(--border);
    padding-top: 0.5rem;
    margin-top: 0.3rem;
}

/* Grouping toggle on the tools index */
.tools-grouping {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.4rem;
}
.tools-grouping-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
}
.grouping-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.grouping-btn:hover { color: var(--text); border-color: var(--accent); }
.grouping-btn.active { background: var(--accent); color: #001018; border-color: var(--accent); font-weight: bold; }

/* --------------------------------------------------------------------------
   Full-screen app shell (/tools/<slug>/app)
   The old .app-bar was replaced by the shared tool chrome — see
   css/tool-chrome.css and includes/header.php.
   -------------------------------------------------------------------------- */

/* Think Like Sherlock — the campaign detail page (/campaign) */
.campaign-cases { display: flex; flex-direction: column; gap: 0.8rem; }
.campaign-case-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 1rem 1.2rem;
}
.campaign-case-card h3 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
}
.campaign-case-card h3 span {
    font-size: 0.78rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: normal;
}
.campaign-case-card p { margin: 0; line-height: 1.7; color: var(--text); }
.campaign-ranks {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
    line-height: 1.9;
    font-weight: bold;
}

/* Think Like Sherlock — the campaign */
.course-page { max-width: 52rem; margin: 0 auto; }
.course-enroll, .course-head, .course-graduation {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
}
.course-enroll h2, .course-graduation h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.course-enroll > p { color: var(--text-dim); line-height: 1.65; }
.course-axes { display: flex; flex-direction: column; gap: 0.7rem; margin: 1rem 0 1.2rem; }
.course-axis { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr auto; gap: 0.8rem; align-items: center; }
.course-axis-label { display: flex; flex-direction: column; }
.course-axis-label small { color: var(--text-dim); font-size: 0.78rem; line-height: 1.4; }
.course-axis-slider { accent-color: var(--accent); }
.course-axis-value { font-weight: bold; color: var(--accent); min-width: 1.4em; text-align: right; }
@media (max-width: 640px) { .course-axis { grid-template-columns: 1fr; gap: 0.3rem; } }

.course-rank-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.course-rank { font-size: 1.25rem; font-weight: bold; }
.course-xp { color: var(--text-dim); font-size: 0.9rem; }
.course-head .toby-progress { margin-top: 0.6rem; }
.course-progress-label { color: var(--text-dim); font-size: 0.85rem; margin: 0.4rem 0 0; }

.course-case {
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    background: var(--bg-card);
    margin-bottom: 0.9rem;
    overflow: hidden;
}
.course-case.closed { border-left-color: #7ddf8a; }
.course-case.locked { opacity: 0.6; border-left-color: var(--border); }
.course-case-summary {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.1rem;
    cursor: pointer;
    list-style: none;
}
.course-case-summary::-webkit-details-marker { display: none; }
.course-case-emoji { font-size: 1.5rem; }
.course-case-title { flex: 1; display: flex; flex-direction: column; }
.course-case-title small { color: var(--text-dim); font-size: 0.8rem; }
.course-case-state { font-size: 0.82rem; color: var(--text-dim); white-space: nowrap; }
.course-case.closed .course-case-state { color: #7ddf8a; font-weight: bold; }
.course-locked-note { padding: 0 1.1rem 0.9rem; color: var(--text-dim); font-style: italic; margin: 0; }
.course-case-body { padding: 0 1.2rem 1.2rem; }
.course-goal { color: var(--accent); font-weight: bold; line-height: 1.6; }
.course-brief { color: var(--text); line-height: 1.7; }
.course-case-body h3 { color: var(--accent); font-size: 1rem; margin: 1.1rem 0 0.5rem; }

.course-missions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.course-mission { display: flex; gap: 0.8rem; align-items: flex-start; }
.course-check {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: #7ddf8a;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
}
.course-mission.done .course-check { background: rgba(125, 223, 138, 0.15); border-color: #7ddf8a; }
.course-check:hover { transform: scale(1.08); }
.course-mission-body { flex: 1; }
.course-mission.done .course-mission-text { text-decoration: line-through; color: var(--text-dim); }
.course-mission-text { margin: 0.15rem 0 0.2rem; line-height: 1.6; }
.course-mission-measure { margin: 0; color: var(--text-dim); font-size: 0.85rem; line-height: 1.55; }
.course-mission-link { display: inline-block; margin-top: 0.25rem; color: var(--accent); font-size: 0.88rem; }

.course-exam {
    margin-top: 1.2rem;
    border: 1px dashed var(--accent);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    background: var(--accent-soft);
}
.course-exam h3 { margin-top: 0 !important; }
.course-exam-q { line-height: 1.65; margin: 0.5rem 0; }
.course-exam-answer {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.92rem;
    margin: 0.5rem 0 0.7rem;
    resize: vertical;
}
.course-exam-answer:focus { outline: none; border-color: var(--accent); }
.course-exam-feedback { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; }
.course-exam-feedback p { margin: 0; line-height: 1.6; }

.course-delta { display: flex; flex-direction: column; gap: 0.45rem; margin: 1rem 0; }
.course-delta-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
}
.course-delta-nums { color: var(--text-dim); }
.course-delta-badge { font-weight: bold; min-width: 2.2em; text-align: center; border-radius: 6px; padding: 0.15rem 0.4rem; }
.course-delta-badge.up { color: #7ddf8a; background: rgba(125, 223, 138, 0.12); }
.course-delta-badge.down { color: #ff8f8f; background: rgba(255, 143, 143, 0.12); }
.course-delta-badge.flat { color: var(--text-dim); }
.course-final-word { line-height: 1.75; color: var(--text); margin: 1rem 0; }

/* Premium AI extras — one creative follow-up feature per tool */
.ai-extra {
    margin-top: 1.4rem;
    border: 1px dashed var(--accent);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    background: var(--accent-soft);
}
.ai-extra h2 { font-size: 1.05rem; margin: 0 0 0.25rem; }
.ai-extra-tease { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 0.7rem; line-height: 1.55; }
.ai-extra-btn {
    background: var(--accent);
    color: #001018;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: bold;
    cursor: pointer;
    transition: filter 0.2s ease;
}
.ai-extra-btn:hover:enabled { filter: brightness(1.12); }
.ai-extra-btn:disabled { opacity: 0.55; cursor: wait; }
:root[data-theme="parchment"] .ai-extra-btn { color: #fdf6e3; }
.ai-extra-body { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ai-extra-body p { line-height: 1.65; margin: 0; }
.ai-extra-body h3 { font-size: 0.95rem; color: var(--accent); margin: 0.3rem 0 0; }
.ai-extra-body ul, .ai-extra-body ol { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.ai-extra-body li { line-height: 1.6; }
.ai-extra-error { color: #ffb454; }
.ai-extra-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
}
.ai-extra-input:focus { outline: none; border-color: var(--accent); }
.ai-extra-reveal summary { cursor: pointer; color: var(--accent); font-weight: bold; }
.ai-extra-reveal[open] summary { margin-bottom: 0.4rem; }
.ai-extra-note { font-size: 0.82rem; color: var(--text-dim); font-style: italic; }

#et-key-popover {
    position: fixed;
    top: 52px;
    right: 12px;
    z-index: 70;
    width: min(360px, calc(100vw - 24px));
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    animation: et-pop-in 0.18s ease;
}
@keyframes et-pop-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}
.et-key-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
}
.et-key-popover-head strong { font-size: 0.92rem; }
.et-key-popover-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
}
.et-key-popover-close:hover { color: var(--accent); border-color: var(--accent); }
.et-key-popover-body { padding: 0.8rem; }
.et-key-popover-body .gemini-key-bar { margin: 0; border: none; padding: 0; background: transparent; }
@media (prefers-reduced-motion: reduce) { #et-key-popover { animation: none; } }

/* App mode: the tool IS the page — a full-screen shell like the Deduction
   Board. The page fills the viewport between the shared title and status
   bars; wide surfaces (canvases, results, card grids) run full-bleed while
   input forms keep a comfortable measure. */
body.app-mode { display: block; }
body.app-mode .tool-page {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 118px); /* title bar + status bar + padding */
    padding: 1.2rem clamp(1rem, 2.5vw, 2.6rem) 2.5rem;
}
body.app-mode .tool-header { display: none; }
body.app-mode .tool-footer { display: none; }
body.app-mode .tool-form { max-width: 1150px; }
body.app-mode #api-key-bar { max-width: 1150px; }
body.tool-fun.app-mode .tool-header::after { display: none; }

/* --------------------------------------------------------------------------
   Toby's Trail
   -------------------------------------------------------------------------- */
.toby-trail { margin-top: 1.8rem; }
.toby-title { margin: 0 0 0.25rem; }
.toby-quarry { color: var(--text-dim); margin: 0 0 0.8rem; }
.toby-progress {
    height: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.toby-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #7ddf8a);
    border-radius: 6px;
    transition: width 0.4s ease;
}
.toby-progress-label { color: var(--text-dim); font-size: 0.85rem; margin: 0.4rem 0 0; }

.toby-first-action {
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.4);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
    margin: 1.2rem 0 1.4rem;
}
.toby-first-label {
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: var(--accent);
    font-weight: bold;
}
.toby-first-action p { margin: 0.3rem 0 0; font-size: 1.02rem; }

.toby-scents { list-style: none; margin: 0; padding: 0; }
.toby-scent {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    transition: opacity 0.25s ease, border-color 0.25s ease;
}
.toby-scent.done { border-left: 3px solid #7ddf8a; opacity: 0.75; }
.toby-scent.done .toby-scent-step { text-decoration: line-through; text-decoration-color: rgba(125, 223, 138, 0.6); }
.toby-check {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-raised);
    color: var(--text-dim);
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}
.toby-check:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.06); }
.toby-scent.done .toby-check { border-color: #7ddf8a; background: rgba(125, 223, 138, 0.12); }
.toby-scent-body { min-width: 0; }
.toby-scent-step { margin: 0; font-weight: bold; }
.toby-scent-detail { margin: 0.25rem 0 0; color: var(--text-dim); font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Games: trivia + cipher sprint + hub cards
   -------------------------------------------------------------------------- */
.game-card .game-card-actions { display: flex; gap: 0.6rem; margin-top: 0.7rem; }
.game-card .game-card-actions a { font-size: 0.9rem; padding: 0.45rem 1rem; }

.trivia-shell { max-width: 46rem; margin: 0 auto; }
.trivia-stage { min-height: 200px; margin: 1rem 0; }
.trivia-meta { color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.trivia-question { text-align: center; font-size: 1.35rem; margin: 0.6rem 0 1.2rem; }
.trivia-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.trivia-option {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 0.98rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.trivia-option:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.trivia-option.right { border-color: #7ddf8a; background: rgba(125, 223, 138, 0.12); }
.trivia-option.wrong { border-color: #ff6b6b; background: rgba(255, 107, 107, 0.12); }
.trivia-final { text-align: center; font-size: 1.1rem; color: var(--text); margin-bottom: 1.2rem; }
.trivia-stage .button-primary { display: block; margin: 0 auto; border: none; cursor: pointer; font-family: inherit; }

.sprint-hud {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.8rem;
}
.sprint-hud.sprint-low { color: #ff6b6b; font-weight: bold; }
.sprint-glyphs { justify-content: center; min-height: 88px; }
.sprint-form { display: flex; gap: 0.6rem; margin-top: 0.9rem; }
.sprint-form input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-family: inherit;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.sprint-form input:focus { outline: none; border-color: var(--accent); }
.sprint-form button { border: none; cursor: pointer; font-family: inherit; }
.sprint-feedback { text-align: center; min-height: 1.4em; font-size: 0.92rem; }
.sprint-feedback.ok { color: #7ddf8a; }
.sprint-feedback.warn { color: #ffb454; }
.sprint-chart { margin-top: 1.4rem; }
.sprint-chart summary { cursor: pointer; color: var(--text-dim); text-align: center; }
.sprint-chart[open] summary { margin-bottom: 0.8rem; }

/* --------------------------------------------------------------------------
   Stories: the canon library
   -------------------------------------------------------------------------- */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.stories-index > .tool-header {
    background-image: url('/assets/images/stories/adventures.webp');
    background-position: center 52%;
}
.story-collection-visual {
    position: relative;
    overflow: hidden;
    height: clamp(180px, 22vw, 240px);
    margin: 1.1rem 0 1.7rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-raised);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}
.story-collection-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 34%, rgba(6, 10, 14, 0.82) 100%);
    pointer-events: none;
}
.story-collection-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 58%;
}
.story-collection-heading {
    position: absolute;
    z-index: 1;
    right: 1.2rem;
    bottom: 0.95rem;
    left: 1.2rem;
}
.story-collection-heading .tools-section-title {
    margin: 0;
    color: #fff;
    text-align: left;
    text-shadow: 0 2px 9px rgba(0, 0, 0, 0.9);
}
.story-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.25s ease, transform 0.15s ease;
}
.story-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.story-card h3 { margin: 0; font-size: 1.05rem; }
.story-year { color: var(--accent); font-size: 0.75rem; letter-spacing: 1px; margin: 0.15rem 0 0.5rem; }
.story-synopsis { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 0.7rem; }
.story-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.story-tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(0, 200, 255, 0.35);
    border-radius: 12px;
    padding: 0.12rem 0.55rem;
}
.story-tool-links { margin: 0.6rem 0 0; display: flex; flex-direction: column; gap: 0.3rem; }
.story-tool-links a { color: var(--accent); text-decoration: none; font-size: 0.88rem; }
.story-tool-links a:hover { text-decoration: underline; }
.story-hero-image {
    display: block;
    width: 100%;
    height: clamp(160px, 20vw, 220px);
    object-fit: cover;
    object-position: center 58%;
    margin: 1rem auto 1.5rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

/* Deep story-page analysis */
.story-spoiler {
    max-width: 52rem;
    margin: 1.5rem auto 0;
    text-align: center;
    background: rgba(255, 180, 84, 0.1);
    border: 1px solid rgba(255, 180, 84, 0.4);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: #ffb454;
    font-size: 0.9rem;
}
.story-structure .story-acts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 52rem;
    margin: 0 auto;
}
.story-act {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}
.story-act-tag {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 0.4rem;
}
.story-act p { margin: 0; color: var(--text); line-height: 1.7; }

.story-technique .story-example {
    background: var(--accent-soft);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    margin: 0.5rem 0 0;
    font-size: 0.86rem;
    color: var(--text);
}
.story-example-mark {
    display: block;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 0.2rem;
}
.story-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    max-width: 52rem;
    margin: 2.4rem auto 0;
    flex-wrap: wrap;
}
.story-nav a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.92rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: border-color 0.2s ease;
}
.story-nav a:hover { border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Characters section
   -------------------------------------------------------------------------- */
.characters-index > .tool-header {
    background-image: url('/assets/images/characters/sherlock.webp');
    background-position: center 20%;
}
.char-card-image {
    display: block;
    width: 100%;
    height: clamp(190px, 20vw, 230px);
    object-fit: cover;
    object-position: center 20%;
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-raised);
}
.char-card .char-card-role { color: var(--accent); font-size: 0.8rem; margin: 0.1rem 0 0.4rem; }
.char-portrait { font-size: 1.2em; }

/* Character profile: dossier layout — the full uncropped portrait pinned
   beside the reading column, quick facts beneath it. */
.char-page { max-width: 1180px; }
.char-page > .tool-eyebrow { margin-bottom: 1.1rem; }
.char-layout {
    display: grid;
    grid-template-columns: minmax(290px, 400px) 1fr;
    gap: 2.6rem;
    align-items: start;
    margin-bottom: 2.6rem;
}
.char-side { position: sticky; top: 72px; /* clears the sticky nav rail */ }
.char-portrait-frame {
    margin: 0;
    padding: 10px 10px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.28);
}
.char-profile-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: var(--bg-raised);
}
.char-portrait-frame figcaption {
    text-align: center;
    padding: 0.55rem 0.3rem;
    color: var(--text-dim);
    font-size: 0.88rem;
    letter-spacing: 0.8px;
}
.char-facts {
    margin: 1.1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.char-facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 0.5rem;
}
.char-facts dt {
    color: var(--text-dim);
    font-size: 0.74rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.char-facts dd { margin: 0; text-align: right; font-size: 0.9rem; line-height: 1.45; }
.char-facts dd a { color: var(--accent); }

.char-head h1 { margin: 0 0 0.35rem; font-size: 2.15rem; }
.char-quote {
    max-width: 42rem;
    margin: 1.2rem 0 0;
    font-style: italic;
    color: var(--text-dim);
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    text-align: left;
}
.char-traits-section { margin-top: 1.9rem; }
.char-traits-section h2, .char-bio h2 { text-align: left; }
.char-traits { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.char-trait {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 20px;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
}
.char-bio { margin-top: 1.9rem; }
.char-bio p { line-height: 1.75; color: var(--text); }

.char-zoom-hint { opacity: 0.75; font-size: 0.82em; }
.char-gallery-link { margin: 0.9rem 0 0; font-size: 0.85rem; text-align: center; }
.char-gallery-link a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--border); }
.char-gallery-link a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------------------
   Image Gallery (/gallery)
   -------------------------------------------------------------------------- */
.gallery-page { max-width: 1180px; }
.gallery-note { color: var(--text-dim); margin: -0.3rem 0 1.1rem; font-size: 0.92rem; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.3rem;
    align-items: start;
}
.gallery-item {
    margin: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.gallery-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
}
.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 7px;
    background: var(--bg-raised);
}
.gallery-item figcaption {
    padding: 0.55rem 0.35rem 0.3rem;
    font-size: 0.85rem;
    line-height: 1.45;
}
.gallery-item figcaption strong { display: block; }
.gallery-item figcaption a {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
}
.gallery-item figcaption a:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 900px) {
    .char-layout { grid-template-columns: 1fr; gap: 1.6rem; }
    .char-side {
        position: static;
        width: 100%;
        max-width: 430px;
        margin: 0 auto;
    }
    .char-head h1, .char-traits-section h2, .char-bio h2 { text-align: center; }
    .char-head .desc-char-plaque { text-align: center; }
    .char-quote { margin-left: auto; margin-right: auto; }
    .char-traits { justify-content: center; }
}

/* --------------------------------------------------------------------------
   Lore Codex
   -------------------------------------------------------------------------- */
.lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.lore-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.25s ease, transform 0.15s ease;
}
.lore-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lore-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.lore-emoji { font-size: 1.2em; margin-right: 0.2rem; }
.lore-card > p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 0.6rem; }
.lore-card-cta { color: var(--accent); font-size: 0.85rem; font-weight: bold; }
.lore-links { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin: 0; }
.lore-links a { color: var(--accent); text-decoration: none; font-size: 0.82rem; }
.lore-links a:hover { text-decoration: underline; }
.lore-links-stories { margin-top: 0.35rem; border-top: 1px dashed var(--border); padding-top: 0.45rem; }

/* Techniques of Deduction */
.technique-card-tagline { color: var(--accent); font-size: 0.82rem; margin: 0.1rem 0 0.5rem; }
.technique-myth {
    max-width: 52rem;
    margin: 1.5rem auto 0;
    background: rgba(255, 180, 84, 0.09);
    border: 1px solid rgba(255, 180, 84, 0.4);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: var(--text);
    line-height: 1.6;
}
.technique-myth-tag {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #ffb454;
    margin-bottom: 0.35rem;
    font-weight: bold;
}
.technique-body { max-width: 52rem; margin: 1.6rem auto 0; }
.technique-related { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.technique-chip {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 20px;
    padding: 0.35rem 0.9rem;
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.2s ease;
}
.technique-chip:hover { background: var(--accent); color: #001018; }
:root[data-theme="parchment"] .technique-chip:hover { color: #fdf6e3; }
.technique-more { text-align: center; margin-top: 1rem; }
.technique-more a { color: var(--accent); text-decoration: none; }
.technique-examples-intro { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 1rem; }
.technique-spoiler { color: #ffb454; }
.technique-examples { display: flex; flex-direction: column; gap: 0.7rem; }
.technique-example {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
}
.technique-example-story {
    display: inline-block;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 0.35rem;
}
.technique-example-story:hover { text-decoration: underline; }
.technique-example-year { color: var(--text-dim); font-weight: normal; font-size: 0.85rem; }
.technique-example p { margin: 0; color: var(--text); line-height: 1.65; }
.story-technique-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--accent); }
.story-technique-link:hover { color: var(--accent); }

/* Story deeper-reading essay + chapter breakdown */
.story-essay { max-width: 46rem; margin-left: auto; margin-right: auto; }
.story-essay-block { margin-bottom: 1.4rem; }
.story-essay-block h3 { font-size: 1.15rem; color: var(--accent); margin: 0 0 0.5rem; }
.story-essay-block p { line-height: 1.8; color: var(--text); margin: 0 0 0.9rem; }

.story-chapters { max-width: 46rem; margin-left: auto; margin-right: auto; }
.story-chapters-note { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 1rem; }
.story-chapters-note a { color: var(--accent); }
.story-chapter-list { list-style: none; padding: 0; margin: 0; }
.story-chapter-list li {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.2rem 1.1rem;
    margin-bottom: 0.8rem;
}
.story-chapter-label {
    font-weight: bold;
    font-size: 1.05rem;
    line-height: 1.4;
    color: var(--accent);
    letter-spacing: 0.01em;
}
.story-chapter-gloss { color: var(--text); font-size: 0.98rem; line-height: 1.75; }
.story-chapter-insight {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-top: 0.35rem;
    padding: 0.6rem 0.8rem;
    background: var(--accent-soft);
    border-radius: 8px;
}
.story-chapter-insight-tag {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--accent);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* The Reading Room — essays */
.essays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.essay-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.3rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.25s ease, transform 0.15s ease;
}
.essay-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.essay-card h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.essay-dek { color: var(--text-dim); font-size: 0.92rem; margin: 0; flex: 1; }
.essay-meta { color: var(--accent); font-size: 0.8rem; font-weight: bold; }

.essay-byline { color: var(--text-dim); font-size: 0.85rem; }
.essay-body { max-width: 44rem; margin: 1.4rem auto 0; }
.essay-pullquote {
    margin: 0 0 1.8rem;
    padding: 0.4rem 0 0.4rem 1.2rem;
    border-left: 3px solid var(--accent);
    font-size: 1.25rem;
    line-height: 1.5;
    font-style: italic;
    color: var(--text);
}
.essay-section { margin-bottom: 1.8rem; }
.essay-section h2 { font-size: 1.35rem; color: var(--accent); margin: 0 0 0.6rem; }
.essay-section p { line-height: 1.8; color: var(--text); margin: 0 0 1rem; font-size: 1.02rem; }

.essay-links { max-width: 44rem; margin-left: auto; margin-right: auto; }
.essay-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.essay-link-group h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin: 0 0 0.4rem; }
.essay-link-group a { display: block; color: var(--accent); text-decoration: none; font-size: 0.9rem; padding: 0.15rem 0; }
.essay-link-group a:hover { text-decoration: underline; }

/* Lore item detail page */
.lore-item-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.8rem;
    align-items: start;
    max-width: 60rem;
    margin: 0 auto;
}
.lore-facts {
    position: sticky;
    top: 80px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.2rem;
}
.lore-facts h2 {
    margin: 0 0 0.6rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}
.lore-facts dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.lore-facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.lore-facts dd { margin: 0.1rem 0 0; color: var(--text); font-size: 0.9rem; }
.lore-section { margin-bottom: 1.6rem; }
.lore-section h2 { font-size: 1.2rem; color: var(--accent); margin: 0 0 0.5rem; }
.lore-section p { line-height: 1.75; color: var(--text); margin: 0; }
.lore-section .tools-grid, .lore-section .stories-grid { margin-top: 0.4rem; }

@media (max-width: 640px) {
    .lore-item-body { grid-template-columns: 1fr; }
    .lore-facts { position: static; }
}

/* Responsive */
@media (max-width: 640px) {
    .tool-header h1 { font-size: 1.7rem; }
    .tools-index > .tool-header {
        min-height: 280px;
        padding: 2.5rem 1.2rem;
        background-position: 65% center;
    }
    .web-verdict { flex-direction: column; text-align: center; }
    .story-collection-visual { height: 160px; }
    .story-collection-heading {
        right: 0.85rem;
        bottom: 0.75rem;
        left: 0.85rem;
    }
    .story-collection-heading .tools-section-title { font-size: 1.05rem; }
    .story-hero-image { height: 150px; }
    .chat-bubble { max-width: 100%; }
    .sod-score-row { flex-direction: column; text-align: center; }
    .sod-remark { border-left: none; padding-left: 0; }
}

/* Character roster: the supporting cast, linked to their stories */
.char-roster { margin-top: 2.5rem; }
.char-roster-group {
    margin: 1.4rem 0 0.5rem;
    font-size: 1.02rem;
    color: var(--accent, #00c8ff);
}
.char-roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.35rem 1.6rem;
}
.char-roster-list li {
    padding: 0.4rem 0;
    border-bottom: 1px dashed rgba(128, 128, 128, 0.2);
    font-size: 0.92rem;
    line-height: 1.45;
}
.char-roster-list a { text-decoration: none; color: inherit; }
.char-roster-list a:hover strong { color: var(--accent, #00c8ff); }
.char-roster-story {
    display: block;
    font-size: 0.78rem;
    color: var(--muted, #9a9a9a);
    font-style: italic;
}

/* Choice buttons for the negative-evidence & trace trainers */
.dog-options { display: flex; flex-direction: column; gap: 0.55rem; margin: 0.8rem 0; }
.dog-option {
    text-align: left !important;
    width: 100%;
    line-height: 1.45;
    white-space: normal;
}
.dog-option.dog-right { border-color: #3ddc84 !important; box-shadow: 0 0 0 1px #3ddc84 inset; }
.dog-option.dog-wrong { border-color: #ff6b6b !important; box-shadow: 0 0 0 1px #ff6b6b inset; }
.sod-result ul { line-height: 1.7; }
