/* The Slayer Guide. Themes are sets of variables; layouts are rules keyed on html[data-layout]. */

:root,
html[data-theme="stone"] {
    --bg: #15171a;
    --panel: #1d2024;
    --input: #0f1113;
    --line: #2c3036;
    --line-strong: #5a616b;
    --text: #e8e6e1;
    --soft: #c5c9cf;
    --muted: #9ba1a9;
    --accent: #e0564a;
    --accent-ink: #15171a;
    --gp: #e2b552;
    --do: #7fd19b;
    --do-bg: #1e3327;
    --skip: #e2b552;
    --skip-bg: #3a3018;
    --block: #f0857b;
    --block-bg: #3b201d;
    --locked: #9ba1a9;
    --locked-bg: #24272c;
    --font: 'Barlow', system-ui, sans-serif;
    --display: 'Barlow Condensed', 'Barlow', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --display-case: uppercase;
    --radius: 6px;
    color-scheme: dark;
}

html[data-theme="navy"] {
    --bg: #0f1b2d;
    --panel: #172741;
    --input: #0b1524;
    --line: #24385a;
    --line-strong: #4a6187;
    --text: #eaf0f8;
    --soft: #c9d6e8;
    --muted: #9fb0c8;
    --accent: #4cc2c9;
    --accent-ink: #0b1524;
    --gp: #f2a65a;
    --do: #4cc2c9;
    --do-bg: #12343f;
    --skip: #f2a65a;
    --skip-bg: #3a2a18;
    --block: #f28b8b;
    --block-bg: #3a1f28;
    --locked: #9fb0c8;
    --locked-bg: #1b2a44;
    --font: 'Manrope', system-ui, sans-serif;
    --display: 'Manrope', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --display-case: none;
    --radius: 8px;
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg: #f4f5f2;
    --panel: #ffffff;
    --input: #ffffff;
    --line: #d8dcd5;
    --line-strong: #8a928a;
    --text: #171b18;
    --soft: #343b36;
    --muted: #556058;
    --accent: #b5382d;
    --accent-ink: #ffffff;
    --gp: #8a5a00;
    --do: #1e6a4b;
    --do-bg: #e0f0e6;
    --skip: #8a5a00;
    --skip-bg: #f6ecd2;
    --block: #b5382d;
    --block-bg: #f8e1de;
    --locked: #556058;
    --locked-bg: #e9ece7;
    --font: 'Barlow', system-ui, sans-serif;
    --display: 'Barlow Condensed', 'Barlow', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --display-case: uppercase;
    --radius: 6px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.4;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.num { font-family: var(--mono); font-size: 13px; text-align: right; white-space: nowrap; }
.gp { color: var(--gp); }
.good { color: var(--do); }
.bad { color: var(--block); }
.inline { display: inline; }

/* ---------------------------------------------------------------- shell */

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    padding: 8px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-family: var(--display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.03em;
    text-transform: var(--display-case);
    text-decoration: none;
}

.sections { display: flex; flex-wrap: wrap; gap: 4px; flex-grow: 1; }

.sections a,
.masters a {
    display: flex;
    min-height: 44px;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}

.sections a { align-items: center; padding: 0 12px; font-weight: 500; }
.sections a.on, .sections a:hover { color: var(--text); }
.sections a.on { border-bottom-color: var(--accent); }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.prefs { display: flex; flex-wrap: wrap; gap: 8px; }

.setup-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    max-width: 260px;
    padding: 0 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.segmented {
    display: flex;
    padding: 2px;
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.segmented button {
    min-height: 30px;
    padding: 0 10px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    font-size: 13px;
    font-weight: 500;
}

.segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.link {
    padding: 8px 4px;
    background: none;
    border: 0;
    color: var(--soft);
    text-decoration: underline;
}

.masters {
    display: flex;
    gap: 2px;
    padding: 0 24px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
}

.masters a { flex-direction: column; justify-content: center; padding: 6px 12px; white-space: nowrap; }
.masters a.on, .masters a:hover { color: var(--text); }
.masters a.on { border-bottom-color: var(--accent); }
.master-name { font-weight: 600; }
.master-where { display: none; font-size: 12px; color: var(--muted); }

.main { padding: 24px; min-width: 0; }
.footer { padding: 16px 24px 32px; color: var(--muted); font-size: 13px; }

.flash {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--do-bg);
    color: var(--do);
    border: 1px solid var(--do);
    border-radius: var(--radius);
}

/* Focus layout: masters become a sidebar. */
@media (min-width: 1000px) {
    html[data-layout="focus"] .shell {
        display: grid;
        grid-template-columns: 232px minmax(0, 1fr);
        grid-template-areas: "top top" "side main" "side foot";
        min-height: 100vh;
        grid-template-rows: auto 1fr auto;
    }
    html[data-layout="focus"] .topbar { grid-area: top; }
    html[data-layout="focus"] .main { grid-area: main; }
    html[data-layout="focus"] .footer { grid-area: foot; }
    html[data-layout="focus"] .masters {
        grid-area: side;
        flex-direction: column;
        padding: 16px 12px;
        overflow: visible;
        border-bottom: 0;
        border-right: 1px solid var(--line);
    }
    html[data-layout="focus"] .masters a {
        min-height: 52px;
        padding: 6px 12px;
        white-space: normal;
        border-bottom: 0;
        border-radius: var(--radius);
    }
    html[data-layout="focus"] .masters a.on { background: var(--panel); }
    html[data-layout="focus"] .masters a.on .master-name { color: var(--accent); }
    html[data-layout="focus"] .master-where { display: block; }
}

/* ---------------------------------------------------------------- page */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 20px;
}

.eyebrow { color: var(--muted); font-size: 13px; }

h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: 40px;
    line-height: 1.05;
    text-transform: var(--display-case);
    letter-spacing: 0.01em;
}

h2 {
    font-family: var(--display);
    font-size: 17px;
    font-weight: 700;
    text-transform: var(--display-case);
    letter-spacing: 0.04em;
}

.lede { max-width: 680px; margin-top: 8px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.btn, .chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover, .chip:hover { background: var(--panel); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--block); border-color: var(--block); }
.chip { min-height: 36px; border-color: var(--line); color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    margin-bottom: 20px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.stat { padding: 14px 18px; background: var(--panel); }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; }
.stat-value { margin-top: 4px; font-family: var(--mono); font-weight: 500; font-size: 24px; }

/* The rail comes first in the markup: beside the table on wide screens, above it when it wraps. */
.board { display: flex; flex-wrap: wrap; flex-direction: row-reverse; align-items: flex-start; gap: 20px; }
.board > .content { flex: 1 1 1180px; min-width: 0; }
.rail { flex: 1 1 300px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
html[data-layout="focus"] .board > .content { order: 1; flex-basis: 100%; }
html[data-layout="focus"] .rail { order: 2; flex-basis: 100%; }

.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card > h2 { padding: 12px 16px; background: var(--panel); }
.card-body { padding: 14px 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--soft); }
.kv span:last-child { font-family: var(--mono); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }

th {
    padding: 10px 8px;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

th.num { font-family: var(--font); font-size: 12px; }
td { padding: 5px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tr.off td { color: var(--muted); }
tr.off .task-name { color: var(--soft); }
tr.section td { padding: 12px 16px; background: var(--panel); }

.task-name { font-weight: 600; white-space: nowrap; }
.task-where { color: var(--muted); font-size: 12px; }
.warn { color: var(--skip); font-size: 12px; }

select, input[type="number"], input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
    min-height: 34px;
    padding: 0 8px;
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: 4px;
}

select:hover, input:hover { border-color: var(--line-strong); }
td select { width: 100%; max-width: 280px; }
td select.variant { min-width: 240px; }
td select.bracelet { min-width: 118px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="number"] { width: 84px; font-family: var(--mono); font-size: 13px; text-align: right; }
input.changed { border-color: var(--accent); }

select.act { font-weight: 600; min-width: 92px; }
select.act-do { background: var(--do-bg); color: var(--do); border-color: var(--do); }
select.act-skip { background: var(--skip-bg); color: var(--skip); border-color: var(--skip); }
select.act-block { background: var(--block-bg); color: var(--block); border-color: var(--block); }
select.act-locked { background: var(--locked-bg); color: var(--locked); border-color: var(--line-strong); }
select.act option { background: var(--input); color: var(--text); }

/* ---------------------------------------------------------------- focus layout */

.focus { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.focus-list { flex: 1 1 320px; max-width: 440px; display: flex; flex-direction: column; gap: 3px; max-height: 78vh; overflow-y: auto; padding-right: 4px; }
.focus-detail { flex: 2 1 460px; min-width: 0; }
.focus-heading { padding: 12px 4px 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; }

.task-btn {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    gap: 10px;
    align-items: center;
    min-height: 46px;
    padding: 4px 12px;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
}

.task-btn:hover { background: var(--panel); }
.task-btn[aria-pressed="true"] { background: var(--panel); border-color: var(--accent); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--locked); }
.dot-do { background: var(--do); }
.dot-skip { background: var(--skip); }
.dot-block { background: var(--block); }
.tag { font-size: 12px; color: var(--muted); }
.tag-do { color: var(--do); }
.tag-skip { color: var(--skip); }
.tag-block { color: var(--block); }

.action-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 4px; padding: 4px; background: var(--panel); border-radius: var(--radius); }
.action-switch button { min-height: 44px; background: transparent; color: var(--soft); border: 0; border-radius: calc(var(--radius) - 2px); font-weight: 600; }
.action-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.sub { margin: 22px 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; }

.variant-head, .variant-btn { display: grid; grid-template-columns: 1fr 72px 92px 92px; gap: 12px; align-items: center; }
.variant-head { padding: 0 14px 6px; color: var(--muted); font-size: 12px; }
.variant-list { display: flex; flex-direction: column; gap: 4px; }
.variant-btn { min-height: 46px; padding: 4px 14px; text-align: left; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); }
.variant-btn:hover { border-color: var(--line-strong); }
.variant-btn[aria-pressed="true"] { background: var(--panel); border-color: var(--accent); }
.variant-btn strong { font-weight: 600; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.option { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 58px; padding: 6px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.option[aria-pressed="true"] { border-color: var(--accent); }
.option:disabled { opacity: 0.55; cursor: not-allowed; }
.option small { color: var(--muted); font-size: 12px; }
.option select { width: 100%; }

.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; margin-top: 22px; padding: 18px; background: var(--panel); border-radius: var(--radius); }
.results .stat-value { font-size: 20px; }

/* ---------------------------------------------------------------- config, setups, forms */

.columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.columns > .narrow { flex: 1 1 360px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.columns > .wide { flex: 2 1 520px; min-width: 0; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 6px 16px; border-top: 1px solid var(--line); }
.setting label { font-weight: 500; }
.setting small { display: block; color: var(--muted); font-size: 12px; }
.setting input[type="checkbox"] { width: 22px; height: 22px; }
.setting select { min-width: 160px; }

.boss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.boss-grid label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 4px 16px; background: var(--bg); }
.boss-grid input { width: 64px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--panel); }

.setup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.setup.active { background: var(--panel); border-color: var(--line-strong); }
.setup + .setup { margin-top: 12px; }
.setup h3 { font-size: 18px; font-weight: 600; }
.setup-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-family: var(--mono); font-size: 13px; }
.setup-meta span span { font-family: var(--font); color: var(--muted); }
.setup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { padding: 2px 8px; background: var(--do-bg); color: var(--do); border: 1px solid var(--do); border-radius: 3px; font-size: 12px; font-weight: 600; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.share-row input { flex: 1 1 260px; font-family: var(--mono); font-size: 13px; min-height: 40px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field input { min-height: 44px; width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row input[type="text"] { flex: 1 1 200px; min-height: 40px; }
.error { color: var(--block); font-size: 13px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
input[type="file"] { padding: 18px 12px; width: 100%; background: var(--input); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.auth { max-width: 420px; margin: 24px auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar input[type="search"] { min-height: 40px; min-width: 260px; }
.check { display: flex; align-items: center; gap: 8px; }

@media (max-width: 700px) {
    .topbar, .masters, .main, .footer { padding-left: 16px; padding-right: 16px; }
    h1 { font-size: 32px; }
    .variant-head, .variant-btn { grid-template-columns: 1fr 56px 76px 76px; gap: 8px; }
}
