:root {
    --ink: #0d0d0d;
    --ink2: #1a1a1a;
    --ink3: #2c2c2c;
    --ink4: #444;
    --muted: #888;
    --border: #e0e0e0;
    --bg: #f8f7f4;
    --card: #ffffff;
    --accent: #C8401A;
    --copper: #b5651d;
    --bronze: #cd7f32;
    --silver: #9e9e9e;
    --gold: #c9a84c;
    --platinum: #2d6a4f;
    --font: 'Georgia', serif;
    --mono: 'Courier New', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── HEADER ── */
.nav-header {
    background: var(--ink);
    color: #fff;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: .5;
}

.nav-select {
    background: var(--ink3);
    border: 1px solid var(--ink4);
    color: #fff;
    font-family: var(--font);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    min-width: 140px;
}

.nav-btn-generate {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 7px 16px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-btn-generate:disabled {
    opacity: .4;
    cursor: default;
}

.nav-btn-generate:hover:not(:disabled) {
    opacity: .85;
}

.nav-back {
    margin-left: auto;
    color: #fff;
    opacity: .6;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 1px;
}

.nav-back:hover {
    opacity: 1;
}

/* ── CITY SELECTOR ── */
.city-bar {
    background: var(--ink2);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.city-bar label {
    color: #aaa;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.city-bar select,
.city-bar input {
    background: var(--ink3);
    color: #fff;
    border: 1px solid var(--ink4);
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 14px;
    border-radius: 2px;
    min-width: 200px;
}

.btn-generate {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 20px;
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    letter-spacing: .5px;
    border-radius: 2px;
}

.btn-generate:hover {
    opacity: .85;
}

.btn-generate:disabled {
    opacity: .4;
    cursor: default;
}

.api-key-input {
    background: var(--ink3);
    color: #fff;
    border: 1px solid var(--ink4);
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 12px;
    border-radius: 2px;
    width: 280px;
}

/* ── REPORT AREA ── */
.report-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 32px;
}

.report-city-header {
    border-bottom: 2px solid var(--ink);
    padding-bottom: 24px;
    margin-bottom: 40px;
}

.report-city-name {
    font-size: 36px;
    font-weight: normal;
    letter-spacing: -1px;
}

.report-city-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
    letter-spacing: .5px;
}

.report-overall {
    display: flex;
    gap: 32px;
    margin-top: 16px;
    align-items: baseline;
}

.report-overall-score {
    font-size: 48px;
    font-weight: normal;
    color: var(--accent);
}

.report-overall-label {
    font-size: 18px;
    color: var(--muted);
}

/* ── DOMAIN CARD ── */
.domain-section {
    margin-bottom: 48px;
}

.domain-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 28px 32px;
    margin-bottom: 2px;
}

.domain-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
}

.domain-name {
    font-size: 18px;
    font-weight: normal;
}

.domain-medal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: var(--mono);
}

.medal-1 {
    background: #f5e8d0;
    color: var(--copper);
    border: 1px solid var(--copper);
}

.medal-2 {
    background: #f5ede0;
    color: var(--bronze);
    border: 1px solid var(--bronze);
}

.medal-3 {
    background: #f0f0f0;
    color: #666;
    border: 1px solid var(--silver);
}

.medal-4 {
    background: #fdf6e3;
    color: #8b6914;
    border: 1px solid var(--gold);
}

.medal-5 {
    background: #e8f5ee;
    color: var(--platinum);
    border: 1px solid var(--platinum);
}

.domain-score {
    font-size: 13px;
    color: var(--muted);
    font-family: var(--mono);
}

.domain-text {
    line-height: 1.8;
    font-size: 15px;
    color: var(--ink);
    min-height: 60px;
}

.domain-text p {
    margin: 0 0 0.9em 0;
}

.domain-text p:last-child {
    margin-bottom: 0;
}

.domain-text.error {
    color: #c0392b;
    font-style: italic;
}

/* Loading animation */
.domain-text.loading {
    color: transparent;
    position: relative;
    min-height: 80px;
}

.domain-text.loading::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 100%;
    height: 12px;
    background: linear-gradient(90deg, var(--border) 25%, #ddd 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 2px;
}

.domain-text.loading::after {
    content: '';
    position: absolute;
    left: 0;
    top: 28px;
    width: 75%;
    height: 12px;
    background: linear-gradient(90deg, var(--border) 25%, #ddd 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite .2s;
    border-radius: 2px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Generating label above shimmer */
.loading-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.loading-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: .2s;
}

.loading-dot:nth-child(3) {
    animation-delay: .4s;
}

@keyframes pulse {

    0%,
    100% {
        opacity: .3;
        transform: scale(.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.domain-refs {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.ref-group {
    flex: 1;
    min-width: 200px;
}

.ref-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.ref-city {
    display: inline-block;
    font-size: 12px;
    color: var(--ink4);
    margin-right: 8px;
    border-bottom: 1px solid var(--border);
}

.ref-doc {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

.ref-doc a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 64, 26, .3);
}

.ref-doc a:hover {
    border-color: var(--accent);
}

.evidence-badge {
    font-size: 11px;
    font-family: var(--mono);
    margin-left: 8px;
}

.ev-confirmed {
    color: #1e8449;
}

.ev-unconfirmed {
    color: #d35400;
}

.ev-underscored {
    color: #1a5276;
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 80px 32px;
    color: var(--muted);
}

.empty-state h2 {
    font-size: 24px;
    font-weight: normal;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.7;
}

/* ── PROGRESS ── */
.progress-bar {
    height: 2px;
    background: var(--border);
    margin-bottom: 32px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width .3s;
}

/* ── DOMAIN LAYOUT WITH ILLUSTRATION ── */
.domain-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.domain-ill {
    flex: 0 0 120px;
    opacity: .75;
}

.domain-ill svg {
    width: 120px;
    height: 68px;
}

.domain-content {
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .domain-layout {
        flex-direction: column;
    }

    .domain-ill {
        flex: none;
    }
}

/* ── INTRO ── */
.report-intro {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 24px 32px;
    margin-bottom: 40px;
}

.intro-head {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: normal;
    margin-bottom: 10px;
}

.intro-body {
    font-size: 14px;
    line-height: 1.8;
    color: var(--ink3);
}

/* ── CONCLUSION ── */
.conclusion-section {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 2px solid var(--ink);
}

.conclusion-head {
    font-size: 22px;
    font-weight: normal;
    margin-bottom: 8px;
}

.conclusion-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}

.conclusion-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.conclusion-table th {
    text-align: left;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px 8px 0;
}

.conclusion-table td {
    padding: 8px 12px 8px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.conc-domain {
    font-size: 13px;
}

.conc-score {
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
}

.conc-bar {
    width: 120px;
}

/* ── PRINT ── */
@media print {

    .nav-header,
    .city-bar {
        display: none;
    }

    .report-container {
        padding: 0;
    }

    .domain-card {
        break-inside: avoid;
    }
}

/* ── TWO-COLUMN LAYOUT ── */
.page-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 52px);
}

.domain-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--ink2);
    border-right: 1px solid var(--ink4);
    padding: 20px 0;
    position: sticky;
    top: 52px;
    height: calc(100vh - 52px);
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--ink4);
    margin-bottom: 8px;
}

.sidebar-label {
    color: #888;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

.sidebar-select {
    background: var(--ink3);
    color: #fff;
    border: 1px solid var(--ink4);
    padding: 8px 10px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: 2px;
    width: 100%;
}

.sidebar-apikey {
    background: var(--ink3);
    color: #fff;
    border: 1px solid var(--ink4);
    padding: 8px 10px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: 2px;
    width: 100%;
    margin-top: 8px;
}

.domain-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.domain-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    color: #aaa;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}

.domain-nav-item:hover {
    background: var(--ink3);
    color: #fff;
}

.domain-nav-item.active {
    background: var(--ink3);
    color: #fff;
    border-left-color: var(--accent);
}

.domain-nav-item .nav-medal {
    font-size: 10px;
    opacity: .7;
    margin-left: auto;
}

.domain-nav-all {
    padding: 8px 18px 4px;
    font-size: 11px;
    color: #888;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.domain-nav-all:hover {
    color: #fff;
}

.sidebar-actions {
    padding: 12px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: 2px;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.sidebar-btn:disabled {
    opacity: .4;
    cursor: default;
}

.sidebar-btn.secondary {
    background: #444;
}

.report-main {
    flex: 1;
    min-width: 0;
}

@media print {
    .domain-sidebar {
        display: none;
    }

    .report-main {
        width: 100%;
    }
}