/* ==========================================================================
       CSS VARIABLES & THEME DEFINITIONS
       ========================================================================== */
    :root {
      --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Monaco, monospace;
      --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      --font-pixel: 'Press Start 2P', monospace, sans-serif;
      --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Cyberpunk Theme (Default) */
    body[data-theme="cyberpunk"] {
      --bg-color: #03070d;
      --bg-gradient: radial-gradient(circle at 50% 45%, #071526 0%, #020509 100%);
      --text-main: #e6f4fa;
      --text-muted: #6e8e9e;
      --accent: #00ffaa;
      --accent-glow: rgba(0, 255, 170, 0.45);
      --accent-secondary: #00e5ff;
      --accent-secondary-glow: rgba(0, 229, 255, 0.4);
      --amber-gold: #ffaa00;
      --amber-glow: rgba(255, 170, 0, 0.65);
      --card-bg: rgba(7, 16, 28, 0.95);
      --card-border: rgba(0, 229, 255, 0.35);
      --card-border-glow: 0 0 25px rgba(0, 229, 255, 0.18);
      --land-day: #00ff9d;
      --land-night: #1c3552;
      --land-twilight: #2dd4bf;
      --globe-ocean: #040b17;
      --globe-atmosphere: rgba(0, 229, 255, 0.25);
      --city-beacon: #ffaa00;
      --hud-font: var(--font-mono);
      --border-radius: 8px;
    }

    /* Minimal Monochrome Theme (Clean Black & Platinum White) */
    body[data-theme="mono"],
    body[data-theme="luxury"] {
      --bg-color: #06080d;
      --bg-gradient: radial-gradient(circle at 50% 45%, #0f141f 0%, #040508 100%);
      --text-main: #f8fafc;
      --text-muted: #94a3b8;
      --accent: #ffffff;
      --accent-glow: rgba(255, 255, 255, 0.6);
      --accent-secondary: #cbd5e1;
      --accent-secondary-glow: rgba(203, 213, 225, 0.25);
      --amber-gold: #ffffff;
      --amber-glow: rgba(255, 255, 255, 0.8);
      --card-bg: rgba(11, 15, 23, 0.95);
      --card-border: rgba(255, 255, 255, 0.20);
      --card-border-glow: 0 20px 50px rgba(0, 0, 0, 0.8);
      --land-day: #4f5d6f;
      --land-night: #18202c;
      --land-twilight: #333f50;
      --globe-ocean: #070a10;
      --globe-atmosphere: rgba(255, 255, 255, 0.18);
      --city-beacon: #ffffff;
      --hud-font: var(--font-sans);
      --border-radius: 14px;
    }

    /* Retro 8-bit Arcade Theme */
    body[data-theme="retro"] {
      --bg-color: #120e24;
      --bg-gradient: radial-gradient(circle at 50% 45%, #1d163d 0%, #0d091b 100%);
      --text-main: #fce762;
      --text-muted: #9c8dc4;
      --accent: #5cd688;
      --accent-glow: rgba(92, 214, 136, 0.45);
      --accent-secondary: #ff5e7e;
      --accent-secondary-glow: rgba(255, 94, 126, 0.4);
      --amber-gold: #ffd152;
      --amber-glow: rgba(255, 209, 82, 0.65);
      --card-bg: rgba(24, 18, 48, 0.96);
      --card-border: #ffffff;
      --card-border-glow: 0 0 0 2px #120e24, 0 0 0 4px #5cd688;
      --land-day: #5cd688;
      --land-night: #3e326b;
      --land-twilight: #a3e635;
      --globe-ocean: #150d2c;
      --globe-atmosphere: rgba(92, 214, 136, 0.28);
      --city-beacon: #ffd152;
      --hud-font: var(--font-pixel);
      --border-radius: 0px;
    }

    /* Retro Font Size Scaling: Bold, legible 8-bit typography & unified heights */
    body[data-theme="retro"] .brand-section {
      height: 38px;
      box-sizing: border-box;
    }
    body[data-theme="retro"] .brand-title {
      font-size: 12px;
      letter-spacing: -0.5px;
    }
    body[data-theme="retro"] .brand-badge {
      font-size: 9px;
    }
    body[data-theme="retro"] .search-input-box {
      height: 38px;
      box-sizing: border-box;
      font-size: 10.5px;
    }
    body[data-theme="retro"] .top-action-btn {
      height: 38px;
      box-sizing: border-box;
      font-size: 10px;
      padding: 0 12px;
      gap: 6px;
    }
    body[data-theme="retro"] .settings-dropdown {
      width: 375px;
      padding: 16px 18px;
      gap: 14px;
    }
    body[data-theme="retro"] .settings-header {
      font-size: 13px;
      font-weight: 800;
      padding-bottom: 10px;
      letter-spacing: -0.3px;
    }
    body[data-theme="retro"] .settings-label {
      font-size: 11.5px;
      font-weight: 700;
      margin-bottom: 6px;
      letter-spacing: -0.3px;
    }
    body[data-theme="retro"] .theme-btn {
      font-family: var(--font-pixel), monospace;
      font-size: 11.5px;
      font-weight: 700;
      padding: 8px 6px;
      gap: 6px;
      min-height: 38px;
      letter-spacing: -0.5px;
    }
    body[data-theme="retro"] .density-pill,
    body[data-theme="retro"] .airplane-pill {
      font-family: var(--font-pixel), monospace;
      font-size: 12px;
      font-weight: 700;
      padding: 8px 6px;
      min-height: 38px;
      letter-spacing: -0.3px;
    }
    body[data-theme="retro"] #sound-toggle-btn {
      font-family: var(--font-pixel), monospace;
      font-size: 12px;
      font-weight: 700;
      padding: 10px 12px;
      min-height: 40px;
      letter-spacing: -0.3px;
    }
    body[data-theme="retro"] .zen-btn {
      font-family: var(--font-pixel), monospace;
      font-size: 12px;
      font-weight: 700;
      padding: 10px 12px;
      min-height: 40px;
      letter-spacing: -0.3px;
    }

    /* Retro Bottom Timeline Deck & Zoom Deck: 88px Matched Height */
    /* Size/position come from the shared (responsive) rules; the retro theme only restyles */
    body[data-theme="retro"] .bottom-deck {
      box-sizing: border-box;
      justify-content: space-between;
    }
    body[data-theme="retro"] .live-badge {
      font-size: 9px;
      padding: 4px 8px;
    }
    body[data-theme="retro"] .sim-clock {
      font-size: 13.5px;
      letter-spacing: -0.3px;
    }
    body[data-theme="retro"] .deck-btn {
      font-size: 9.5px;
      padding: 5px 9px;
    }
    body[data-theme="retro"] #btn-speed {
      min-width: 64px;
      width: 64px;
      font-size: 10px;
      padding: 5px 2px;
    }
    body[data-theme="retro"] .timeline-ticks {
      font-size: 8px;
      letter-spacing: -0.5px;
    }
    body[data-theme="retro"] .zoom-deck {
      box-sizing: border-box;
      justify-content: space-between;
    }
    body[data-theme="retro"] .mode-pill {
      font-size: 10px;
      padding: 4px 10px;
    }
    body[data-theme="retro"] .zoom-label {
      font-size: 10px;
    }
    body[data-theme="retro"] .zoom-multiplier-badge {
      font-size: 11px;
      padding: 3px 8px;
      min-width: 52px;
    }
    body[data-theme="retro"] .zoom-btn {
      font-size: 11px;
      width: 28px;
      height: 28px;
    }
    body[data-theme="retro"] #ambient-btn-planes {
      min-width: 78px;
      width: 78px;
    }
    body[data-theme="retro"] #city-hud {
      min-width: 425px;
      padding: 16px 20px;
    }
    body[data-theme="retro"] .hud-city-title {
      font-size: 13px;
      letter-spacing: -0.5px;
    }
    body[data-theme="retro"] #hud-time-val {
      font-size: 24px;
    }
    body[data-theme="retro"] .hud-daynight-badge {
      font-size: 8px;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
      -webkit-user-select: none;
    }

    /* Global Modern Custom Scrollbar */
    ::-webkit-scrollbar {
      width: 5px;
      height: 5px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: var(--accent);
    }

    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
      background-color: var(--bg-color);
      background-image: var(--bg-gradient);
      color: var(--text-main);
      font-family: var(--hud-font);
      transition: background-color 0.4s ease, color 0.4s ease;
    }

    #map-container {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      z-index: 1;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;
      touch-action: none;
    }

    canvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: grab;
      touch-action: none;
    }

    /* ==========================================================================
       TOP CONTROL HEADER
       ========================================================================== */
    header {
      position: absolute;
      top: calc(16px + env(safe-area-inset-top, 0px));
      left: calc(20px + env(safe-area-inset-left, 0px));
      right: calc(20px + env(safe-area-inset-right, 0px));
      height: 38px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      z-index: 20;
      pointer-events: none;
    }

    header > * {
      pointer-events: auto;
    }

    .brand-section {
      height: 38px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      padding: 0 16px;
      border-radius: var(--border-radius);
      box-shadow: var(--card-border-glow);
    }

    .logo-pulse {
      width: 10px;
      height: 10px;
      background: var(--accent);
      border-radius: 50%;
      box-shadow: 0 0 10px var(--accent);
      animation: pulse-ring 2s infinite;
    }

    @keyframes pulse-ring {
      0% { transform: scale(0.9); opacity: 1; }
      50% { transform: scale(1.3); opacity: 0.6; }
      100% { transform: scale(0.9); opacity: 1; }
    }

    .brand-title {
      font-weight: 800;
      font-size: 14px;
      letter-spacing: 1px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .brand-badge {
      font-size: 10px;
      padding: 2px 6px;
      background: rgba(0, 255, 170, 0.15);
      color: var(--accent);
      border: 1px solid var(--accent);
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    /* Centered Search Input Box */
    .search-wrapper {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: clamp(280px, 28vw, 420px);
      z-index: 25;
      pointer-events: auto;
    }

    .search-input-box {
      width: 100%;
      height: 38px;
      box-sizing: border-box;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: var(--text-main);
      font-family: inherit;
      font-size: 13.5px;
      padding: 0 14px 0 40px;
      border-radius: var(--border-radius);
      outline: none;
      box-shadow: var(--card-border-glow);
      transition: var(--transition-smooth);
    }

    .search-input-box:focus {
      border-color: var(--accent);
      box-shadow: 0 0 18px var(--accent-glow);
    }

    .search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      color: var(--accent);
      pointer-events: none;
      z-index: 50;
      filter: drop-shadow(0 0 8px var(--accent-glow));
      line-height: 1;
    }

    .search-icon-svg {
      stroke: var(--accent);
      width: 17px;
      height: 17px;
      display: block;
    }

    .search-results {
      position: absolute;
      top: calc(100% + 6px);
      left: 0; right: 0;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-radius: var(--border-radius);
      max-height: 290px;
      overflow-y: auto;
      display: none;
      flex-direction: column;
      box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85);
      z-index: 80;
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
    }

    .search-results::-webkit-scrollbar {
      width: 4px;
    }
    .search-results::-webkit-scrollbar-track {
      background: transparent;
      margin: 4px 0;
    }
    .search-results::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.22);
      border-radius: 4px;
    }
    .search-results::-webkit-scrollbar-thumb:hover {
      background: var(--accent);
    }

    .search-results.active {
      display: flex;
    }

    .search-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 9px 14px;
      cursor: pointer;
      font-size: 13.5px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      transition: background 0.15s ease, color 0.15s ease;
    }

    .search-item:last-child {
      border-bottom: none;
    }

    .search-item:hover, .search-item.highlighted {
      background: rgba(255, 255, 255, 0.08);
      color: var(--accent);
    }

    .search-item-info {
      display: flex;
      align-items: baseline;
      gap: 7px;
    }

    .search-item-city {
      font-weight: 700;
      letter-spacing: 0.2px;
      color: var(--text-main);
    }

    .search-item:hover .search-item-city,
    .search-item.highlighted .search-item-city {
      color: var(--accent);
    }

    .search-item-native {
      font-size: 11.5px;
      color: var(--text-muted);
      font-weight: 400;
    }

    .search-item-country {
      font-size: 12px;
      color: var(--text-muted);
      font-family: var(--font-mono);
      letter-spacing: 0.3px;
    }

    /* Top Right Action Group: Exactly 38px height aligned with Brand & Search */
    .top-actions {
      height: 38px;
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
    }

    .top-action-btn {
      height: 38px;
      box-sizing: border-box;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      color: var(--text-main);
      padding: 0 13px;
      border-radius: var(--border-radius);
      cursor: pointer;
      font-size: 12.5px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 6px;
      box-shadow: var(--card-border-glow);
      transition: var(--transition-smooth);
      font-family: inherit;
      user-select: none;
      white-space: nowrap;
    }

    .top-action-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
      box-shadow: 0 0 14px var(--accent-glow);
    }

    .top-action-btn.active {
      border-color: var(--accent);
      background: rgba(0, 255, 170, 0.12);
      color: var(--accent);
      box-shadow: 0 0 16px var(--accent-glow);
    }

    /* Floating Settings Dropdown Panel */
    .settings-dropdown {
      position: absolute;
      top: calc(100% + 10px);
      right: 0;
      width: 360px;
      background: rgba(6, 14, 25, 0.96);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      padding: 16px 18px;
      border-radius: var(--border-radius);
      box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), var(--card-border-glow);
      display: none;
      flex-direction: column;
      gap: 15px;
      z-index: 150;
      user-select: none;
      box-sizing: border-box;
    }

    .settings-dropdown.active {
      display: flex;
      animation: fadeInDown 0.18s ease-out;
    }

    @keyframes fadeInDown {
      from { opacity: 0; transform: translateY(-6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .settings-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      padding-bottom: 8px;
      font-size: 11.5px;
      font-weight: 800;
      color: var(--accent);
      letter-spacing: 0.8px;
    }

    .settings-close-btn {
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 13px;
      font-weight: 700;
      padding: 0 4px;
      transition: var(--transition-smooth);
    }

    .settings-close-btn:hover {
      color: var(--text-main);
    }

    .settings-row {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .settings-label {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.5px;
    }

    /* Theme Selectors */
    .theme-selector {
      display: flex;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      padding: 2px;
      border-radius: 6px;
      gap: 2px;
    }

    .theme-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: inherit;
      font-size: 12px;
      font-weight: 700;
      padding: 8px 10px;
      border-radius: 4px;
      cursor: pointer;
      transition: var(--transition-smooth);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      justify-content: center;
      white-space: nowrap;
      min-height: 36px;
      box-sizing: border-box;
    }

    .theme-btn:hover {
      color: var(--text-main);
    }

    .theme-btn.active {
      background: var(--accent);
      color: #03070d;
      box-shadow: 0 0 10px var(--accent-glow);
    }

    /* Custom Glassmorphic Language Selector (20 Global Languages) */
    .lang-dropdown-wrapper {
      position: relative;
      width: 100%;
      box-sizing: border-box;
    }

    .lang-select-trigger {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      padding: 8px 12px;
      border-radius: 6px;
      color: var(--text-main);
      font-family: inherit;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      transition: var(--transition-smooth);
      box-sizing: border-box;
    }

    .lang-select-trigger:hover,
    .lang-dropdown-wrapper.open .lang-select-trigger {
      border-color: var(--accent);
      box-shadow: 0 0 10px var(--accent-glow);
    }

    .lang-trigger-text {
      flex: 1;
      text-align: left;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      letter-spacing: 0.3px;
    }

    .lang-trigger-arrow {
      font-size: 11px;
      color: var(--text-muted);
      transition: transform 0.2s ease;
      margin-left: 8px;
    }

    .lang-dropdown-wrapper.open .lang-trigger-arrow {
      transform: rotate(180deg);
      color: var(--accent);
    }

    .lang-dropdown-menu {
      display: none;
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      background: rgba(6, 12, 22, 0.98);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.92), 0 0 15px var(--accent-glow);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      z-index: 200;
      padding: 6px;
      box-sizing: border-box;
      max-height: 250px;
      flex-direction: column;
      gap: 6px;
    }

    .lang-dropdown-wrapper.open .lang-dropdown-menu {
      display: flex;
      animation: fadeInDown 0.15s ease-out;
    }

    .lang-search-box {
      width: 100%;
      box-sizing: border-box;
      padding: 2px 0 4px 0;
    }

    .lang-search-input {
      width: 100%;
      background: rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: var(--text-main);
      font-size: 11.5px;
      font-family: inherit;
      padding: 6px 10px;
      border-radius: 4px;
      box-sizing: border-box;
      outline: none;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .lang-search-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 8px var(--accent-glow);
    }

    .lang-options-list {
      display: flex;
      flex-direction: column;
      gap: 2px;
      overflow-y: auto;
      max-height: 185px;
      padding-right: 2px;
    }

    .lang-options-list::-webkit-scrollbar {
      width: 4px;
    }

    .lang-options-list::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 2px;
    }

    .lang-option-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 6px 10px;
      border-radius: 4px;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
      user-select: none;
      box-sizing: border-box;
    }

    .lang-option-item:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    .lang-option-item.active {
      background: var(--accent);
      color: #03070d;
      font-weight: 700;
    }

    .lang-option-main {
      display: flex;
      align-items: baseline;
      gap: 6px;
    }

    .lang-native-name {
      font-size: 12px;
      font-weight: 700;
    }

    .lang-sub-name {
      font-size: 10px;
      color: var(--text-muted);
    }

    .lang-option-item.active .lang-sub-name {
      color: #03070d;
      opacity: 0.85;
    }

    .lang-check-icon {
      font-size: 12px;
      font-weight: 900;
      opacity: 0;
    }

    .lang-option-item.active .lang-check-icon {
      opacity: 1;
    }

    .zen-btn {
      width: 100%;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      color: var(--text-main);
      padding: 8px 12px;
      border-radius: calc(var(--border-radius) - 2px);
      cursor: pointer;
      font-size: 12px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: var(--transition-smooth);
      font-family: inherit;
    }

    .zen-btn:hover {
      border-color: var(--accent-secondary);
      color: var(--accent-secondary);
      background: rgba(0, 229, 255, 0.1);
      box-shadow: 0 0 12px var(--accent-secondary-glow);
    }

    /* Zen Ambient Focus Mode */
    body.zen-active header,
    body.zen-active .zoom-deck,
    body.zen-active .bottom-deck,
    body.zen-active #city-hud {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }

    body.zen-active,
    body.zen-active #map-container,
    body.zen-active #world-canvas {
      cursor: default !important;
    }

    /* Ambient Mode Clean Layout: Distraction-free, top pill removed, bottom dock controlled */

    /* Ambient Sound Control Deck (Wide Horizontal Dock in Ambient Mode) */
    .ambient-sound-deck {
      position: absolute;
      bottom: calc(24px + env(safe-area-inset-bottom, 0px));
      left: 50%;
      transform: translateX(-50%);
      background: rgba(8, 16, 28, 0.94);
      border: 1px solid rgba(255, 255, 255, 0.16);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-radius: 9999px;
      height: 48px;
      padding: 0 16px;
      z-index: 1000;
      display: none;
      flex-direction: row;
      align-items: center;
      gap: 9px;
      box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.2);
      transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
      opacity: 0.95;
      box-sizing: border-box;
      user-select: none;
      white-space: nowrap;
      max-width: calc(100vw - 32px);
      overflow-x: auto;
      scrollbar-width: none;
    }

    .ambient-sound-deck::-webkit-scrollbar {
      display: none;
    }

    .ambient-sound-deck:hover {
      opacity: 1.0;
      border-color: var(--accent);
      box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9), 0 0 16px var(--accent-glow);
    }

    .ambient-sound-deck.ambient-deck-hidden {
      opacity: 0 !important;
      pointer-events: none !important;
      transform: translate(-50%, 18px) !important;
      transition: opacity 0.8s ease, transform 0.8s ease !important;
    }

    body.zen-active .ambient-sound-deck {
      display: flex;
      animation: ambientDeckSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes ambientDeckSlideUp {
      from { opacity: 0; transform: translate(-50%, 20px); }
      to { opacity: 0.95; transform: translate(-50%, 0); }
    }

    body[data-theme="mono"] .ambient-sound-deck {
      background: #000000 !important;
      border: 1px solid #ffffff !important;
      box-shadow: none !important;
      height: 48px !important;
    }
    body[data-theme="mono"] .ambient-deck-title {
      color: #ffffff !important;
    }
    body[data-theme="mono"] .ambient-pill.active,
    body[data-theme="mono"] .ambient-type-pill.active {
      background: #ffffff !important;
      color: #000000 !important;
      border-color: #ffffff !important;
      box-shadow: none !important;
    }
    body[data-theme="mono"] .ambient-vol-slider::-webkit-slider-thumb {
      background: #ffffff !important;
      box-shadow: 0 0 8px rgba(255, 255, 255, 0.5) !important;
    }

    body[data-theme="retro"] .ambient-sound-deck {
      background: #120e24 !important;
      border: 2px solid #5cd688 !important;
      border-radius: 0 !important;
      box-shadow: 4px 4px 0 #000000 !important;
      height: 48px !important;
      font-family: var(--font-pixel), monospace !important;
    }
    body[data-theme="retro"] .ambient-deck-title {
      font-family: var(--font-pixel), monospace !important;
      color: #ffd152 !important;
      font-size: 9.5px !important;
    }
    body[data-theme="retro"] .ambient-pill,
    body[data-theme="retro"] .ambient-type-pill {
      border-radius: 0px !important;
      font-family: var(--font-pixel), monospace !important;
      font-size: 9.5px !important;
      height: 26px !important;
      border: 1px solid #5cd688 !important;
      background: #0d091b !important;
      color: #5cd688 !important;
    }
    body[data-theme="retro"] .ambient-pill.active,
    body[data-theme="retro"] .ambient-type-pill.active {
      background: #5cd688 !important;
      color: #0d091b !important;
      box-shadow: none !important;
    }
    body[data-theme="retro"] .ambient-volume-divider {
      background: #5cd688 !important;
      height: 22px !important;
    }
    body[data-theme="retro"] .ambient-vol-label {
      font-family: var(--font-pixel), monospace !important;
      font-size: 9.5px !important;
      color: #ffd152 !important;
    }
    body[data-theme="retro"] .ambient-vol-slider::-webkit-slider-thumb {
      border-radius: 0px !important;
      background: #ffd152 !important;
      box-shadow: 2px 2px 0px #000000 !important;
    }

    .ambient-deck-brand {
      display: flex;
      align-items: center;
      gap: 6px;
      padding-right: 3px;
    }

    .ambient-deck-brand-icon {
      font-size: 15px;
      line-height: 1;
    }

    .ambient-deck-title {
      font-family: var(--font-mono, monospace);
      font-size: 11.5px;
      font-weight: 800;
      color: var(--accent);
      letter-spacing: 0.9px;
    }

    .ambient-sound-types {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .ambient-pill, .ambient-type-pill {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 9999px;
      color: var(--text-muted);
      font-size: 12.5px;
      font-weight: 700;
      height: 28px;
      padding: 0 11px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s ease;
      text-align: center;
      white-space: nowrap;
      font-family: var(--font-mono);
      line-height: 1;
      box-sizing: border-box;
    }

    /* Fixed width for ambient airplane toggle: Pre-sized for ✈️ OFF so dock NEVER jitters */
    #ambient-btn-planes {
      min-width: 78px;
      width: 78px;
      text-align: center;
      justify-content: center;
      box-sizing: border-box;
    }

    .ambient-pill:hover, .ambient-type-pill:hover {
      background: rgba(255, 255, 255, 0.14);
      color: var(--text-main);
      transform: translateY(-1px);
    }

    .ambient-pill.active, .ambient-type-pill.active {
      background: var(--accent);
      color: #03070d;
      border-color: var(--accent);
      box-shadow: 0 0 12px var(--accent-glow);
      font-weight: 800;
    }

    .ambient-volume-divider {
      width: 1px;
      height: 22px;
      background: rgba(255, 255, 255, 0.16);
      margin: 0 2px;
    }

    .ambient-volume-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ambient-deck-mute {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 15px;
      padding: 2px 4px;
      border-radius: 6px;
      transition: transform 0.15s ease;
      line-height: 1;
    }

    .ambient-deck-mute:hover {
      transform: scale(1.15);
    }

    .ambient-vol-slider {
      width: 80px;
      height: 5px;
      -webkit-appearance: none;
      appearance: none;
      background: rgba(255, 255, 255, 0.18);
      border-radius: 3px;
      outline: none;
      cursor: pointer;
    }

    .ambient-vol-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent);
      cursor: pointer;
      box-shadow: 0 0 8px var(--accent-glow);
    }

    .ambient-vol-slider::-moz-range-thumb {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent);
      border: none;
      cursor: pointer;
      box-shadow: 0 0 8px var(--accent-glow);
    }

    .ambient-vol-label {
      font-size: 11.5px;
      font-family: var(--font-mono);
      font-weight: 700;
      color: var(--text-muted);
      min-width: 32px;
      text-align: right;
    }

    .ambient-view-modes {
      display: flex;
      align-items: center;
      gap: 5px;
    }

    #ambient-btn-exit:hover {
      background: rgba(239, 68, 68, 0.22);
      border-color: #ef4444;
      color: #fca5a5;
    }

    /* Unified View Mode & Zoom Deck (Bottom Right): Matched 88px Height */
    .zoom-deck {
      position: absolute;
      bottom: calc(20px + env(safe-area-inset-bottom, 0px));
      right: calc(24px + env(safe-area-inset-right, 0px));
      height: 88px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      padding: 10px 16px;
      border-radius: var(--border-radius);
      box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), var(--card-border-glow);
      z-index: 25;
      user-select: none;
      -webkit-user-select: none;
      min-width: 250px;
    }

    .zoom-deck-header {
      height: 28px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .view-mode-group {
      display: inline-flex;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      padding: 2px;
      gap: 2px;
    }

    .mode-pill {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 700;
      padding: 4px 12px;
      border-radius: 4px;
      cursor: pointer;
      font-family: inherit;
      transition: var(--transition-smooth);
    }

    .mode-pill:hover {
      color: var(--text-main);
    }

    .mode-pill.active {
      background: var(--accent);
      color: #03070d;
      box-shadow: 0 0 10px var(--accent-glow);
    }

    .zoom-readout {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .zoom-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.5px;
    }

    .zoom-multiplier-badge {
      font-size: 12px;
      font-weight: 800;
      color: var(--accent);
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      padding: 3px 8px;
      border-radius: 4px;
      min-width: 44px;
      text-align: center;
      font-family: var(--font-mono);
    }

    .zoom-controls-row {
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      width: 100%;
    }

    .zoom-btn {
      width: 28px;
      height: 28px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      color: var(--text-main);
      border-radius: calc(var(--border-radius) - 2px);
      font-size: 14px;
      font-family: inherit;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: var(--card-border-glow);
      transition: var(--transition-smooth);
      flex-shrink: 0;
    }

    .zoom-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
      background: rgba(255, 255, 255, 0.12);
    }

    .zoom-btn.reset {
      font-size: 12.5px;
    }

    /* Custom Zoom Range Slider Track & Thumb */
    #zoom-slider {
      -webkit-appearance: none;
      appearance: none;
      flex: 1;
      min-width: 80px;
      height: 5px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 3px;
      outline: none;
      cursor: pointer;
      margin: 0 4px;
    }

    #zoom-slider:hover {
      background: rgba(255, 255, 255, 0.35);
    }

    #zoom-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent);
      box-shadow: 0 0 8px var(--accent);
      cursor: pointer;
      transition: transform 0.15s ease;
    }

    #zoom-slider::-webkit-slider-thumb:hover {
      transform: scale(1.25);
    }

    #zoom-slider::-moz-range-thumb {
      width: 14px;
      height: 14px;
      border: none;
      border-radius: 50%;
      background: var(--accent);
      box-shadow: 0 0 8px var(--accent);
      cursor: pointer;
    }


    .density-mode-group {
      display: flex;
      width: 100%;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      padding: 2px;
      gap: 2px;
      box-sizing: border-box;
    }

    .density-pill {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 800;
      padding: 8px 10px;
      border-radius: 4px;
      cursor: pointer;
      font-family: inherit;
      transition: var(--transition-smooth);
      text-align: center;
      min-height: 36px;
      box-sizing: border-box;
    }

    .density-pill:hover {
      color: var(--text-main);
    }

    .density-pill.active {
      background: var(--accent);
      color: #03070d;
      box-shadow: 0 0 8px var(--accent-glow);
    }

    .airplane-toggle-group {
      display: flex;
      width: 100%;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      padding: 2px;
      gap: 2px;
      box-sizing: border-box;
    }

    .airplane-pill {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 800;
      padding: 8px 10px;
      border-radius: 4px;
      cursor: pointer;
      font-family: inherit;
      transition: var(--transition-smooth);
      text-align: center;
      min-height: 36px;
      box-sizing: border-box;
    }

    .airplane-pill:hover {
      color: var(--text-main);
    }

    .airplane-pill.active {
      background: var(--accent);
      color: #03070d;
      box-shadow: 0 0 8px var(--accent-glow);
    }

    /* ==========================================================================
       DYNAMIC HUD TOOLTIP (FLOATING OR PINNED) - ZERO TRANSITION DELAY
       ========================================================================== */
    #city-hud {
      position: absolute;
      z-index: 100;
      pointer-events: none;
      display: none;
      width: auto;
      min-width: 415px;
      max-width: calc(100vw - 24px);
      box-sizing: border-box;
      background: rgba(6, 14, 25, 0.96);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      padding: 16px 22px;
      border-radius: var(--border-radius);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), var(--card-border-glow);
    }

    #city-hud.pinned {
      pointer-events: auto;
      border-color: var(--accent);
      box-shadow: 0 20px 48px rgba(0, 0, 0, 0.92), 0 0 30px var(--accent-glow);
    }

    .hud-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      padding-bottom: 10px;
      gap: 18px;
    }

    .hud-header-right {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-top: 1px;
    }

    .hud-city-info {
      display: flex;
      flex-direction: column;
      gap: 1px;
    }

    .hud-city-title {
      font-size: 18px;
      font-weight: 800;
      line-height: 1.2;
      white-space: nowrap;
    }

    .hud-country {
      font-size: 12px;
      color: var(--text-muted);
    }

    .hud-daynight-badge {
      font-size: 11px;
      padding: 0 8px;
      height: 22px;
      line-height: 1;
      border-radius: 20px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-weight: 700;
      white-space: nowrap;
      background: rgba(255, 255, 255, 0.06);
      box-sizing: border-box;
    }

    .hud-daynight-badge.day {
      background: rgba(251, 191, 36, 0.15);
      color: #fbbf24;
      border: 1px solid rgba(251, 191, 36, 0.4);
    }

    .hud-daynight-badge.night {
      background: rgba(147, 197, 253, 0.15);
      color: #93c5fd;
      border: 1px solid rgba(147, 197, 253, 0.4);
    }

    .hud-daynight-badge.twilight {
      background: rgba(255, 133, 51, 0.18);
      color: #ff8533;
      border: 1px solid rgba(255, 133, 51, 0.45);
    }

    /* Side-by-Side Unified Time & Date Section */
    .hud-time-section {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      padding-top: 6px;
      min-width: 0;
    }

    #hud-time-val {
      font-size: 28px;
      font-weight: 800;
      letter-spacing: -0.5px;
      line-height: 1.1;
      color: var(--text-main);
      font-family: var(--font-mono);
      white-space: nowrap;
      flex-shrink: 0;
    }

    .hud-time-meta {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 5px;
      min-width: 0;
      flex-shrink: 1;
    }

    .hud-date {
      font-size: 11px;
      color: var(--text-muted);
      font-family: var(--font-mono);
      letter-spacing: 0.3px;
      white-space: nowrap;
    }

    .hud-meta-badges {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 4px;
      flex-wrap: wrap;
      max-width: 100%;
    }

    .hud-ampm {
      font-size: 10.5px;
      font-weight: 700;
      color: var(--accent);
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--card-border);
      padding: 1.5px 5px;
      border-radius: 4px;
      letter-spacing: 0.3px;
      white-space: nowrap;
    }

    .hud-dst-badge {
      font-size: 10px;
      font-weight: 700;
      color: #fbbf24;
      background: rgba(251, 191, 36, 0.12);
      border: 1px solid rgba(251, 191, 36, 0.35);
      padding: 1.5px 5px;
      border-radius: 4px;
      display: none;
      white-space: nowrap;
    }

    .hud-dst-badge.active {
      display: inline-flex;
    }

    .hud-diff-pill {
      font-size: 10.5px;
      font-weight: 700;
      padding: 1.5px 5px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      white-space: nowrap;
    }

    .hud-diff-pill.same {
      background: rgba(0, 255, 170, 0.12);
      color: #00ffaa;
      border: 1px solid rgba(0, 255, 170, 0.3);
    }

    .hud-diff-pill.ahead {
      background: rgba(56, 189, 248, 0.12);
      color: #38bdf8;
      border: 1px solid rgba(56, 189, 248, 0.3);
    }

    .hud-diff-pill.behind {
      background: rgba(245, 158, 11, 0.12);
      color: #f59e0b;
      border: 1px solid rgba(245, 158, 11, 0.3);
    }

    .hud-close-btn {
      position: absolute;
      top: -10px;
      right: -10px;
      background: #091322;
      border: 1.5px solid var(--accent);
      color: #ffffff;
      cursor: pointer;
      font-size: 12px;
      font-weight: 900;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transform: scale(0.7);
      transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
      line-height: 1;
      padding: 0;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8);
      z-index: 30;
    }

    .hud-close-btn:hover {
      background: #ef4444;
      border-color: #ef4444;
      color: #ffffff;
      transform: scale(1.15);
      box-shadow: 0 0 14px rgba(239, 68, 68, 0.85);
    }

    #city-hud.pinned .hud-close-btn {
      opacity: 1;
      pointer-events: auto;
      transform: scale(1);
    }

    /* ==========================================================================
       BOTTOM 24-HOUR TIMELINE CONTROLLER: Matched 88px Height
       ========================================================================== */
    .bottom-deck {
      position: absolute;
      bottom: calc(20px + env(safe-area-inset-bottom, 0px));
      left: 50%;
      transform: translateX(-50%);
      width: min(700px, 66vw);
      height: 88px;
      box-sizing: border-box;
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      padding: 10px 18px;
      border-radius: var(--border-radius);
      box-shadow: var(--card-border-glow), 0 20px 40px rgba(0,0,0,0.6);
      z-index: 20;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    .timeline-header {
      height: 28px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
    }

    .time-status-group {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .live-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11.5px;
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 20px;
      background: rgba(0, 255, 170, 0.12);
      color: var(--accent);
      border: 1px solid var(--accent);
      cursor: pointer;
      transition: var(--transition-smooth);
    }

    .live-badge.off {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-muted);
      border-color: rgba(255, 255, 255, 0.15);
    }

    .live-dot-pulse {
      width: 7px;
      height: 7px;
      background: currentColor;
      border-radius: 50%;
      box-shadow: 0 0 6px currentColor;
    }

    .sim-clock {
      font-size: 18px;
      font-weight: 800;
      letter-spacing: 0.6px;
      color: var(--text-main);
    }

    .playback-controls {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .deck-btn {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--text-main);
      padding: 5px 11px;
      font-size: 12px;
      font-family: inherit;
      border-radius: 6px;
      cursor: pointer;
      transition: var(--transition-smooth);
    }

    /* Fixed width for speed button: Pre-measured for 100x so layout NEVER shudders */
    #btn-speed {
      min-width: 58px;
      width: 58px;
      text-align: center;
      justify-content: center;
      padding: 5px 2px;
      box-sizing: border-box;
      font-variant-numeric: tabular-nums;
    }

    .deck-btn:hover {
      background: var(--accent);
      color: #000;
      border-color: var(--accent);
    }

    .deck-btn.active {
      background: var(--accent);
      color: #000;
      font-weight: 700;
    }

    .slider-container {
      width: 100%;
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .time-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 5px;
      border-radius: 3px;
      background: linear-gradient(
        to right,
        rgba(0, 229, 255, 0.2),
        var(--accent),
        rgba(255, 170, 0, 0.6),
        rgba(0, 229, 255, 0.2)
      );
      outline: none;
      cursor: pointer;
    }

    .time-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: var(--accent);
      box-shadow: 0 0 12px var(--accent), 0 0 0 2px #fff;
      cursor: pointer;
      transition: transform 0.1s ease;
    }

    .time-slider::-webkit-slider-thumb:hover {
      transform: scale(1.25);
    }

    .timeline-ticks {
      display: flex;
      justify-content: space-between;
      color: var(--text-muted);
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.5px;
      padding: 0 2px;
    }

/* ==========================================================================
   SUPPORT & BUY ME A COFFEE MODAL (INSIDE SETTINGS)
   ========================================================================== */
.settings-support-btn {
  background: rgba(255, 170, 0, 0.12);
  border: 1px solid rgba(255, 170, 0, 0.35);
  color: #ffaa00;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
.settings-support-btn:hover {
  background: rgba(255, 170, 0, 0.24);
  border-color: #ffaa00;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 170, 0, 0.3);
}

.support-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.support-modal-overlay.active {
  display: flex;
}

.support-modal-content {
  background: var(--hud-bg, rgba(13, 17, 23, 0.96));
  border: 1px solid var(--hud-border, rgba(0, 255, 157, 0.35));
  border-radius: 14px;
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(255, 170, 0, 0.15);
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--hud-text, #ffffff);
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.support-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.support-modal-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffaa00;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.support-close-btn {
  background: transparent;
  border: none;
  color: var(--hud-muted, #8b949e);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
}
.support-close-btn:hover {
  color: #ff5555;
  background: rgba(255, 85, 85, 0.1);
}

.support-modal-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffaa00;
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.support-modal-desc {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--hud-muted, #c9d1d9);
  margin-bottom: 20px;
}

.donate-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #ffaa00;
  color: #000000;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  padding: 13px 18px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(255, 170, 0, 0.35);
  box-sizing: border-box;
}
.donate-btn-primary:hover {
  background: #ffbb22;
  box-shadow: 0 6px 20px rgba(255, 170, 0, 0.55);
  transform: translateY(-1px);
}
.donate-btn-primary .bmc-cup-icon {
  font-size: 18px;
}

/* ==========================================================================
   AMBIENT FOCUS HUD (Hero Focus Timer & OLED Burn-in Shield)
   ========================================================================== */
.ambient-focus-hud {
  display: none;
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  height: 48px;
  width: max-content;
  white-space: nowrap;
  background: rgba(8, 14, 22, 0.92);
  border: 1px solid rgba(0, 255, 157, 0.38);
  border-radius: 9999px;
  padding: 0 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.75), 0 0 24px rgba(0, 255, 157, 0.16);
  pointer-events: auto;
  user-select: none;
  transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
  animation: oledSubtleBreath 40s infinite ease-in-out;
  box-sizing: border-box;

  /* Symmetrical 3-Zone Geometric Grid */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
body.zen-active .ambient-focus-hud {
  display: grid;
}

.focus-hud-wing {
  display: inline-flex;
  align-items: center;
  height: 100%;
}
.focus-hud-left {
  justify-content: flex-end;
}
.focus-hud-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 12px;
  height: 100%;
}
.focus-hud-right {
  justify-content: flex-start;
  gap: 12px;
}

.focus-timer-action-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 30px;
}

.focus-clock-group {
  display: inline-flex;
  align-items: center;
  height: 30px;
}

.focus-hud-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.focus-preset-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 3px 5px;
  height: 30px;
  box-sizing: border-box;
}
.focus-preset-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  height: 24px;
  padding: 0;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
}
.focus-preset-pill[data-preset="infinite"] {
  font-size: 15px;
  font-weight: 900;
  min-width: 26px;
  width: 26px;
  line-height: 1;
}
.focus-preset-pill:not([data-preset="infinite"]):not(.custom) {
  min-width: 38px;
  width: 38px;
}
/* Fixed width sized for "Custom" text: Dock NEVER jitters whether Custom or 25m/111m/360m is active! */
#focus-preset-custom-pill {
  min-width: 60px;
  width: 60px;
  text-align: center;
  justify-content: center;
}
.focus-preset-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}
.focus-preset-pill.active {
  background: var(--accent);
  color: #03070d;
  font-weight: 800;
  box-shadow: 0 0 10px var(--accent-glow);
}

.focus-loop-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 3px 5px;
  height: 30px;
  box-sizing: border-box;
  transition: opacity 0.2s ease;
}
.focus-loop-group.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.focus-loop-group.disabled * {
  pointer-events: none;
}
.focus-loop-pill,
.focus-break-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 700;
  height: 24px;
  padding: 0;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
}
.focus-loop-pill {
  min-width: 68px;
  width: 68px;
}
.focus-break-pill {
  min-width: 82px;
  width: 82px;
}
.focus-loop-pill:hover,
.focus-break-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}
.focus-loop-pill.active {
  background: #38bdf8;
  color: #03070d;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}
.focus-break-pill.in-break {
  background: #38bdf8;
  color: #03070d;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  animation: pulseBreak 1.8s infinite ease-in-out;
}
@keyframes pulseBreak {
  0%, 100% { box-shadow: 0 0 8px rgba(56, 189, 248, 0.5); }
  50% { box-shadow: 0 0 16px rgba(56, 189, 248, 0.9); }
}

.focus-hud-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  box-sizing: border-box;
}
.focus-clock-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  height: 30px;
  line-height: 30px;
  min-width: 76px;
  width: 76px;
  text-align: center;
  box-sizing: border-box;
}
.focus-pause-btn,
.focus-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 0;
  flex-shrink: 0;
}
.focus-btn-icon {
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}
.focus-pause-btn:hover {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.45);
  background: rgba(0, 240, 255, 0.15);
  transform: scale(1.08);
}
.focus-pause-btn.paused {
  color: #ffaa00;
  border-color: rgba(255, 170, 0, 0.5);
  background: rgba(255, 170, 0, 0.18);
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}
.focus-reset-btn:hover {
  color: var(--accent);
  border-color: rgba(0, 255, 170, 0.45);
  background: rgba(0, 255, 170, 0.15);
  transform: rotate(-90deg);
}

.focus-timer-hero {
  font-family: var(--font-mono, monospace);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(0, 255, 157, 0.5);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  width: 86px;
  text-align: center;
  box-sizing: border-box;
  transition: color 0.3s ease, opacity 0.3s ease;
}
.focus-timer-hero.paused {
  color: #ffaa00;
  text-shadow: 0 0 12px rgba(255, 170, 0, 0.5);
  animation: pulsePause 1.5s infinite ease-in-out;
}
.focus-timer-hero.completed {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
  animation: pulseCompleted 1.2s infinite ease-in-out;
}
.focus-timer-hero.mode-break {
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.7);
}
@keyframes pulseCompleted {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}
@keyframes pulsePause {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 0.45; }
}

@keyframes timerChangePulse {
  0% {
    transform: scale(1);
    color: var(--accent);
    text-shadow: 0 0 24px var(--accent-glow);
    filter: brightness(1.4);
  }
  20% {
    transform: scale(1.10);
    color: var(--accent);
    text-shadow: 0 0 32px var(--accent-glow);
    filter: brightness(1.6) drop-shadow(0 0 16px var(--accent-glow));
  }
  50% {
    transform: scale(1.05);
    color: var(--accent);
    text-shadow: 0 0 26px var(--accent-glow);
    filter: brightness(1.35) drop-shadow(0 0 10px var(--accent-glow));
  }
  80% {
    transform: scale(1.02);
    color: var(--accent);
    text-shadow: 0 0 18px var(--accent-glow);
    filter: brightness(1.15);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.focus-timer-hero.timer-flash {
  animation: timerChangePulse 2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ==========================================================================
   CUSTOM FOCUS TIME POPOVER (CLEAN & CLEAR HORIZON CAPSULE)
   ========================================================================== */
.custom-focus-popover {
  display: none;
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background: rgba(6, 14, 25, 0.95);
  border: 1px solid var(--accent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 16px;
  border-radius: 9999px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85), 0 0 20px var(--accent-glow);
  flex-direction: row;
  align-items: center;
  gap: 10px;
  height: 42px;
  user-select: none;
  animation: fadeInDown 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.custom-focus-popover.active {
  display: inline-flex;
}

.custom-popover-title {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.custom-input-box {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 8px;
  height: 28px;
  gap: 4px;
  transition: all 0.2s ease;
}

.custom-input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  background: rgba(0, 0, 0, 0.8);
}

#custom-focus-input {
  width: 48px;
  height: 24px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-mono, monospace);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  outline: none;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* 100% REMOVE BROWSER NATIVE UP/DOWN SPINNER ARROWS */
#custom-focus-input::-webkit-outer-spin-button,
#custom-focus-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.custom-popover-unit {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.custom-popover-btn {
  background: var(--accent);
  border: none;
  color: #03070d;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  padding: 0 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}

.custom-popover-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px var(--accent-glow);
}

.custom-popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.custom-popover-close:hover {
  color: #ff5555;
}

/* ==========================================================================
   LOOP BREAK TIME POPOVER (CLEAN & CLEAR HORIZON CAPSULE)
   ========================================================================== */
.loop-break-popover {
  display: none;
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background: rgba(6, 14, 25, 0.95);
  border: 1px solid #38bdf8;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 16px;
  border-radius: 9999px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85), 0 0 20px rgba(56, 189, 248, 0.4);
  flex-direction: row;
  align-items: center;
  gap: 10px;
  height: 42px;
  user-select: none;
  animation: fadeInDown 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.loop-break-popover.active {
  display: inline-flex;
}

.loop-break-popover .custom-popover-title {
  color: #38bdf8;
}

.loop-break-popover .custom-input-box:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.loop-break-popover .custom-popover-btn {
  background: #38bdf8;
  color: #03070d;
}

#loop-break-input {
  width: 48px;
  height: 24px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-mono, monospace);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  outline: none;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

#loop-break-input::-webkit-outer-spin-button,
#loop-break-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

@keyframes oledSubtleBreath {
  0%, 100% { opacity: 0.98; }
  50% { opacity: 0.88; }
}

/* ==========================================================================
   FOCUS NOTIFICATION TOAST (HUD State & Timer Feedback)
   ========================================================================== */
.focus-toast-notice {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 1002;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(8, 14, 22, 0.94);
  border: 1px solid rgba(0, 255, 157, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 255, 157, 0.15);
  color: #c4f0ff;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-sizing: border-box;
}

.focus-toast-notice.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   THEME ADAPTIVE SUPPORT & BUY ME A COFFEE
   ========================================================================== */
/* Cyberpunk Theme Support */
body[data-theme="cyberpunk"] .settings-support-btn {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.35);
  color: #00e5ff;
}
body[data-theme="cyberpunk"] .settings-support-btn:hover {
  background: rgba(0, 229, 255, 0.22);
  border-color: #00e5ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.45);
}
body[data-theme="cyberpunk"] .support-modal-content {
  border: 1px solid rgba(0, 229, 255, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 229, 255, 0.2);
}
body[data-theme="cyberpunk"] .support-modal-title {
  color: #00e5ff;
}
body[data-theme="cyberpunk"] .support-modal-badge {
  color: #00ffaa;
  background: rgba(0, 255, 170, 0.1);
  border: 1px solid rgba(0, 255, 170, 0.35);
}
body[data-theme="cyberpunk"] .donate-btn-primary {
  background: linear-gradient(135deg, #00ffaa, #00e5ff);
  color: #03070d;
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.4);
}
body[data-theme="cyberpunk"] .donate-btn-primary:hover {
  box-shadow: 0 6px 24px rgba(0, 255, 170, 0.6);
  transform: translateY(-1px);
}

/* Mono Theme Support */
body[data-theme="mono"] .settings-support-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
body[data-theme="mono"] .settings-support-btn:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}
body[data-theme="mono"] .support-modal-content {
  background: #090c12;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 30px rgba(255, 255, 255, 0.08);
}
body[data-theme="mono"] .support-modal-title {
  color: #ffffff;
}
body[data-theme="mono"] .support-modal-badge {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
body[data-theme="mono"] .donate-btn-primary {
  background: #ffffff;
  color: #000000;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25);
}
body[data-theme="mono"] .donate-btn-primary:hover {
  background: #e2e8f0;
  box-shadow: 0 6px 22px rgba(255, 255, 255, 0.4);
}

/* Retro 8-Bit Theme Support */
body[data-theme="retro"] .settings-support-btn {
  background: #1d163d !important;
  border: 2px solid #ffd152 !important;
  color: #ffd152 !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 11px !important;
  border-radius: 0px !important;
  box-shadow: 2px 2px 0px #000000 !important;
  letter-spacing: -0.3px !important;
}
body[data-theme="retro"] .settings-support-btn:hover {
  background: #ffd152 !important;
  color: #120e24 !important;
  box-shadow: 1px 1px 0px #000000 !important;
  transform: translate(1px, 1px) !important;
}
body[data-theme="retro"] .support-modal-content {
  background: #120e24 !important;
  border: 3px solid #5cd688 !important;
  border-radius: 0px !important;
  box-shadow: 6px 6px 0px #000000 !important;
  font-family: var(--font-pixel), monospace !important;
}
body[data-theme="retro"] .support-modal-title {
  color: #ffd152 !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 13px !important;
}
body[data-theme="retro"] .support-close-btn {
  font-family: var(--font-pixel), monospace !important;
  color: #ff5e7e !important;
  font-size: 14px !important;
}
body[data-theme="retro"] .support-modal-badge {
  color: #5cd688 !important;
  background: #1d163d !important;
  border: 2px solid #5cd688 !important;
  border-radius: 0px !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 9px !important;
}
body[data-theme="retro"] .support-modal-desc {
  font-family: var(--font-pixel), monospace !important;
  font-size: 10px !important;
  color: #fce762 !important;
  line-height: 1.8 !important;
}
body[data-theme="retro"] .donate-btn-primary {
  background: #ffd152 !important;
  color: #120e24 !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 11px !important;
  border-radius: 0px !important;
  border: 2px solid #ffffff !important;
  box-shadow: 4px 4px 0px #000000 !important;
}
body[data-theme="retro"] .donate-btn-primary:hover {
  background: #ffe082 !important;
  transform: translate(2px, 2px) !important;
  box-shadow: 2px 2px 0px #000000 !important;
}

/* ==========================================================================
   THEME ADAPTIVE AMBIENT FOCUS SESSION HUD
   ========================================================================== */
/* Mono Theme Focus Session Overrides */
body[data-theme="mono"] .ambient-focus-hud {
  background: rgba(11, 15, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 255, 255, 0.12);
}
body[data-theme="mono"] .focus-timer-hero {
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
  color: #ffffff;
}
body[data-theme="mono"] .focus-timer-hero.paused {
  color: #cbd5e1;
  text-shadow: 0 0 12px rgba(203, 213, 225, 0.4);
}
body[data-theme="mono"] .focus-preset-pill.active {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}
body[data-theme="mono"] .focus-pause-btn:hover,
body[data-theme="mono"] .focus-reset-btn:hover {
  color: #ffffff;
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}
body[data-theme="mono"] .custom-focus-popover {
  background: #090c12;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.95), 0 0 15px rgba(255, 255, 255, 0.1);
}
body[data-theme="mono"] .custom-popover-title {
  color: #ffffff;
}
body[data-theme="mono"] .custom-input-box:focus-within {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}
body[data-theme="mono"] .custom-popover-btn {
  background: #ffffff;
  color: #000000;
}
body[data-theme="mono"] .focus-loop-pill.active,
body[data-theme="mono"] .focus-break-pill.in-break {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}
body[data-theme="mono"] .focus-timer-hero.mode-break {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
}
body[data-theme="mono"] .loop-break-popover {
  background: #090c12;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.95), 0 0 15px rgba(255, 255, 255, 0.1);
}
body[data-theme="mono"] .loop-break-popover .custom-popover-title {
  color: #ffffff;
}
body[data-theme="mono"] .loop-break-popover .custom-input-box:focus-within {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}
body[data-theme="mono"] .loop-break-popover .custom-popover-btn {
  background: #ffffff;
  color: #000000;
}
body[data-theme="mono"] .focus-toast-notice {
  background: rgba(11, 15, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Retro 8-Bit Theme Focus Session Overrides */
body[data-theme="retro"] .ambient-focus-hud {
  background: #120e24 !important;
  border: 2px solid #5cd688 !important;
  border-radius: 0px !important;
  box-shadow: 4px 4px 0px #000000 !important;
  font-family: var(--font-pixel), monospace !important;
  height: 48px !important;
}
body[data-theme="retro"] .focus-hud-divider {
  background: #5cd688 !important;
}
body[data-theme="retro"] .focus-preset-group {
  border-radius: 0px !important;
  border: 1px solid #5cd688 !important;
  background: #0d091b !important;
  height: 30px !important;
}
body[data-theme="retro"] .focus-preset-pill {
  border-radius: 0px !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 11px !important;
  height: 24px !important;
}
body[data-theme="retro"] .focus-preset-pill[data-preset="infinite"] {
  min-width: 28px !important;
  width: 28px !important;
}
body[data-theme="retro"] .focus-preset-pill:not([data-preset="infinite"]):not(.custom) {
  min-width: 44px !important;
  width: 44px !important;
}
body[data-theme="retro"] #focus-preset-custom-pill {
  min-width: 68px !important;
  width: 68px !important;
}
body[data-theme="retro"] .focus-preset-pill.active {
  background: #5cd688 !important;
  color: #0d091b !important;
  box-shadow: none !important;
}
body[data-theme="retro"] .focus-clock-time {
  font-family: var(--font-pixel), monospace !important;
  font-size: 11.5px !important;
  color: #9c8dc4 !important;
}
body[data-theme="retro"] .focus-pause-btn,
body[data-theme="retro"] .focus-reset-btn {
  border-radius: 0px !important;
  font-family: var(--font-pixel), monospace !important;
  border: 1px solid #5cd688 !important;
  width: 28px !important;
  height: 28px !important;
}
body[data-theme="retro"] .focus-pause-btn:hover {
  color: #5cd688 !important;
  border-color: #5cd688 !important;
  background: rgba(92, 214, 136, 0.2) !important;
  transform: none !important;
}
body[data-theme="retro"] .focus-reset-btn:hover {
  color: #ffd152 !important;
  border-color: #ffd152 !important;
  background: rgba(255, 209, 82, 0.2) !important;
  transform: none !important;
}
body[data-theme="retro"] .focus-timer-hero {
  font-family: var(--font-pixel), monospace !important;
  font-size: 20px !important;
  color: #5cd688 !important;
  text-shadow: 2px 2px 0px #000000 !important;
  letter-spacing: 1px !important;
}
body[data-theme="retro"] .focus-timer-hero.paused {
  color: #ffd152 !important;
  text-shadow: 2px 2px 0px #000000 !important;
}
body[data-theme="retro"] .custom-focus-popover {
  background: #120e24 !important;
  border: 2px solid #5cd688 !important;
  border-radius: 0px !important;
  box-shadow: 4px 4px 0px #000000 !important;
  font-family: var(--font-pixel), monospace !important;
  height: 42px !important;
}
body[data-theme="retro"] .custom-popover-title {
  font-family: var(--font-pixel), monospace !important;
  color: #ffd152 !important;
  font-size: 9.5px !important;
}
body[data-theme="retro"] .custom-input-box {
  border-radius: 0px !important;
  border: 1px solid #5cd688 !important;
  background: #0a0614 !important;
  height: 28px !important;
}
body[data-theme="retro"] #custom-focus-input {
  font-family: var(--font-pixel), monospace !important;
  border: none !important;
  background: transparent !important;
  color: #5cd688 !important;
  font-size: 12px !important;
}
body[data-theme="retro"] .custom-popover-unit {
  font-family: var(--font-pixel), monospace !important;
  font-size: 9.5px !important;
  color: #9c8dc4 !important;
}
body[data-theme="retro"] .custom-popover-btn {
  font-family: var(--font-pixel), monospace !important;
  border-radius: 0px !important;
  background: #ffd152 !important;
  color: #120e24 !important;
  font-size: 10px !important;
  height: 28px !important;
  box-shadow: 2px 2px 0px #000000 !important;
}
body[data-theme="retro"] .custom-popover-close {
  font-family: var(--font-pixel), monospace !important;
  color: #ff5e7e !important;
}
body[data-theme="retro"] .focus-loop-group {
  border-radius: 0px !important;
  border: 1px solid #5cd688 !important;
  background: #0d091b !important;
  height: 30px !important;
}
body[data-theme="retro"] .focus-loop-pill,
body[data-theme="retro"] .focus-break-pill {
  border-radius: 0px !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 10px !important;
  height: 24px !important;
}
body[data-theme="retro"] .focus-loop-pill {
  min-width: 68px !important;
  width: 68px !important;
}
body[data-theme="retro"] .focus-break-pill {
  min-width: 82px !important;
  width: 82px !important;
}
body[data-theme="retro"] .focus-loop-pill.active,
body[data-theme="retro"] .focus-break-pill.in-break {
  background: #ffd152 !important;
  color: #120e24 !important;
  box-shadow: none !important;
}
body[data-theme="retro"] .focus-timer-hero.mode-break {
  color: #ffd152 !important;
  text-shadow: 2px 2px 0px #000000 !important;
}
body[data-theme="retro"] .loop-break-popover {
  background: #120e24 !important;
  border: 2px solid #5cd688 !important;
  border-radius: 0px !important;
  box-shadow: 4px 4px 0px #000000 !important;
  font-family: var(--font-pixel), monospace !important;
  height: 42px !important;
}
body[data-theme="retro"] .loop-break-popover .custom-popover-title {
  font-family: var(--font-pixel), monospace !important;
  color: #ffd152 !important;
  font-size: 9.5px !important;
}
body[data-theme="retro"] .loop-break-popover .custom-input-box {
  border-radius: 0px !important;
  border: 1px solid #5cd688 !important;
  background: #0a0614 !important;
  height: 28px !important;
}
body[data-theme="retro"] #loop-break-input {
  font-family: var(--font-pixel), monospace !important;
  border: none !important;
  background: transparent !important;
  color: #5cd688 !important;
  font-size: 12px !important;
}
body[data-theme="retro"] .loop-break-popover .custom-popover-btn {
  font-family: var(--font-pixel), monospace !important;
  border-radius: 0px !important;
  background: #ffd152 !important;
  color: #120e24 !important;
  font-size: 10px !important;
  height: 28px !important;
  box-shadow: 2px 2px 0px #000000 !important;
}
body[data-theme="retro"] .loop-break-popover .custom-popover-close {
  font-family: var(--font-pixel), monospace !important;
  color: #ff5e7e !important;
}
body[data-theme="retro"] .focus-toast-notice {
  background: #120e24 !important;
  border: 2px solid #5cd688 !important;
  border-radius: 0px !important;
  box-shadow: 4px 4px 0px #000000 !important;
  color: #5cd688 !important;
  font-family: var(--font-pixel), monospace !important;
  font-size: 10px !important;
}

/* Theme Adaptive Custom Language Selector */
/* Mono Theme Language Overrides */
body[data-theme="mono"] .lang-select-trigger {
  border-color: rgba(255, 255, 255, 0.25);
}
body[data-theme="mono"] .lang-select-trigger:hover,
body[data-theme="mono"] .lang-dropdown-wrapper.open .lang-select-trigger {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
body[data-theme="mono"] .lang-dropdown-menu {
  background: rgba(11, 15, 23, 0.98);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 255, 255, 0.15);
}
body[data-theme="mono"] .lang-option-item.active {
  background: #ffffff !important;
  color: #000000 !important;
}
body[data-theme="mono"] .lang-option-item.active .lang-sub-name {
  color: #000000 !important;
}

/* Retro Theme Language Overrides */
body[data-theme="retro"] .lang-dropdown-wrapper,
body[data-theme="retro"] .lang-select-trigger,
body[data-theme="retro"] .lang-dropdown-menu,
body[data-theme="retro"] .lang-search-input,
body[data-theme="retro"] .lang-option-item {
  border-radius: 0px !important;
  font-family: var(--font-pixel), monospace !important;
}
body[data-theme="retro"] .lang-select-trigger {
  border: 1px solid #5cd688 !important;
  background: #0d091b !important;
  font-size: 11px !important;
}
body[data-theme="retro"] .lang-dropdown-menu {
  background: #120e24 !important;
  border: 2px solid #5cd688 !important;
  box-shadow: 4px 4px 0px #000000 !important;
}
body[data-theme="retro"] .lang-search-input {
  border: 1px solid #5cd688 !important;
  background: #0a0614 !important;
}
body[data-theme="retro"] .lang-option-item.active {
  background: #5cd688 !important;
  color: #0d091b !important;
}
body[data-theme="retro"] .lang-option-item.active .lang-sub-name {
  color: #0d091b !important;
}


/* ==========================================================================
   RESPONSIVE LAYER
   Order matters: wider breakpoints first, narrower ones override them.
   - <=1180px : tablets (landscape), small laptops, phones in landscape
   - <=768px  : tablets (portrait) and phones
   - <=480px  : small phones
   Ambient timer capsule: one row needs ~800px, so it wraps at <=820px.
   - short landscape (max-height 500px): phones turned sideways
   ========================================================================== */
/* Mobile browsers: size to the visible viewport so the toolbar doesn't cover the bottom deck */
@supports (height: 100dvh) {
  html, body {
    height: 100dvh;
  }
}

.settings-dropdown {
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 1180px) {
  /* Search joins the header flow instead of being absolutely centered over the buttons */
  header .search-wrapper {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    flex: 1 1 auto;
    width: auto;
    min-width: 150px;
    max-width: 420px;
  }
  /* Timeline sits left so it never runs under the zoom deck (bottom-right) */
  .bottom-deck {
    left: calc(20px + env(safe-area-inset-left, 0px));
    transform: none;
    width: calc(100% - 330px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-width: 700px;
  }
  .sim-clock {
    font-size: 14px;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: 8px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
  }
  header .search-wrapper {
    flex: none;
    width: 100%;
    max-width: none;
  }
  .brand-section {
    justify-content: space-between;
  }
  .top-actions {
    justify-content: space-between;
  }
  .top-action-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 8px;
    min-width: 0;
  }
  .settings-dropdown {
    width: 100%;
    box-sizing: border-box;
  }

  .bottom-deck {
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    width: auto;
    max-width: none;
    transform: none;
    height: auto;
    padding: 10px 14px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .timeline-header {
    height: auto;
    flex-wrap: wrap;
    row-gap: 6px;
    margin-bottom: 4px;
  }
  .sim-clock {
    font-size: 13px;
  }
  .zoom-deck {
    bottom: calc(110px + env(safe-area-inset-bottom, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    padding: 4px 8px;
    height: auto;
  }
  .zoom-deck .zoom-readout,
  .zoom-deck .zoom-slider-row {
    display: none;
  }

  /* City card: JS docks it above the zoom deck on narrow screens */
  #city-hud,
  body[data-theme="retro"] #city-hud {
    min-width: 0 !important;
    width: min(380px, calc(100vw - 20px)) !important;
    padding: 12px 16px;
  }
  .support-modal-content {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .brand-badge {
    display: none;
  }
  .top-action-btn {
    font-size: 11.5px;
    padding: 0 6px;
  }
  .timeline-ticks span:nth-child(even) {
    visibility: hidden;
  }
}

/* Phones turned sideways: vertical space is scarce, keep the header to a single row */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    flex-direction: row;
    align-items: center;
    height: 34px;
    gap: 8px;
    top: calc(8px + env(safe-area-inset-top, 0px));
  }
  header .search-wrapper {
    flex: 1 1 auto;
    width: auto;
  }
  .brand-section,
  .top-action-btn,
  .search-input-box {
    height: 34px;
  }
  .top-actions {
    height: 34px;
  }
  .top-action-btn {
    flex: none;
  }
  .brand-badge {
    display: none;
  }
  .bottom-deck {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

/* --------------------------------------------------------------------------
   Ambient mode: the single-row timer capsule (~790px) and sound dock (~1100px)
   reflow into rows on narrower screens.
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  body[data-theme] .ambient-sound-deck {
    flex-wrap: wrap;
    justify-content: center;
    height: auto !important;
    padding: 8px 12px;
    border-radius: 22px;
    row-gap: 8px;
    overflow: visible;
    width: max-content;
    max-width: calc(100vw - 24px);
  }
  .ambient-volume-divider {
    display: none;
  }
}

@media (max-width: 820px) {
  .ambient-focus-hud {
    grid-template-columns: auto auto;
    grid-template-areas:
      "center center"
      "left right";
    justify-content: center;
    height: auto;
    max-width: calc(100vw - 24px);
    padding: 6px 12px;
    border-radius: 22px;
    row-gap: 4px;
    column-gap: 12px;
  }
  .focus-hud-center { grid-area: center; }
  .focus-hud-left { grid-area: left; justify-content: center; }
  .focus-hud-right { grid-area: right; justify-content: center; }
  .ambient-focus-hud .focus-hud-divider {
    display: none;
  }
  .focus-hud-wing,
  .focus-hud-center {
    height: 40px;
  }
}

@media (max-width: 560px) {
  .ambient-focus-hud {
    grid-template-columns: auto;
    grid-template-areas:
      "center"
      "left"
      "right";
  }
  .ambient-deck-brand {
    display: none;
  }
  .ambient-sound-types {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
  }
  .focus-toast-notice {
    white-space: normal;
    text-align: center;
    max-width: calc(100vw - 32px);
  }
}

.custom-popover-btn {
  white-space: nowrap;
}

/* Header dropdowns (settings, search results) must paint above the bottom/zoom decks */
header {
  z-index: 40;
}

/* ==========================================================================
   MOBILE SIMPLE MODE (<=768px)
   One-row header (search + icon buttons), collapsed timeline, pinch replaces
   zoom buttons, slimmer ambient controls. Desktop is untouched.
   ========================================================================== */
.timeline-expand-btn {
  display: none;
}

@media (max-width: 768px) {
  /* Header: [dot] [search .......] [📍][🎧][⚙️] */
  header {
    flex-direction: row;
    align-items: center;
    height: 38px;
    gap: 6px;
  }
  .brand-section {
    flex: none;
    padding: 0 13px;
  }
  .brand-title {
    display: none;
  }
  header .search-wrapper {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  .top-actions {
    flex: none;
    gap: 6px;
    justify-content: flex-end;
  }
  .top-action-btn {
    flex: none;
    width: 38px;
    padding: 0;
    justify-content: center;
  }
  .top-action-btn .btn-label {
    display: none;
  }
  .top-action-btn .btn-ico {
    font-size: 16px;
    line-height: 1;
  }

  /* Dropdowns span the screen under the header instead of the narrow button group */
  .settings-dropdown,
  .search-results {
    position: fixed;
    top: calc(58px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: auto;
  }
  .settings-dropdown {
    max-height: calc(100dvh - 76px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  /* Timeline: collapsed to LIVE + clock until expanded */
  .timeline-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    min-width: 34px;
  }
  .bottom-deck:not(.expanded) {
    padding: 8px 12px;
  }
  .bottom-deck:not(.expanded) .playback-controls,
  .bottom-deck:not(.expanded) .slider-container {
    display: none;
  }
  .bottom-deck:not(.expanded) .timeline-header {
    margin-bottom: 0;
  }
  .bottom-deck.expanded .playback-controls {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  /* Zoom deck: pinch handles zoom, keep only 2D/3D and reset; ride above the timeline */
  .zoom-deck {
    bottom: calc(var(--bottom-deck-h, 52px) + 18px + env(safe-area-inset-bottom, 0px));
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    height: auto;
    padding: 4px 6px;
  }
  .zoom-deck .zoom-deck-header {
    height: auto;
  }
  .zoom-deck .zoom-controls-row {
    width: auto;
    height: auto;
  }
  .zoom-deck .zoom-controls-row > *:not(#btn-zoom-reset) {
    display: none;
  }
}

@media (max-width: 560px) {
  /* Ambient: the phone status bar already shows the time; hardware keys set the volume */
  .ambient-focus-hud .focus-clock-group,
  .ambient-vol-slider,
  .ambient-vol-label {
    display: none;
  }
}

/* PWA install button (settings) — accent instead of the coffee amber */
.settings-row[hidden] {
  display: none !important;
}
.install-app-btn {
  background: rgba(0, 255, 170, 0.10);
  border-color: var(--card-border);
  color: var(--accent);
}
.install-app-btn:hover {
  background: rgba(0, 255, 170, 0.2);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 12px var(--accent-glow);
}

a.settings-support-btn {
  display: block;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Timeline vs zoom deck (found by sweeping every width 320-1920px):
   - wide screens: the centered timeline shrinks so it never reaches the zoom deck
     (zoom deck ~280px + 24px margin + gap on each side => 100% - 640px)
   - 769-1180px: the left-aligned timeline may wrap its controls onto a second row
   -------------------------------------------------------------------------- */
@media (min-width: 1181px) {
  .bottom-deck {
    width: min(700px, calc(100% - 640px));
  }
}
@media (max-width: 1180px) {
  .bottom-deck {
    height: auto;
    min-height: 88px;
  }
  .timeline-header {
    height: auto;
    flex-wrap: wrap;
    row-gap: 6px;
  }
}
@media (max-width: 768px) {
  .bottom-deck {
    min-height: 0;
  }
}

/* Theme rules (e.g. retro) pin some sizes with higher specificity; phones must win */
@media (max-width: 768px) {
  body[data-theme] .top-action-btn {
    padding: 0;
  }
  body[data-theme] .settings-dropdown {
    width: auto;
  }
}

/* Ambient sound dock needs ~1250px on one row; wrap below that, including the pill group itself */
@media (max-width: 1300px) {
  body[data-theme] .ambient-sound-deck {
    flex-wrap: wrap;
    justify-content: center;
    height: auto !important;
    padding: 8px 12px;
    border-radius: 22px;
    row-gap: 8px;
    overflow: visible;
    width: max-content;
    max-width: calc(100vw - 24px);
  }
  .ambient-volume-divider {
    display: none;
  }
  .ambient-sound-types {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
  }
}

/* Stream / recording mode (?stream=1): canvas only, no controls, no cursor */
body.stream-mode header,
body.stream-mode .zoom-deck,
body.stream-mode .bottom-deck,
body.stream-mode #city-hud,
body.stream-mode .ambient-sound-deck,
body.stream-mode .ambient-focus-hud,
body.stream-mode .focus-toast-notice,
body.stream-mode .custom-focus-popover,
body.stream-mode .loop-break-popover {
  display: none !important;
}
body.stream-mode,
body.stream-mode canvas,
body.stream-mode #map-container {
  cursor: none !important;
}

/* Small link to /credits/ at the bottom of the settings panel */
.settings-credits-link { display: block; margin-top: 10px; text-align: center; font-size: 11px; letter-spacing: .04em; color: var(--text-muted, #8aa0b8); opacity: .75; text-decoration: none; }
.settings-credits-link:hover { opacity: 1; text-decoration: underline; }
