*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f8f7f4;
    --surface: #f0efec;
    --card: #ffffff;
    --accent: #111111;
    --text: #111111;
    --text-secondary: #555555;
    --muted: #888888;
    --border: #e0e0e0;
    --border-strong: #111111;
    --radius: 0px;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--text);
    text-decoration: none;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-family: 'Space Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-logo {
    width: 24px;
    height: 24px;
}

.nav-menu {
    display: contents;
}

.nav-menu a {
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-menu a:hover {
    opacity: 1;
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    flex-direction: column;
    gap: 4px;
}
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-search {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    order: 10;
}

.nav-search input[type="text"] {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    font-size: 0.9rem;
    width: 220px;
    outline: none;
}

.nav-search input[type="text"]:focus {
    border-color: var(--border-strong);
}

.nav-search button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent);
    border-left: none;
    border-radius: 0;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}

.nav-semantic-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    transition: border-color 0.2s, color 0.2s;
}

.nav-semantic-toggle:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.nav-semantic-toggle:has(input:checked) {
    border-color: var(--border-strong);
    color: var(--text);
}

.nav-semantic-toggle input {
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.5rem;
    white-space: nowrap;
    order: 11;
}

.nav-email {
    font-size: 0.8rem;
    color: var(--muted);
}

.nav-watchlist-link {
    font-size: 0.8rem;
    color: var(--text) !important;
    opacity: 0.8;
}

.nav-watchlist-link:hover {
    opacity: 1;
}

.nav-logout-form {
    display: inline;
}

.nav-logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
}

.nav-logout-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.nav-auth-link {
    font-size: 0.85rem;
    color: var(--text) !important;
    opacity: 0.8;
}

.nav-auth-link:hover {
    opacity: 1;
}

.nav-auth-link--register {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 0;
    color: var(--text) !important;
    opacity: 1;
}

.nav-auth-link--register:hover {
    background: var(--accent);
    color: #fff !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Movie Grid */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.movie-card {
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    transition: opacity 0.2s;
    color: var(--text);
}

.movie-card:hover {
    opacity: 0.85;
}

.movie-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 0;
}

.no-poster {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
}

.card-info {
    padding: 0.75rem;
}

.card-info h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-info .meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.35rem;
}

.card-genre {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0;
    color: var(--text-secondary);
    font-weight: 600;
    opacity: 0.85;
    background: var(--surface);
    border: 1px solid var(--border);
}

/* Title accent */
.title-accent {
    color: var(--muted);
    font-weight: 400;
}

.title-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
    margin-left: 0.5rem;
}

/* Filter Panel */
.filter-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0 0.5rem;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.filter-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

/* Topic Search */
.topic-search {
    display: flex;
    gap: 0.4rem;
}

.topic-search input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.topic-search input:focus {
    border-color: var(--border-strong);
}

.topic-search input::placeholder {
    color: var(--muted);
}

.topic-search-btn, .topic-clear-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.topic-search-btn:hover, .topic-clear-btn:hover {
    background: var(--surface);
}

.topic-clear-btn {
    border-color: var(--border-strong);
    color: var(--text);
}

.filter-divider {
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Base Pill */
.pill {
    padding: 0.3rem 0.8rem;
    border-radius: 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    transition: all 0.15s ease;
    cursor: pointer;
    text-decoration: none;
}

/* Decade Pills */
.pill--decade {
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.pill--decade:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.pill--decade.active {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-weight: 700;
}

/* Genre Pills */
.pill--genre {
    font-size: 0.75rem;
}

.pill--genre:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.pill--genre.active {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-weight: 700;
}

/* Genre Pills on Browse/Detail (keep original rounded style) */
.genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.genre-pills .pill {
    padding: 0.35rem 0.85rem;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.75rem;
    border: 1px solid var(--border);
}

.genre-pills .pill:hover, .genre-pills .pill.active {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-weight: 700;
}

/* Search Hero */
.search-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.search-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.search-subheading {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    margin-top: 0;
}

.search-bar-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color 0.3s;
}

.search-input::placeholder {
    color: var(--muted);
    font-style: italic;
}

.search-input:focus {
    border-color: var(--border-strong);
}

.superhero-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.superhero-filter input[type="checkbox"] {
    accent-color: var(--text);
    width: 14px;
    height: 14px;
}

.superhero-filter span {
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.superhero-filter:hover span {
    opacity: 1;
}

/* Results Heading */
.results-heading {
    margin-bottom: 0.5rem;
}

.results-heading h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--muted);
}

/* Grid transition */
.movie-grid {
    transition: opacity 0.2s ease;
}

.movie-grid.fade-out {
    opacity: 0;
}

/* Recommendation filter pills (movie detail page) */
.recommendations .filter-pills .pill {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
    border-radius: 0;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
}

.recommendations .filter-pills .pill:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.recommendations .filter-pills .pill.active {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-weight: 700;
}

/* Loading state for grid */
.movie-grid.loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Empty filter message */
.empty-filter {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

/* Movie Detail */
.movie-detail {
    position: relative;
}

.backdrop {
    height: 350px;
    background-size: cover;
    background-position: center top;
    border-radius: 0;
    position: relative;
    margin: -2rem -2rem 0 -2rem;
    padding: 0 2rem;
}

.backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(248,247,244,0.3), rgba(248,247,244,1));
}

.detail-content {
    display: flex;
    gap: 2rem;
    position: relative;
    z-index: 1;
    margin-top: -120px;
}

.detail-poster img {
    width: 220px;
    border-radius: 0;
}

.detail-info {
    flex: 1;
    padding-top: 80px;
}

.detail-info h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.detail-info .year {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    color: var(--muted);
    font-size: 1.4rem;
}

.detail-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.detail-meta .rating {
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-weight: 600;
}

.kernel-stars {
    display: inline-flex;
    gap: 0px;
    cursor: help;
    font-size: 1em;
    line-height: 1;
    vertical-align: baseline;
}

.star {
    position: relative;
    display: inline-block;
}

.star-fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: var(--text);
    white-space: nowrap;
}

.star-empty {
    color: var(--border);
}

.kernel-score-num {
    margin-left: 0.3em;
    font-size: 0.85em;
    color: var(--muted);
}

.card-info .kernel-stars {
    font-size: 0.7rem;
}

.detail-meta .kernel-stars {
    font-size: 1.1rem;
}

.btn-google {
    font-size: 0.8rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--muted);
    background: transparent;
    transition: border-color 0.2s, color 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.btn-google:hover {
    border-color: var(--text);
    color: var(--text);
}

.overview {
    margin: 1rem 0;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 700px;
}

.keyword-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.keyword-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0;
    border: 1px solid var(--border);
    color: var(--muted);
}

.cast {
    margin-top: 0.75rem;
    color: var(--muted);
}

.detail-extra {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Recommendations */
.recommendations {
    margin-top: 3rem;
}

.recommendations h2 {
    margin-bottom: 0.5rem;
}

/* Empty State */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination-btn {
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font-size: 0.85rem;
    transition: border-color 0.2s, background 0.2s;
}

.pagination-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--muted);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted);
}

.empty-state h1 {
    color: var(--text);
    margin-bottom: 1rem;
}

.empty-state pre {
    display: inline-block;
    background: var(--surface);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    margin-top: 1rem;
    color: var(--text);
}

/* Footer */
/* Auth pages */
.auth-page {
    max-width: 400px;
    margin: 3rem auto;
}

.auth-page h1 {
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form label {
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-form input {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--border-strong);
}

.auth-form button {
    padding: 0.7rem;
    border: none;
    border-radius: 0;
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.auth-form button:hover {
    opacity: 0.9;
}

.auth-error {
    color: #c00;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #c00;
    border-radius: 0;
    background: #fff0f0;
}

.auth-switch {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Watchlist button */
.btn-watchlist {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.btn-watchlist:hover {
    border-color: var(--border-strong);
}

.btn-watchlist.on-watchlist {
    border-color: var(--border-strong);
    background: var(--accent);
    color: #fff;
}

.btn-watchlist .watchlist-icon {
    font-size: 1rem;
    font-weight: 700;
}

.btn-browse {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border-strong);
    border-radius: 0;
    color: var(--text);
    font-size: 0.9rem;
}

.btn-browse:hover {
    background: var(--accent);
    color: #fff;
}

.watchlist-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    transition: opacity 0.15s;
}

.watchlist-card:hover {
    opacity: 0.85;
}

.watchlist-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 2;
}

.watchlist-card:hover .watchlist-remove {
    opacity: 1;
}

.watchlist-remove:hover {
    background: #c00;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

/* Explorer — Full Bleed */
.explorer-fullbleed .container {
    max-width: none;
    padding: 0;
    margin: 0;
}

.footer-email {
    display: inline-block;
    color: var(--muted);
    margin-top: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.footer-email:hover {
    opacity: 1;
}

.explorer-fullbleed .footer {
    display: none;
}

.explorer-wrap {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    overflow: hidden;
}

#explorer-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

/* Explorer overlay base */
.explorer-overlay {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
}

/* Floating title pill */
.explorer-title-bar {
    position: absolute;
    top: 14px;
    left: 14px;
    border-radius: 0;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 10;
}

.explorer-title-text {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}

.explorer-title-sub {
    font-size: 0.7rem;
    color: var(--muted);
}

/* Lens selector */
.explorer-dev-regions-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    z-index: 10;
    transition: color 0.15s, background 0.15s;
}
.explorer-dev-regions-btn:hover { color: #aaa; }
.explorer-dev-regions-btn--active {
    color: #4a90d9 !important;
    background: rgba(74, 144, 217, 0.12) !important;
    border: 1px solid rgba(74, 144, 217, 0.3) !important;
}

/* Region dirty bar */
.region-dirty-bar {
    position: absolute;
    top: 14px;
    right: 110px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 6px;
    z-index: 10;
}
.region-dirty-label {
    font-size: 0.7rem;
    color: #888;
}
.region-action-btn {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    background: transparent;
    border: 1px solid #333;
    color: #777;
    transition: all 0.15s;
}
.region-action-btn:hover { border-color: #666; color: #ccc; }
.region-action-btn--save { border-color: #7ed32160; color: #7ed321; }
.region-action-btn--save:hover { background: rgba(126,211,33,.1); }

/* Region rename popup */
.region-rename-popup {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(14, 14, 22, 0.97);
    border: 1px solid #333;
    border-radius: 7px;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.region-rename-input {
    background: #1a1a26;
    border: 1px solid #4a90d960;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    width: 170px;
    outline: none;
}
.region-rename-input:focus { border-color: #4a90d9; }
.region-rename-btn {
    padding: 4px 9px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: transparent;
    border: 1px solid #333;
    color: #888;
    transition: all 0.15s;
}
.region-rename-btn:hover { border-color: #666; color: #ccc; }
.region-rename-btn--ok { border-color: #4a90d960; color: #4a90d9; }
.region-rename-btn--ok:hover { background: rgba(74,144,217,.12); }

/* Region management panel */
.region-mgmt-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    background: rgba(10, 10, 18, 0.97);
    border-left: 1px solid #1e1e2c;
    display: flex;
    flex-direction: column;
    z-index: 30;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.region-mgmt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #1a1a26;
    flex-shrink: 0;
}
.region-mgmt-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #555;
}
.region-mgmt-done {
    padding: 3px 10px;
    border: 1px solid #2e2e3e;
    background: transparent;
    color: #777;
    font-size: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all .15s;
}
.region-mgmt-done:hover { border-color: #555; color: #ccc; }
.region-mgmt-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.region-mgmt-list::-webkit-scrollbar { width: 3px; }
.region-mgmt-list::-webkit-scrollbar-track { background: transparent; }
.region-mgmt-list::-webkit-scrollbar-thumb { background: #222; border-radius: 2px; }
.region-mgmt-section {
    padding: 8px 14px 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #333;
    border-top: 1px solid #141420;
}
.region-mgmt-section:first-child { border-top: none; }
.region-mgmt-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    cursor: pointer;
    transition: background .1s;
    min-height: 30px;
}
.region-mgmt-item:hover { background: #111120; }
.region-mgmt-label {
    flex: 1;
    font-size: 12px;
    color: #bbb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.region-mgmt-type {
    font-size: 9px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}
.region-mgmt-type--broad { color: #f5a623; background: rgba(245,166,35,.1); border: 1px solid rgba(245,166,35,.2); }
.region-mgmt-type--fine  { color: #4a90d9; background: rgba(74,144,217,.1); border: 1px solid rgba(74,144,217,.2); }
.region-mgmt-del {
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    transition: color .15s;
}
.region-mgmt-del:hover { color: #d44; }
.region-mgmt-del--armed { color: #d44; font-size: 10px; }
.region-mgmt-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #1a1a26;
    flex-shrink: 0;
}
.region-unsaved-indicator {
    flex: 1;
    font-size: 10px;
    color: #f5a623;
}
.region-footer-btn {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: transparent;
    border: 1px solid #2e2e3e;
    color: #777;
    transition: all .15s;
}
.region-footer-btn:hover { border-color: #555; color: #ccc; }
.region-footer-btn--save { border-color: #7ed32160; color: #7ed321; }
.region-footer-btn--save:hover { background: rgba(126,211,33,.08); }

/* Region type toggle (inside rename popup) */
.region-type-toggle {
    display: flex;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
}
.region-type-btn {
    padding: 4px 9px;
    font-size: 10px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: #555;
    transition: all 0.15s;
    letter-spacing: .04em;
}
.region-type-btn:hover { color: #aaa; background: rgba(255,255,255,0.04); }
.region-type-btn--active { color: #4a90d9; background: rgba(74,144,217,.15); }

.explorer-lens-bar {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0;
    padding: 0.35rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.explorer-lens-label {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.explorer-lens-select {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.explorer-lens-select:hover {
    border-color: var(--border-strong);
}

.explorer-lens-select option {
    background: var(--card);
    color: var(--text);
}

/* Floating search */
.explorer-search-bar {
    position: relative;
    margin-top: 0.4rem;
}

.explorer-search-bar input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    outline: none;
    color: var(--text);
    font-size: 0.8rem;
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-family: inherit;
}

.explorer-search-bar input:focus {
    border-color: var(--border-strong);
}

.explorer-search-bar input::placeholder {
    color: var(--muted);
}

.explorer-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    z-index: 30;
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.search-result-item:hover {
    background: var(--surface);
}

/* Tooltip */
.explorer-tooltip {
    display: none;
    position: absolute;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 0.75rem;
    gap: 0.75rem;
    align-items: flex-start;
    z-index: 20;
    pointer-events: none;
    max-width: 260px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.tooltip-poster {
    width: 50px;
    border-radius: 0;
    flex-shrink: 0;
}

.tooltip-info {
    flex: 1;
    min-width: 0;
}

.tooltip-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.tooltip-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.tooltip-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tooltip-genre {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0;
    font-weight: 600;
    opacity: 0.85;
}

/* Legend */
.explorer-legend {
    position: absolute;
    bottom: 14px;
    left: 14px;
    border-radius: 0;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    max-width: 420px;
    z-index: 10;
}

.explorer-edge-hint {
    position: absolute;
    bottom: 42px;
    left: 14px;
    font-size: 0.6rem;
    color: var(--muted);
    z-index: 10;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6rem;
    color: var(--muted);
    white-space: nowrap;
}

.legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Controls */
.explorer-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 4px;
    z-index: 10;
    transition: right 0.3s ease;
}

.explorer-panel.open ~ .explorer-controls {
    right: calc(min(42%, 620px) + 14px);
}

.explorer-panel.open ~ .explorer-debug {
    right: calc(min(42%, 620px) + 14px);
}

.explorer-btn {
    width: 34px;
    height: 34px;
    border-radius: 0;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.explorer-btn:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

/* Loading */
.explorer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--bg);
    z-index: 5;
}

/* Side Panel */
.explorer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 42%;
    max-width: 620px;
    min-width: 400px;
    height: 100%;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: rgba(255, 255, 255, 0.95);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 25;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.explorer-panel.open {
    transform: translateX(0);
}

.panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.15s;
}

.panel-close:hover {
    background: var(--surface);
    color: var(--text);
}

.panel-content {
    padding: 1.5rem 1.75rem;
    flex: 1;
}

.panel-loading {
    color: var(--muted);
    text-align: center;
    padding: 4rem 1rem;
    font-size: 0.85rem;
}

/* Two-column header: poster + info */
.panel-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.panel-poster {
    width: 180px;
    flex-shrink: 0;
    border-radius: 0;
    align-self: flex-start;
}

.panel-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.panel-year {
    font-weight: 400;
    color: var(--muted);
    font-size: 1rem;
}

.panel-meta {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0;
}

.panel-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.8rem;
}

.panel-genre-pill {
    font-size: 0.65rem;
    padding: 0.15rem 0.55rem;
    border-radius: 0;
    text-decoration: none;
    opacity: 0.85;
    border: 1px solid var(--border);
}

.panel-genre-pill:hover {
    opacity: 1;
}

/* Overview sits in the right column */
.panel-full-link {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.6rem;
    transition: opacity 0.15s;
}

.panel-full-link:hover {
    opacity: 0.8;
}

.panel-overview {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.65;
    margin-top: auto;
}

/* Details below the header */
.panel-details {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.panel-detail-row {
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
}

.panel-detail-row strong {
    color: var(--text);
    font-weight: 600;
}

/* Recs grid in panel */
.panel-recs {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.panel-recs-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.panel-recs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.panel-rec-card {
    cursor: pointer;
    border-radius: 0;
    overflow: hidden;
    transition: opacity 0.15s;
    background: transparent;
}

.panel-rec-card:hover {
    opacity: 0.85;
}

.panel-rec-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.panel-rec-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.55rem;
}

.panel-rec-info {
    padding: 0.3rem 0.35rem;
}

.panel-rec-title {
    font-size: 0.62rem;
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.panel-rec-meta {
    font-size: 0.52rem;
    color: var(--muted);
    display: block;
    margin-top: 0.1rem;
}

.panel-nav-hint {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 1.75rem;
    font-size: 0.6rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    .explorer-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 55%;
        top: auto;
        bottom: 0;
        right: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        transform: translateY(100%);
    }

    .explorer-panel.open {
        transform: translateY(0);
    }

    .panel-poster {
        width: 120px;
    }
}

/* Debug panel (dev only) */
.explorer-debug {
    position: absolute;
    bottom: 56px;
    right: 14px;
    transition: right 0.3s ease;
    font-size: 0.6rem;
    font-family: 'Space Mono', "SF Mono", "Menlo", monospace;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.35rem 0.65rem;
    border-radius: 0;
    border: 1px solid var(--border);
    z-index: 10;
    pointer-events: none;
    white-space: pre;
}

/* Dev Settings */
.dev-status {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.dev-form {
    margin-bottom: 2rem;
}

.dev-section {
    margin-bottom: 1.5rem;
}

.dev-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dev-select, .dev-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
}

.dev-weights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.dev-weight-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dev-weight-group-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.dev-weights {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dev-weight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.dev-weight-row input {
    width: 80px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    text-align: right;
    font-family: 'Space Mono', "SF Mono", "Menlo", monospace;
}

.dev-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.dev-btn:hover {
    background: var(--surface);
}

.dev-btn--accent {
    border-color: var(--border-strong);
    color: var(--text);
}

.dev-btn--accent:hover {
    background: var(--accent);
    color: #fff;
}

.dev-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dev-hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.dev-compare {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dev-compare-results {
    margin-top: 0.5rem;
}

.dev-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.dev-compare-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
}

.dev-compare-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Poster wrap for badge overlay */
.card-poster-wrap {
    position: relative;
}

.card-poster-wrap img {
    display: block;
    width: 100%;
}

/* Quick watchlist button on cards */
.card-wl-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 2;
}

.card-poster-wrap:hover .card-wl-btn,
.movie-card:hover .card-wl-btn {
    opacity: 1;
}

.card-wl-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.card-wl-btn.on-wl {
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.85);
}

/* Director badge */
.badge-director {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Explore nearby pill on movie detail */
.pill--toggle {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
    font-size: 0.75rem;
}

.pill--toggle:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.pill--toggle.active {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-weight: 700;
}

.pill--explore {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
    font-size: 0.75rem;
}

.pill--explore:hover {
    background: var(--accent);
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 0;
        padding: 0.75rem 1rem;
        position: relative;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-search {
        flex: 1;
        margin: 0 0.75rem;
        min-width: 0;
    }

    .nav-search input[type="text"] {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .nav-search button {
        display: none;
    }

    .nav-search input[type="text"] {
        border-right: 1px solid var(--border);
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-search {
        order: 0;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: 220px;
        flex-direction: column;
        gap: 0;
        background: var(--bg);
        border: 1px solid var(--border);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        padding: 0.5rem 0;
        z-index: 99;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu a {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        opacity: 0.85;
        border-bottom: none;
    }

    .nav-menu a:hover {
        background: var(--card);
    }

    .nav-user {
        padding: 0.5rem 1rem;
        margin-left: 0;
        border-top: 1px solid var(--border);
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-heading {
        font-size: 1.6rem;
    }

    .search-input {
        font-size: 1rem;
        padding: 0.85rem 1.25rem;
    }

    .filter-panel {
        padding: 1rem;
        border-radius: 0;
    }

    .pill--decade, .pill--genre {
        font-size: 0.72rem;
        padding: 0.25rem 0.6rem;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .detail-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -80px;
    }

    .detail-poster img {
        width: 180px;
    }

    .detail-info {
        padding-top: 1rem;
    }

    .detail-meta {
        justify-content: center;
    }
}
