:root {
    --bg: #fff7f2;
    --ink: #2a1810;
    --muted: #8a6556;
    --card: #ffffff;
    --line: #f0d2c2;
    --orange: #e85d04;
    --orange-deep: #c2410c;
    --ok: #15803d;
    --bad: #b91c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(900px 280px at 10% -10%, rgba(232, 93, 4, 0.16), transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, sans-serif;
}

a { color: var(--orange-deep); }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: #fff;
    border-bottom: 3px solid var(--orange);
    position: sticky;
    top: 0;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand img {
    border-radius: 12px;
    background: #fff;
}

.brand strong {
    display: block;
    font-size: 22px;
    letter-spacing: 0.08em;
}

.brand small {
    color: var(--muted);
}

.brand em {
    font-style: normal;
    color: var(--orange-deep);
    font-weight: 700;
}

nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover,
.btn.is-on {
    background: #fff1e8;
    color: var(--orange-deep);
    border-color: #fdba74;
}

.btn:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.ico {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: block;
}

html[data-theme="dark"] .ico-moon { display: none; }
html:not([data-theme="dark"]) .ico-sun { display: none; }

main {
    width: min(1280px, calc(100% - 32px));
    margin: 24px auto 40px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.cards-tight {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin: 12px 0 20px;
}

.cards article {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(194, 65, 12, 0.05);
}

.cards span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.cards strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.cards small {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.hint {
    margin: 0 0 12px;
    color: var(--muted);
}

.panel {
    margin-top: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}

.panel-head h1,
.prose h1 {
    margin: 0 0 6px;
}

.panel-head p,
.prose p,
.prose li {
    color: #5c4036;
    line-height: 1.45;
}

.tools {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 12px 0;
}

.tools input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 220px;
    font: inherit;
}

.tools p { margin: 0; color: var(--muted); }

.head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.head-row h1 { margin: 0; }

.chart-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 8px;
}

.chart-tools p {
    margin: 0;
    font-weight: 700;
    color: var(--ink);
}

.chart-zoom {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

#eqChart {
    width: 100%;
    height: 320px;
    display: block;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #f6e4da;
    white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; font-size: 13px; }

tbody tr { cursor: pointer; }
tbody tr:hover { background: #fff4ec; }

.people-cards { display: none; }

.person {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 14px 12px;
    box-shadow: 0 8px 24px rgba(194, 65, 12, 0.06);
    cursor: pointer;
}

.person.is-on { border-color: #fdba74; }

.person-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.person-top h2 {
    margin: 0;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.person-link { color: var(--muted); font-size: 14px; white-space: nowrap; }

.person-meta {
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 13px;
}

.person-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.person-stats div {
    background: #fff7f2;
    border-radius: 12px;
    padding: 8px 10px;
}

.person-stats .wide { grid-column: 1 / -1; }

.person-stats span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.person-stats strong {
    display: block;
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.people-empty {
    margin: 0;
    color: var(--muted);
}

.pos { color: var(--ok); }
.neg { color: var(--bad); }
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background: #d6d3d1;
}
.dot.on { background: #16a34a; }

.prose {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px 24px 28px;
}

.kicker {
    color: var(--orange-deep);
    font-weight: 700;
    margin-bottom: 4px;
}

canvas {
    width: 100%;
    height: auto;
    background: #fffaf7;
    border: 1px solid var(--line);
    border-radius: 14px;
}

footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 8px 16px 24px;
    font-size: 14px;
    text-align: center;
}

.slogan {
    margin: 0;
    max-width: 34em;
    line-height: 1.4;
    color: var(--ink);
}

.foot-links {
    margin: 0;
    font-size: 13px;
}

.foot-links a { color: var(--muted); }


.callout {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffaf7;
}

.callout-k {
    color: var(--orange-deep);
    font-weight: 700;
    font-size: 13px;
}

.facts, .vps-options, .steps {
    display: grid;
    gap: 12px;
}

.facts { grid-template-columns: repeat(3, 1fr); margin: 12px 0; }
.vps-options { grid-template-columns: repeat(3, 1fr); }
.steps { margin: 18px 0; }

.facts article, .vps-options article, .steps article {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}

.facts span, .step-num {
    color: var(--muted);
    display: block;
}

.step-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--orange-deep);
}

.steps article { display: flex; gap: 12px; }

.video-frame video { width: 100%; border-radius: 12px; background: #111; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(42, 24, 16, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 20;
}

.modal.hidden { display: none; }

.modal-card {
    width: min(520px, 100%);
    background: #fff;
    color: var(--ink);
    border-radius: 16px;
    padding: 16px;
}

.modal-head, .modal-card form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.modal-card input, .modal-card textarea {
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
}

.ask-trap {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}

.ask-status.is-ok { color: var(--ok); }
.ask-status.is-bad { color: var(--bad); }
#askSubmit { align-self: flex-start; }

html[data-theme="dark"] {
    --bg: #1c1410;
    --ink: #f6efe9;
    --muted: #d7b5a4;
    --card: #2a211c;
    --line: #5a3d32;
    --ok: #4ade80;
    --bad: #fca5a5;
}

html[data-theme="dark"] body {
    background: var(--bg);
    color: var(--ink);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .prose,
html[data-theme="dark"] .callout,
html[data-theme="dark"] .facts article,
html[data-theme="dark"] .vps-options article,
html[data-theme="dark"] .steps article,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .btn,
html[data-theme="dark"] canvas {
    background: #241c18;
    color: var(--ink);
}

html[data-theme="dark"] .panel-head p,
html[data-theme="dark"] .prose p,
html[data-theme="dark"] .prose li {
    color: #ead8cf;
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .person:active { background: #3a2a24; }

html[data-theme="dark"] .person-stats div { background: #1c1410; }
html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .btn.is-on {
    background: #3a2a24;
    color: #fdba74;
    border-color: #fdba74;
}

@media (max-width: 900px) {
    .cards, .cards-tight, .facts, .vps-options { grid-template-columns: 1fr 1fr; }
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 6px 10px 8px;
    }
    .brand { gap: 6px; min-width: 0; }
    .brand small { display: none; }
    .brand strong { font-size: 16px; letter-spacing: 0.04em; }
    .brand img { width: 28px; height: 28px; border-radius: 8px; }
    .brand em { font-size: 12px; }
    nav {
        flex-wrap: wrap;
        justify-content: flex-start;
        overflow: visible;
        gap: 4px;
        min-width: 0;
    }
    .topbar.is-min nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .topbar.is-min nav::-webkit-scrollbar { display: none; }
    .btn { padding: 6px 8px; font-size: 13px; }
    .topbar.is-min {
        flex-direction: row;
        align-items: center;
        padding: 4px 8px;
        gap: 6px;
        box-shadow: 0 4px 16px rgba(42, 24, 16, 0.08);
    }
    .topbar.is-min nav { flex: 1; justify-content: flex-end; }
    .topbar.is-min .brand img { width: 22px; height: 22px; }
    .topbar.is-min .brand strong { font-size: 14px; }
    .topbar.is-min .brand em { font-size: 11px; }
    .topbar.is-min .btn-label { display: none; }
    .topbar.is-min .btn { padding: 6px; gap: 0; }
    main { width: calc(100% - 16px); margin: 10px auto 20px; }
    .cards, .cards-tight { gap: 8px; }
    .cards article { padding: 8px 10px; border-radius: 12px; }
    .cards span { font-size: 11px; }
    .cards strong { font-size: 16px; margin-top: 2px; }
    .cards small { font-size: 11px; }
    .panel { padding: 10px; border-radius: 14px; margin-top: 10px; }
    .prose { padding: 14px 12px 16px; }
    .callout { padding: 10px; margin: 10px 0; }
    .facts article, .vps-options article, .steps article { padding: 8px 10px; }
    .steps { margin: 10px 0; gap: 8px; }
    .step-num { font-size: 18px; }
    .tools { flex-direction: column; align-items: stretch; margin: 8px 0; }
    .tools input { min-width: 0; width: 100%; }
    #eqChart { height: 200px; }
    footer { padding: 4px 12px 16px; }
    .slogan { font-size: 14px; }
}

.guide-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 8px;
}

.guide-toc a {
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fffaf7;
    color: var(--ink);
    font-size: 14px;
}

.guide-toc a:hover {
    border-color: #fdba74;
    color: var(--orange-deep);
}

.shot {
    margin: 16px 0 20px;
}

.shot a {
    display: block;
    cursor: zoom-in;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #f3f4f6;
    box-shadow: 0 12px 32px rgba(194, 65, 12, 0.08);
}

.shot img {
    display: block;
    width: 100%;
    height: auto;
}

.shot figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0 18px;
}

.fields article,
.walk article {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
}

.fields h3,
.walk h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.fields p,
.fields li,
.walk p {
    margin: 0 0 8px;
}

.fields ul,
.wish ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.fields li + li,
.wish li + li {
    margin-top: 4px;
}

.math {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 10px 0;
}

.math div {
    background: #fff7f2;
    border-radius: 12px;
    padding: 8px 10px;
}

.math span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.math strong {
    display: block;
    margin-top: 2px;
}

.walk {
    display: grid;
    gap: 12px;
    margin: 14px 0 8px;
}

.walk article {
    display: flex;
    gap: 12px;
}

.strategy-scroll {
    overflow-x: auto;
    margin: 12px 0 16px;
}

.strategy-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
}

.strategy-table th {
    background: #c2410c;
    color: #fff;
    font-size: 13px;
}

.strategy-table td {
    background: #fff;
    white-space: normal;
}

.strategy-table tbody tr {
    cursor: default;
}

.strategy-table tbody tr:hover {
    background: transparent;
}

.wish {
    margin: 22px 0 8px;
    padding: 18px 18px 16px;
    border-radius: 18px;
    border: 1px solid #fdba74;
    background:
        linear-gradient(180deg, rgba(232, 93, 4, 0.12), rgba(255, 247, 242, 0.4) 42%),
        #fff7f2;
    box-shadow: 0 10px 28px rgba(194, 65, 12, 0.08);
}

.wish-compact {
    margin: 14px 0;
    padding: 12px 14px;
}

.wish-k {
    margin: 0 0 4px;
    color: var(--orange-deep);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
}

.wish h2 {
    margin: 0 0 8px;
}

.wish .btn {
    margin-top: 8px;
    background: #fff;
}

.shot-box {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(42, 24, 16, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.shot-box.hidden {
    display: none;
}

.shot-box img {
    max-width: min(1200px, 100%);
    max-height: 100%;
    border-radius: 12px;
    background: #fff;
}

html[data-theme="dark"] .guide-toc a,
html[data-theme="dark"] .fields article,
html[data-theme="dark"] .walk article,
html[data-theme="dark"] .strategy-table td,
html[data-theme="dark"] .shot a {
    background: #241c18;
    color: var(--ink);
}

html[data-theme="dark"] .math div,
html[data-theme="dark"] .wish {
    background: #2a211c;
}

html[data-theme="dark"] .wish {
    border-color: #c2410c;
}

@media (max-width: 800px) {
    .fields,
    .math {
        grid-template-columns: 1fr;
    }
}

.gaze-note {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.45;
}

.gaze-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.gaze h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.gaze-sub {
    margin: 16px 0 8px;
    font-size: 15px;
}

.gaze-empty {
    margin: 8px 0 0;
    color: var(--muted);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.swatch {
    width: 14px;
    height: 8px;
    border-radius: 99px;
    display: inline-block;
    margin-right: 4px;
}

.swatch.views { background: #e85d04; }
.swatch.people { background: #9a3412; }

.gaze .cards { grid-template-columns: repeat(3, 1fr); }

.gaze-split {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 12px;
}

.gaze-split > * { min-width: 0; }

.gaze-svg {
    width: 100%;
    height: auto;
    display: block;
    background: transparent;
    border: 0;
}

.cols {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    min-height: 150px;
}

.col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.col i {
    display: block;
    width: 100%;
    max-width: 16px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(#fdba74, #e85d04);
}

.col span {
    margin-top: 4px;
    font-size: 10px;
    color: var(--muted);
    height: 14px;
}

.heat { overflow-x: auto; }

.heat-hours,
.heat-row {
    display: grid;
    grid-template-columns: 22px repeat(24, 1fr);
    gap: 2px;
    align-items: center;
    min-width: 0;
}

.heat-hours span,
.heat-row > span {
    font-size: 11px;
    color: var(--muted);
}

.heat i {
    display: block;
    height: 14px;
    border-radius: 3px;
    background: rgba(232, 93, 4, var(--a, 0.08));
}

.meters { display: flex; flex-direction: column; gap: 10px; }

.meter-name {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 14px;
}

.meter-name small { color: var(--muted); font-weight: 500; }

.meter {
    height: 10px;
    border-radius: 999px;
    background: #f6e4da;
    overflow: hidden;
}

.meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #fdba74, #e85d04);
}

.donut-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

#browserDonut { width: 180px; flex: 0 0 180px; }
#browserDonut:empty { display: none; }

.flow-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flow-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.flow-list em {
    margin-left: auto;
    font-style: normal;
    font-weight: 700;
    color: var(--orange-deep);
    background: #fff1e8;
    border-radius: 999px;
    padding: 2px 8px;
}

.route {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.route:last-child { border-bottom: 0; padding-bottom: 0; }

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--muted);
}

.route-meta b { color: var(--ink); }

.steps-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.steps-row b {
    background: #fff1e8;
    color: var(--ink);
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 600;
}

.steps-row span { color: var(--muted); }

.who {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 12px;
    background: var(--card);
}

.who summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.who summary::-webkit-details-marker { display: none; }
.who summary b { color: var(--orange-deep); }
.who summary .way { flex-basis: 100%; color: var(--muted); }

.who-line {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    background: #fff1e8;
    color: var(--orange-deep);
}

.tag.live { background: #dcfce7; color: #15803d; }

.trail {
    list-style: none;
    margin: 12px 0 4px;
    padding: 0 0 0 14px;
    border-left: 2px solid #fdba74;
}

.trail li {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 10px;
}

.trail li::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e85d04;
}

.trail span { color: var(--muted); }
.trail small { color: var(--muted); }

.gaze-tip {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    display: none;
    background: #2a1810;
    color: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    transform: translate(-50%, -130%);
}

html[data-theme="dark"] .swatch.people { background: #fdba74; }
html[data-theme="dark"] .meter,
html[data-theme="dark"] .flow-list em,
html[data-theme="dark"] .steps-row b,
html[data-theme="dark"] .tag {
    background: #3a2a24;
    color: #fdba74;
}
html[data-theme="dark"] .tag.live { background: #14532d; color: #4ade80; }
html[data-theme="dark"] .who { background: #241c18; }

@media (max-width: 900px) {
    .gaze-split { grid-template-columns: 1fr; }
    .gaze .cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) {
    .table-wrap { display: none; }
    .people-cards { display: grid; gap: 8px; }
    .person { padding: 10px 10px 8px; border-radius: 14px; }
    .person-top h2 { font-size: 17px; }
    .person-meta { margin: 2px 0 6px; }
    .person-stats { gap: 6px; }
    .person-stats div { padding: 6px 8px; border-radius: 10px; }
    .person-stats span { font-size: 11px; }
    .person-stats strong { font-size: 14px; }
}
