/* Only for labels explicitly marked as not visible: raise opacity slightly before outline */
.label-edit-mode [data-editable="true"][data-visible="false"] {
    opacity: 0.8 !important;
}
/* [ Your existing styles.css content remains here... ] */
/* I've copied it below for completeness. */

/* Copyright © 2025 RPGScience. All rights reserved. No permission is granted to use, copy, modify, or distribute this file. */

/* Inter font - local files */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/Inter-Bold.woff2') format('woff2');
}

/* CONCRETE */
:root {
    --bg-main: #dce0e4; /* light concrete wall */
    --bg-panel: #ecf0f1; /* smoother, cast concrete panel */
    --bg-control: #e4e8eb; /* textured control surface */
    --bg-control-hover: #c7cdd2; /* darker on hover */
    --bg-control-light: #f2f4f6; /* polished concrete input */
    --text-primary: #1c1c1c; /* dark, almost black text */
    --text-byline: #b45309; /* standard medium gray */
    --text-secondary: #5f5f5f; /* standard medium gray */
    --text-muted: #241e1e; /* faint structural markings */
    --text-headings: #333333; /* strong, dark gray heading */
    --text-accent: #fbc02d; /* safety yellow link */
    --border-color: #b2b8bd; /* panel seam border */
    /* Removed: duplicates of theme-accent-primary */
    /* --accent-color: #f9a825; */
    /* --accent-color-hover: #f59100; */
    --nav-bg: #3c4a56; /* dark rebar-steel header */ 
    --font-xs: 8px;
    --font-sm: 10px;
    --font-base: 12px;
    --font-md: 13px;
    --font-lg: 15px;
    --font-xl: 17px;
    --line-height-tight: 1.2;
    --line-height-normal: 1.4;
    --spacing-xs: 2px;
    --spacing-sm: 4px;
    --spacing-md: 8px;
    --spacing-lg: 10px;
    --spacing-xl: 15px;
    /* Simplified radius variables - all set to 0 for flat design */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;

    /* === NEW THEME VARIABLES === */
    --theme-bg-parchment: #c7cdd2;
    --theme-text-dark: #1c1c1c;
    --theme-text-heading: #333333;
    --theme-border-color: #b2b8bd;
    --theme-accent-primary: #f9a825; /* safety yellow for Generate/CTAs */
    --theme-accent-primary-hover: #f59100;
    --theme-accent-secondary: #455a64; /* cool, industrial blue-gray for Randomise */
    --theme-accent-secondary-hover: #37474f;
    /* Consolidated: --theme-accent-cta is same as --theme-accent-primary */

    --panel-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    --worldmap-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    --navbar-shadow: 0 2px 5px rgba(0,0,0,0.2);
    --header-height: 44px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    margin: 0;
    padding: 0; /* Remove body padding, handled by containers now */

    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}
h1, h2, h3 { color: var(--text-headings); margin-bottom: var(--spacing-md); }
h1 { font-size: var(--font-xl); }
h2 { font-size: var(--font-md); margin: var(--spacing-xs) 0; color: var(--text-byline); }
h3 { font-size: var(--font-base); color: var(--text-secondary); margin: var(--spacing-md) 0 var(--spacing-sm) 0; }
.hidden { display: none !important; }
.ml-sm { margin-left: var(--spacing-sm); }
.text-sm { font-size: var(--font-sm); }
.text-center { text-align: center; }
.absolute { position: absolute; }
.rounded-lg { border-radius: var(--radius-lg); }
.page-container { display: flex; gap: var(--spacing-lg); margin: 0; padding-top: 60px; /* Space for fixed header */ }
.container { display: flex; gap: var(--spacing-lg); width: 100%; }
.map-container {
    contain: strict;
    position: relative;
    /* Responsive scaling: fit to available space while maintaining 1.5:1 aspect ratio */
    /* Right gap: 330px + 5px = 335px, Bottom gap: 70px + 5px = 75px */
    width: min(calc(100vw - 335px), calc((100vh - 75px) * 1.5));
    height: calc(min(calc(100vw - 335px), calc((100vh - 75px) * 1.5)) / 1.5);
    /* Minimum and maximum size constraints */
    min-width: 300px;
    min-height: 200px;
    max-width: 2400px;  /* 2x original size limit */
    max-height: 1600px; /* 2x original size limit */
    background-color: var(--border-color);
    padding: 0;
    overflow: hidden;
    margin-left: 320px; /* Increased margin for wider sidebar */
    margin-top: 16px;
    box-shadow: var(--worldmap-shadow);
    min-width: 600px;
    min-height: 400px;
}
.map-container:focus { outline: none; box-shadow: none; }

/* Ensure SVG layer fills the container */
#svgMapLayer {
    width: 100% !important;
    height: 100% !important;
}

/* Ensure player container fills the map container */
.player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to underlying elements */
}

/* Ensure main world map SVG scales to fill the container, but not nested SVGs */
.map-container svg:not(svg svg) {
    width: 100%;
    height: 100%;
}

/* Tooltip styles (mostly unchanged) */
.tooltip { position: relative; display: inline-block; cursor: help; padding: 0; margin: 0; }
.tooltip .tooltiptext {
    visibility: hidden;
    width: max-content;
    max-width: 220px;
    background-color: var(--theme-accent-primary);
    color: var(--text-headings);
    text-align: left;
    border-radius: var(--radius-md, 4px);
    padding: 6px 10px;
    margin: 0;
    position: absolute;
    z-index: 9999;
    bottom: 125%;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: var(--shadow-popup, 0 0 10px rgba(0,0,0,0.5));
    font-size: var(--font-sm, 11px);
    pointer-events: none;
}
.tooltip.tooltip-right .tooltiptext { left: auto; right: 0; text-align: left; }
.tooltip.show .tooltiptext { visibility: visible; opacity: 1; pointer-events: auto; }
/* Fantasy map fonts (for SVG elements only) */
@font-face { font-family: 'Ovo'; src: url('/assets/fonts/Ovo.woff2') format('woff2'); }
@font-face { font-family: 'MorrisRomanBlack'; src: url('/assets/fonts/MorrisRomanBlack.woff2') format('woff2'); }
@font-face { font-family: 'GoudyMediaeval'; src: url('/assets/fonts/GoudyMediaeval.woff2') format('woff2'); }
@font-face { font-family: 'GoudyMediaevalDemiBold'; src: url('/assets/fonts/GoudyMediaevalDemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; src: url('/assets/fonts/Inter-Regular.woff2') format('woff2'); }

/* =================================================================== */
/* === NEW THEMATIC STYLES & UI OVERHAUL (Add this to your CSS) === */
/* =================================================================== */

/* 1. NEW HEADER / NAVIGATION
------------------------------------ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 44px;
    background-color: var(--nav-bg); /* deep navy blue */
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1100;
    box-shadow: var(--navbar-shadow);
}
.main-nav {
    margin-left: 20px;
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 10px;
}
.main-nav a {
    text-decoration: none;
    color: #f6f6f6;
    padding: 4px 10px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}
.main-nav a:hover {
    color: var(--theme-accent-primary);
}
.main-nav a.active {
    color: var(--theme-accent-primary);
    background: rgba(249, 168, 37, 0.15);
    border-radius: 2px;
    border-bottom: none;
}
.btn-upgrade-pro {
    margin-left: auto; /* Pushes button to the right */
    background-color: var(--theme-accent-primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    text-decoration: none;

    font-size: 14px;
    border: none;
    transition: background-color 0.2s;
}
.btn-upgrade-pro:hover {
    background-color: var(--theme-accent-primary-hover);
}


/* 2. THEMED SIDE PANEL
------------------------------------ */


.panel-side .form-control,
.panel-side .btn,
.panel-side .display-options-grid {
    max-width: 100%;
}


.panel-side {
    width: 300px;
    left: var(--spacing-lg);
    top: 60px;
    z-index: 100;
    max-height: calc(100vh - 70px);
    box-sizing: border-box;
    overflow-x: hidden;
    background: var(--theme-bg-parchment);
    color: var(--theme-text-dark);

    border: 1px solid var(--theme-border-color);
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-accent-secondary) transparent;
    box-shadow: var(--panel-shadow);
}
/* Removed duplicate .panel-side h1 rule - consolidated below */
.panel-side h3 {
    color: var(--theme-text-heading);
    margin-top: 12px;
    /* Font size and weight handled in consolidated section below */
}
.panel-side .h3-subtext {
    color: var(--text-byline);
    font-weight: normal;
    /* Font size handled in consolidated section below */
}
.panel-side .help-text {
    color: var(--text-secondary);
    line-height: 1.5;
    /* Font size handled in consolidated section below */
}


/* 3. ACCORDION (NEW IMPLEMENTATION)
------------------------------------ */
.accordion-item {
    border-bottom: 1px solid var(--theme-border-color);
    margin-bottom: 5px;
    position: relative;
}
.accordion-item.open { z-index: 10; }
.accordion-header {
    padding: 8px 24px 8px 4px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--theme-text-heading);
    position: relative;
    z-index: 0;
    user-select: none;
}
.accordion-header:hover {
    background-color: rgba(157, 107, 83, 0.1);
}
.accordion-header::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-right: 2px solid #5f5f5f;
    border-bottom: 2px solid #5f5f5f;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.35s ease;
}
.accordion-item.open .accordion-header::after {
    transform: translateY(-50%) rotate(225deg);
}
.accordion-item.open .accordion-header {
    background-color: rgba(226, 226, 230, 0.4);
}
.accordion-content {
    overflow: hidden;
    height: 0;
    transition: height 0.35s ease;
    position: relative;
    z-index: 1; /* ensure tooltips inside can layer above header */
}
.accordion-content-inner {
    padding: 0 5px 15px 5px;
}
.accordion-item.open > .accordion-content {
    height: var(--content-height);
    background-color: rgba(226, 226, 230, 0.4);
}


/* 4. THEMED FORM CONTROLS & BUTTONS
------------------------------------ */
.panel-side .form-label {
    color: var(--theme-text-dark);
    /* Font size handled in consolidated section below */
}
.panel-side .form-control {
    background-color: var(--bg-control);
    border: 1px solid var(--theme-border-color);
    color: var(--theme-text-dark);
    border-radius: 4px;
    /* Font size handled in consolidated section below */
}
.panel-side .form-control:focus {
    border-color: var(--theme-accent-primary);
    box-shadow: 0 0 0 2px rgba(157, 107, 83, 0.2);
}
.panel-side .btn {
    border-radius: 4px;
    padding: 4px 10px;
    /* Font size handled in consolidated section below */
    border: 1px solid transparent;
}
.panel-side .btn-primary {
    background-color: var(--theme-accent-primary);
    border-color: #ba8e78;
    color: #fff;
}
.panel-side .btn-primary:hover {
    background-color: var(--theme-accent-primary-hover);
}
.panel-side .btn-secondary {
    background-color: var(--theme-accent-secondary);
    border: none;
    border-color: #b9937a; 
    color: #fff;
}
.panel-side .btn-secondary:hover {
    background-color: var(--theme-accent-secondary-hover);
}
.panel-side .form-checkbox {
    accent-color: var(--theme-accent-primary);
    vertical-align: middle;
}
.panel-side .display-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    margin-bottom: 14px;
}

/* 5. LEGEND & CTA BLOCK
------------------------------------ */
.legend-image-container {
    font-size: 13px;
}
.legend-icon {
    border: 1px solid #e2d8c3;
    border-radius: 2px;
}

.pro-upgrade-box {
    background-color: #d0ddd0;
    border: 1px solid var(--theme-border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}
.pro-upgrade-box h4 {

    font-size: 16px;
    color: var(--theme-text-heading);
    margin: 0 0 10px 0;
}
.pro-upgrade-box ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    text-align: left;
    font-size: 12.5px;
}
.pro-upgrade-box ul li {
    margin-bottom: 6px;
    color: var(--theme-text-dark);
}
.btn-upgrade-pro-large {
    display: block;
    width: 100%;
    background-color: #0b2;
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border-radius: 5px;
    text-decoration: none;

    font-size: 16px;
    border: 1px solid rgb(0, 157, 26);
    transition: background-color 0.2s;
}
.btn-upgrade-pro-large:hover {
    background-color: #0d2;
    color: #333;
}

/* Add/merge missing base styles from styles_orig.css below, without overwriting new theme/header styles */

/* === BASE LAYOUT & PANEL STYLES (MERGED) === */
.container {
    display: flex;
    gap: var(--spacing-lg);
    width: 100%;
}
.page-container {
    display: flex;
    gap: var(--spacing-lg);
    margin: 0;
    padding-top: var(--header-height); /* Space for fixed header */
}
.panel {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    overflow-y: auto;
}
.panel-fixed {
    position: fixed;
}




/* === BUTTONS === */
.btn {
    display: inline-block;
    background-color: var(--bg-control);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-sm);
    white-space: nowrap;
    transition: background-color 0.2s;
    height: auto;
}
.btn:hover {
    background-color: var(--bg-control-hover);
}
.btn-primary {
    background-color: var(--accent-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--accent-color-hover);
}
.btn-secondary {
    background-color: var(--bg-control-light);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: var(--bg-control-hover);
}
.btn-full {
    width: 100%;
}

/* === FORM CONTROLS === */
.form-control {
    background-color: var(--bg-control);
    border: 1px solid var(--theme-border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--theme-text-dark);

    margin-bottom: 2px;
    width: auto;
    outline: none;
    transition: border-color 0.2s;
}
.form-control:focus {
    border-color: var(--theme-accent-primary);
    background-color: var(--bg-control-hover);
}
.form-control-number {
    width: 80px;
}
.form-control-text {
    width: 140px;
}
.form-control-select {
    min-width: 60px;
    padding-right: 18px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}
.form-label {
    color: var(--theme-text-dark);
    margin-right: 4px;
}
.form-checkbox {
    accent-color: var(--theme-accent-primary);
    margin-right: 4px;
}

/* === SELECT BOX OPTION STYLING === */
select option {
    background-color: white;
    color: black;
}

select option:checked,
select option[selected] {
    background-color: #f8f9fa !important; /* Very light grey for selected items */
    color: black;
}

/* === CONTROL GROUPS === */
.control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

/* === HELP TEXT === */
.help-text {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

/* === LEGEND === */
.legend-image-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
    margin-top: 8px;
}
.legend-image-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.legend-icon {
    width: 40px;
    height: 30px;
    margin-right: 6px;
    border: 1px solid #8a5e48;
    border-radius: 2px;
}

/* Global Inter font application for UI elements */
body,
.main-header,
.main-nav,
.main-nav a,
.btn,
.panel-side,
.panel-side h1,
.panel-side h3,
.panel-side .h3-subtext,
.panel-side .help-text,
.panel-side .form-label,
.panel-side .form-control,
.panel-side .checkbox-label,
/* Consolidated font family for UI (accordion summary inherits from main definition above) */
.tooltip .tooltiptext,
.form-label,
.help-text {
    font-family: 'Inter', sans-serif !important;
}

/* Consolidated font sizing for UI elements */
.main-nav a {
    font-size: 13px;
}
.btn,
.panel-side .btn,
.btn-upgrade-pro,
.btn-upgrade-pro-large {
    font-size: 13px;
}
.panel-side h1 {
    font-size: 22px;
    font-weight: 700 !important;
    color: var(--theme-text-heading);
    margin-bottom: 4px;
}
.panel-side h3,
.pro-upgrade-box h4 {
    font-size: 15px;
    font-weight: 500;
}
.panel-side .h3-subtext,
.panel-side .help-text,
.panel-side .form-label,
.panel-side .form-control,
.panel-side .checkbox-label {
    font-size: 11.5px;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

/* Hamburger Menu Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    z-index: 1200;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--nav-bg);
    z-index: 1200;
    padding: 60px 20px 20px 20px;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}

.mobile-menu-list li {
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-link {
    display: block;
    padding: 16px 10px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
    color: #f9a825;
    background: rgba(249, 168, 37, 0.1);
}

.mobile-menu-auth {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-auth .btn {
    width: 100%;
    text-align: center;
    padding: 10px 20px;
    font-size: 14px;
    height: auto;
    line-height: normal;
}
/* Auth button styles */
.btn-login {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: var(--radius-md);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    height: 25px;
    line-height: 16px;
    border: 1px solid rgba(249,168,37,0.7);
    background: transparent;
    color: rgba(255,255,255,0.8);
}
.btn-login:hover {
    background: rgba(249,168,37,0.15);
    color: #fff;
    border-color: rgba(249,168,37,0.9);
}

/* Consolidated form checkbox styles */
.form-checkbox,
.panel-side .form-checkbox {
    vertical-align: middle;
    margin-right: 4px;
}
.panel-side .btn-secondary, .btn-secondary {
    font-size: 11px;
}
.display-options-grid > label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* Removed redundant Arial font override - Inter is applied globally */

.header-logo-img {
    margin-left: -10px;
}

/* === App Title Lockup === */
.app-title {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 0 4px 0;
    line-height: 1.1;
}
.app-title-brand {
    /*font-variant-caps: small-caps;*/
    letter-spacing: 0.00em;
    font-weight: 900;
    font-size: 14.5px;
    color: rgba(84, 158, 217, 0.8);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
.app-title-product {
    font-weight: 900;
    letter-spacing: -0.01em;
    font-size: 30px;
    color: var(--text-headings);
    position: relative;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.app-title-product::after {
    content: '';
    display: block;
    width: 56px;
    height: 0px;
    margin: 6px auto 0 auto;
    background: var(--theme-accent-primary);
}
.app-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    padding: 3px 18px;
    font-size: 7.6px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: white;
    background: #5a6c7d;
    transform: rotate(45deg) translate(30%, -65%);
    transform-origin: center;
    white-space: nowrap;
}

.fixed-panel-stack {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 260px;
    pointer-events: auto;
}

.panel-debug, .panel-progress {
    background: #232323;
    color: #8fd6ff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 12px 10px 10px 10px;
    margin: 0 0 4px 0;
    margin-bottom: 10px;
    /* Removed Arial override - using global Inter font */
    font-size: 10px;
    text-align: left;
}
.generation-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
}
.progress-item {
    font-size: 9px;
    line-height: 1.2;
    padding: 4px 8px;
    background: #333;
    border-radius: 3px;
    margin-bottom: 0px;
    margin-top: 0px;
    color: #e0e0e0;
}
.progress-item-name {
    font-weight: bold;
    color: #bde0ff;
}
.progress-item-time {
    color: #3ecf4c;
    float: right;
}
.progress-item-count {
    display: inline;
    color: #b0b0b0;
    margin-left: 8px;
    margin-top: 0;
    margin-bottom: 0px;
    font-size: 9px;
}

/* Removed duplicate .heading-main - defined in responsive.css */



/* Default: NO blue glow on editable elements */
[data-editable="true"] {
    filter: none !important;
    cursor: default;
    overflow: none;
}

/* Label editing mode ONLY: Blue outline on editable elements */
.label-edit-mode [data-editable="true"] {
    filter: url(#editable-outline) !important;
    cursor: pointer !important;
    overflow: visible !important;
}

/* Only for labels explicitly marked as not visible */
.label-edit-mode [data-editable="true"][data-visible="false"] {
    opacity: 0.6 !important;
    stroke-opacity: 1 !important;
}

.label-edit-mode [data-editable="true"]:hover {
    filter: url(#editable-outline-hover) !important;
}

/* Special handling for transparent rect elements - make them barely visible for feMorphology */
.label-edit-mode rect[data-editable="true"] {
    stroke: rgba(255, 255, 255, 1) !important;
    stroke-width: 0.8 !important;
}

.label-edit-mode rect[data-editable="true"]:hover {
    stroke: rgba(255, 255, 255, 1) !important;
    stroke-width: 0.8 !important;
}

.player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Only SVG inside should handle events */
    z-index: 20000;
}
.player-container svg.player-movement-container {
    pointer-events: auto;
}
#worldmap-svg {
    pointer-events: none;
}

/* Popup Detail Shadow Reduction for Region Editor (shadow is on left column only, not minimap) */
#detail-popup.region-editor-shadow-reduced #detail-popup-content {
    box-shadow: 0px 12px 32px 0 rgba(0,0,0,0.3), 0 2px 6px 0 rgba(0,0,0,0.18);
}

/* ============================================================================
   MODAL OVERLAY - Proper blocking modals at document root
   ============================================================================ */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 50000 !important;
    pointer-events: auto !important;
    background: rgba(0, 0, 0, 0.6);
}

.modal-overlay.hidden {
    display: none !important;
}

/* Ensure modal content blocks all interactions */
.modal-overlay:not(.hidden) {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   DENSITY SLIDERS - Settlement and POI Controls
   ============================================================================ */

/* Main slider styling matching region editor */
input.density-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 8px;
    background: var(--bg-control);
    border: 1px solid var(--theme-border-color);
    outline: none;
    accent-color: #4B5563;
}

/* WebKit slider track */
input.density-slider::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 8px;
    background: var(--bg-control);
    border: 1px solid var(--theme-border-color);
}

/* WebKit slider thumb */
input.density-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #F8F8F8;
    border: 1.5px solid #8B95A3;
    margin-top: -4px;
}

/* Firefox slider thumb */
input.density-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #F8F8F8;
    border: 2px solid #7B8593;
}

/* Firefox slider track */
input.density-slider::-moz-range-track {
    height: 8px;
    border-radius: 8px;
    background: var(--bg-control);
    border: 1px solid var(--theme-border-color);
}

/* Firefox slider progress */
input.density-slider::-moz-range-progress {
    background-color: #4B5563;
    height: 8px;
    border-radius: 8px;
}

/* ====================================
   CONTENT OVERLAY SYSTEM
   ==================================== */

/* Content Overlay System */
.content-overlay {
    position: fixed;
    top: 44px; /* Below header */
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f7fa;
    z-index: 1050;
    overflow-y: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.content-overlay.hidden {
    display: none;
    opacity: 0;
}

.overlay-content {
    padding: 0;
    min-height: 100%;
}

/* ============================================
   AUTH MODAL STYLES
   ============================================ */

.auth-modal-content {
    background: var(--bg-panel);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.auth-modal-close:hover {
    color: var(--text-primary);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-modal-logo {
    height: 60px;
    margin-bottom: 16px;
}

.auth-modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--text-headings);
}

.auth-modal-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.auth-btn-google {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.auth-btn-google:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.auth-btn-icon {
    width: 20px;
    height: 20px;
}

.auth-btn-primary {
    background: var(--theme-accent-primary);
    color: var(--text-headings);
}

.auth-btn-primary:hover {
    background: var(--theme-accent-primary-hover);
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-input-group input {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    background: var(--bg-control-light);
    color: var(--text-primary);
}

.auth-input-group input:focus {
    outline: none;
    border-color: var(--theme-accent-primary);
}

.auth-success {
    text-align: center;
    padding: 24px 0;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.auth-success h3 {
    margin: 0 0 8px 0;
    color: var(--text-headings);
}

.auth-success p {
    margin: 0 0 4px 0;
    color: var(--text-secondary);
}

.auth-success-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* Code Entry Section */
.auth-code-section {
    text-align: center;
}

.auth-code-info {
    margin: 0 0 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-code-info strong {
    color: var(--text-primary);
}

.auth-code-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-headings);
    margin: 26px 0 12px;
}

.auth-code-input {
    display: block;
    width: 220px;
    height: 56px;
    margin: 0 auto 16px;
    font-size: 28px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    letter-spacing: 8px;
    text-align: center;
    padding: 0 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-control-light);
    color: var(--text-primary);
    caret-color: transparent; /* Hide cursor - cleaner look for OTP */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-code-input:focus {
    outline: none;
    border-color: var(--theme-accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-accent-primary-rgb, 234, 179, 8), 0.2);
}

.auth-code-input::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

.auth-code-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--text-muted);
}

.auth-btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.auth-btn-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.auth-consent {
    padding-top: 8px;
}

.auth-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.auth-checkbox-label input {
    margin-top: 2px;
}

.auth-modal-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.auth-terms {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* User Menu (when logged in) */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-control);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
}

.user-menu-trigger:hover {
    background: var(--bg-control-hover);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
}

.user-menu-dropdown.hidden {
    display: none;
}

.user-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-email {
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
}

.user-menu-plan {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.user-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--bg-control);
}

.user-menu-item.logout {
    color: #dc2626;
    border-top: 1px solid var(--border-color);
}
