/* Tema compartilhado: identidade, superfícies e estados. */
:root {
    color-scheme: dark;
    --page: #10141c;
    --canvas: #131a25;
    --surface: #191f2b;
    --surface-raised: #222b3a;
    --surface-hover: #2b3749;
    --text: #f5f7fc;
    --muted: #c2cddd;
    --accent: #91c4ff;
    --accent-soft: #21354e;
    --accent-solid: #245fae;
    --border: #354155;
    --border-strong: #677b96;
    --gold: #edc574;
    --gold-soft: #352e20;
    --success: #166534;
    --positive: #8ff0b5;
    --negative: #ffb0a8;
    --shadow: 0 12px 32px rgba(0, 0, 0, .18);
    --panel: rgba(19, 26, 37, .88);
}
:root[data-theme="light"] {
    color-scheme: light;
    --page: #f4f6fa;
    --canvas: #f8fafd;
    --surface: #ffffff;
    --surface-raised: #edf1f7;
    --surface-hover: #e2e9f3;
    --text: #101b2d;
    --muted: #35455c;
    --accent: #195baf;
    --accent-soft: #e7effb;
    --accent-solid: #245fae;
    --border: #d6deea;
    --border-strong: #8191a8;
    --gold: #885b10;
    --gold-soft: #fcf2da;
    --shadow: 0 12px 32px rgba(31, 53, 83, .09);
    --panel: rgba(255, 255, 255, .90);
    --positive: #166534;
    --negative: #a13228;
}
html { background: var(--surface); scroll-padding-top: 24px; scrollbar-color: var(--border-strong) var(--page); }
body { background: var(--surface); color: var(--text); line-height: 1.55; }
::selection { background: var(--accent-solid); color: #fff; }
:where(input, textarea) { caret-color: var(--accent); }
:where(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
:where(a) { color: var(--accent); text-underline-offset: .2em; }
:where(button, input, select, textarea) { font: inherit; }
:where(button, a, input, select, textarea):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
:where(button):disabled { cursor: not-allowed; }
:where(h1, h2, h3, h4) { line-height: 1.2; text-wrap: balance; }
:where(h1, h2) { letter-spacing: -.025em; }
:where(button, a) { -webkit-tap-highlight-color: transparent; }

/* O header inteiro permanece em uma única faixa rolável. */
.site-header {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 18px;
    padding: 10px clamp(12px, 1.6vw, 24px);
    min-height: 62px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) var(--surface);
    text-align: left;
}
.site-header-main, .site-nav, .site-header-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    flex-shrink: 0;
}
.site-header-main { gap: 18px; }
.site-brand { gap: 9px; color: var(--text); display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.site-brand img { display: block; width: 34px; height: 34px; object-fit: contain; }
.site-brand-text { font-size: 1.12rem; font-weight: 800; white-space: nowrap; }
.site-nav { gap: 4px; }
.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--canvas);
    color: var(--text);
    font-size: .84rem;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .16s ease, color .16s ease;
}
.site-nav a:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.site-nav #nav-maker { color: var(--gold); background: var(--gold-soft); margin-left: 4px; }
.site-nav #nav-maker[aria-current="page"] { border-color: var(--gold); }
.site-header-actions { gap: 8px; }
.header-lang-switcher { flex-shrink: 0; }
.header-lang-toggle, .theme-toggle, .header-search-form button, .camera-toggle, .camera-extra-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}
.theme-toggle { color: var(--accent); }
.header-lang-toggle:hover, .theme-toggle:hover, .header-search-form button:hover { background: var(--surface-raised); border-color: var(--border-strong); }
.header-lang-toggle[aria-expanded="true"] { border-color: var(--accent); }
.header-lang-caret { color: var(--muted); font-size: .7rem; }
.header-lang-menu { position: fixed; z-index: 4000; min-width: 176px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.header-lang-menu[hidden] { display: none; }
.header-lang-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.header-lang-option:hover, .header-lang-option:focus-visible { background: var(--surface-raised); }
.header-lang-option.active { background: var(--accent-soft); color: var(--accent); }
.header-search-form { display: flex; gap: 5px; }
.header-search-form input { width: 146px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--canvas); font-size: .85rem; }
.camera-toggle { background: var(--success); border-color: transparent; color: #fff; font-size: .85rem; font-weight: 650; }
.camera-extra-control { display: none; }
.camera-extra-control.visible { display: inline-flex; }
.theme-icon-moon { display: block; }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

main { background: var(--page); padding: 28px clamp(16px, 2.5vw, 40px) 72px; }
.home-hero, .archive-hero, .blog-hero, .maker-hero { padding: clamp(24px, 3vw, 42px); border-radius: 6px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 32px; }
.home-hero { background: linear-gradient(115deg, var(--accent-soft), var(--surface) 80%); }
.home-hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 14px; }
.home-hero p, .archive-hero p, .blog-hero p, .maker-hero p { color: var(--muted); line-height: 1.65; }
.home-modes { margin-bottom: 40px; }
.home-modes > h2 { margin-bottom: 18px; }
.home-modes-grid { gap: 18px; }
.home-mode-card { padding: 22px; border-color: var(--border); background: var(--surface); border-radius: 6px; }
.home-mode-card h3 { margin-bottom: 12px; font-size: 1.06rem; }
.home-mode-card p { line-height: 1.65; }
.home-mode-card a, .home-view-all { display: inline-flex; align-items: center; min-height: 44px; }
.home-section-head { margin-bottom: 18px; }
.home-category-section + .home-category-section { margin-top: 40px; }
.anime-card { padding: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; transition: border-color .18s ease, transform .18s ease; }
.anime-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card-title { padding: 2px 4px 6px; color: var(--text); font-weight: 650; }
.card-img { border-radius: 4px; }
.pagination a, .pagination span { border-width: 1px; border-radius: 6px; min-height: 44px; }
.pagination span.current { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.pagination a:hover { color: #fff; background: var(--accent-solid); border-color: var(--accent-solid); }

/* Superfícies de trabalho: mantém os tabuleiros e todas as abas existentes. */
body:has(.hero) > main {
    background: linear-gradient(var(--panel), var(--panel)), var(--work-background) center top / cover fixed;
    backdrop-filter: none;
    box-shadow: none;
    border-color: var(--border);
    border-radius: 6px;
}
.hero { border-radius: 6px; border-color: var(--border); }
.hero-content { color: #fff; }
.hero-content h2 { color: #fff; }
.anime-tabs-nav, .maker-tabs-nav { gap: 8px; border-bottom-width: 1px; border-color: var(--border); padding-bottom: 18px; margin-bottom: 26px; }
.anime-tabs-nav button, .anime-tabs-nav a, .maker-tabs-nav button, .blind-mode-btn { min-height: 44px; border-width: 1px; border-radius: 6px; transition: background-color .16s ease, border-color .16s ease; }
.anime-tabs-nav button:hover, .anime-tabs-nav a:hover, .maker-tabs-nav button:hover, .blind-mode-btn:hover { border-color: var(--accent); }
.anime-tabs-nav button.active, .maker-tabs-nav button.active, .blind-mode-btn.active { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.anime-tabs-nav button.tab-settings { color: var(--accent); background: var(--accent-soft); border-color: var(--border-strong); }
.anime-tabs-nav button.tab-settings.active { color: #fff; background: var(--accent-solid); }
.anime-tabs-nav button.tab-official { color: var(--gold); background: var(--gold-soft); border-color: var(--gold); }
.anime-tabs-nav button.tab-official.active { color: #171a22; background: #edc574; border-color: #edc574; }
.tierlist-wrapper, .tier-pool-wrapper { border-width: 1px; border-color: var(--border); border-radius: 6px; }
.tier-row { border-bottom-width: 1px; }
.tier-controls { gap: 10px; flex-wrap: wrap; }
.tier-controls button, .board-btn, .blind-rank-actions button, .maker-controls button { min-height: 44px; border-radius: 8px; }
.tier-content-area, .maker-tier-area { min-width: 0; }
.tier-pool-wrapper h4, .bracket-pool-wrap h3, .board-pool-wrap h3 { color: var(--muted); }
.shared-tier-actions, .recommendations-section, .blog-content, .blog-related-box { background: var(--surface); border-color: var(--border); }
.shared-tier-btn.secondary, .shared-tier-modal button, .selection-mode-btn { color: var(--text); }
.shared-tier-modal { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow); }
.shared-tier-modal textarea, .shared-tier-modal input { background: var(--canvas); color: var(--text); border-color: var(--border-strong); }
.maker-hero h1 { color: var(--gold); background: none; -webkit-text-fill-color: currentColor; }
.blog-content { line-height: 1.8; }
.blog-content blockquote { border-left-width: 1px; border-color: var(--accent); }
.blog-post-hero, .blog-post-hero h1, .blog-post-hero p { color: #fff; }
.blog-post-hero .blog-meta { color: #d3deea; }

/* Footer: links legíveis, respiro e um encerramento visual consistente. */
.site-footer {
    margin-top: 0;
    padding: 36px clamp(20px, 3vw, 48px) 30px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
}
.site-footer::before { content: 'Tier Versus'; display: block; color: var(--text); font-size: 1.25rem; font-weight: 750; letter-spacing: -.025em; margin-bottom: 18px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 24px; padding-bottom: 22px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.footer-links span { display: none; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 550; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.site-footer p { font-size: .84rem; line-height: 1.7; }

@media (max-width: 1023px) {
    main { padding: 20px 16px 48px; }
    .site-header { gap: 16px; padding: 9px 12px; min-height: 58px; }
    .site-header-main { gap: 14px; }
    .site-nav a { padding: 0 11px; }
    .tier-pool-wrapper { border-width: 1px; }
}
@media (max-width: 680px) {
    .camera-label { display: none; }
    .site-header { scroll-padding-inline: 16px; }
    .home-hero, .archive-hero, .blog-hero, .maker-hero { padding: 24px 20px; margin-bottom: 26px; }
    .home-modes-grid { grid-template-columns: 1fr; gap: 12px; }
    .home-mode-card { padding: 20px; }
    .home-modes > h2 { font-size: 1.3rem; }
    .home-section-head h2 { font-size: 1.2rem; }
    .site-footer { padding: 30px 20px 24px; }
    .footer-links { gap: 0 20px; }
    .footer-links a { font-size: .85rem; }
    .blog-content { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .tab-pane, .maker-pane { animation: none; }
    .anime-card, .site-nav a, .anime-tabs-nav button, .maker-tabs-nav button { transition: none; }
    .anime-card:hover { transform: none; }
    .score-row.is-fresh { animation: none; outline: 2px solid var(--accent); outline-offset: -2px; }
}
.maker-upload-zone { border-color: var(--gold); background: var(--gold-soft); }
.maker-upload-zone:hover, .maker-upload-zone.dragover { background: var(--gold-soft); border-color: var(--gold); }
#maker-btn-clear { background: var(--surface); color: #bc342a; border-color: #bc342a; min-height: 44px; padding: 8px 12px; border-radius: 8px; }
[data-theme="dark"] #maker-btn-clear { color: #ff9e92; border-color: #ce7067; }
.maker-card .mc-name { background: rgba(0, 0, 0, .85); color: #fff; }
.maker-card .mc-name:focus { color: #fff; background: #245fae; }
.random-label:not(.random-label-tier) { color: var(--text); background: var(--surface-hover) !important; }
.shared-tier-btn-secondary, .shared-link-btn.secondary, .versus-link-btn.secondary { background: var(--surface-raised); color: var(--accent); }
.tier-embed-code { color: var(--text); background: var(--canvas); border-color: var(--border-strong); }
.tier-embed-close { width: 44px; height: 44px; border-color: var(--border-strong); }
.anime-tabs-nav button.tab-shared-link { color: var(--accent); }
.recommendations-section { background: var(--surface); }
.official-intro, .official-list-intro, .official-maker-cta, .official-source-note { color: var(--muted); }
.official-subtab { color: var(--text); min-height: 44px; }
.official-subtab.active { color: #171a22; background: #edc574; border-color: #edc574; box-shadow: none; }
.official-panel { background: var(--surface); box-shadow: none; border-radius: 6px; }
.official-item { background: var(--surface-raised); }
.hero-content { --muted: #d5e7ff; }
.align-label:focus { background: var(--surface-raised); }
.guess-difficulty button.active span { color: #e5efff; }
.board-btn.active, .board-split button[aria-pressed="true"] { color: #fff; background: var(--accent-solid); border-color: var(--accent-solid); }
.score-pad .score-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.score-swatch[data-score="4"], .score-swatch[data-score="5"], .score-swatch[data-score="9"], .score-swatch[data-score="10"] { color: #10141c; }
@media (min-width: 681px) and (max-width: 1100px) {
    .home-modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Espaço até o footer, inclusive quando há área reservada pelo anúncio. */
.recommendations-shell { margin-bottom: 48px; }
body .work-pane-intro p { color: var(--muted); }
body .ad-placement { border-color: var(--border); }
.recommendations-section, .shared-hero, .versus-hero, .guess-hero,
.blog-post-hero, .blog-card, .blog-related-card, .shared-card, .versus-card,
.shared-main-card, .shared-side-card, .shared-form-shell,
.versus-main-card, .versus-side-card, .versus-form-shell,
.guess-round-card, .guess-answer-card, .guess-character-frame,
.guess-option-card, .guess-name-option, .guess-seo-copy,
.maker-tierlist-wrapper, .maker-pool-wrapper, .maker-upload-zone,
.shared-form-fields input, .shared-form-fields textarea, .shared-form-fields select,
.versus-form input, .versus-form textarea, .versus-form select { border-radius: 6px; }
.official-subtab, .board-split, .guess-name-toggle { border-radius: 6px; }
@media (max-width: 680px) {
    .recommendations-shell { margin-bottom: 32px; }
}
