/* ═══════════════════════════════════════════════════════════════
   IN THINE IMAGE - Premium Game Styling
   ═══════════════════════════════════════════════════════════════ */

:root {
    --gold-divine: #D4AF37;
    --gold-light: #F4E4BA;
    --gold-dark: #8B7355;
    --purple-deep: #2D1B4E;
    --purple-mid: #4A3066;
    --blue-night: #1a1a2e;
    --panel-bg: rgba(26, 26, 46, 0.92);
    --panel-border: rgba(212, 175, 55, 0.3);
    --text-light: #f4f4f4;
    --text-muted: #a0a0a0;
    --font-display: 'Cinzel', serif;
    --font-body: 'Cormorant Garamond', serif;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--blue-night);
    font-family: var(--font-body);
    color: var(--text-light);
}

/* ═══════════════════════════════════════════════════════════════
   GAME CONTAINER
   ═══════════════════════════════════════════════════════════════ */

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#game-canvas:active {
    cursor: grabbing;
}

#speech-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.speech-bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    max-width: 200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.speech-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.95);
    border-bottom: none;
}

.speech-bubble .speaker-name {
    font-weight: 600;
    color: var(--purple-mid);
}

/* ═══════════════════════════════════════════════════════════════
   CONTROL BAR
   ═══════════════════════════════════════════════════════════════ */

#control-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.bar-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bar-left {
    flex: 0 0 auto;
}

.bar-center {
    flex: 1;
    justify-content: center;
    gap: 24px;
}

.bar-right {
    flex: 0 0 auto;
}

.game-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--gold-divine);
    letter-spacing: 2px;
}

.time-display {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-muted);
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: 8px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.icon-btn.active {
    background: var(--gold-divine);
    color: var(--blue-night);
}

.icon-btn {
    position: relative;
}

.inbox-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF6B6B;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
}

.inbox-badge.hidden {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-family: var(--font-display);
    color: var(--gold-divine);
    font-size: 1.2rem;
}

.inbox-list {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.inbox-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.newsletter {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    border-left: 3px solid var(--gold-divine);
}

.newsletter.unread {
    border-left-color: #4ECDC4;
}

.newsletter-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.newsletter-title {
    font-family: var(--font-display);
    color: var(--gold-light);
    font-size: 0.95rem;
}

.newsletter-date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.newsletter-section {
    margin-bottom: 10px;
}

.newsletter-section h4 {
    color: var(--gold-divine);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.newsletter-section p {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   THE ROYAL WHISPERER - NYT-Style Newspaper Layout
   ═══════════════════════════════════════════════════════════════ */

.newspaper-masthead {
    text-align: center;
    padding: 16px 12px;
    border-bottom: 2px solid var(--gold-divine);
    margin-bottom: 12px;
}

.newspaper-title {
    font-family: 'Playfair Display', var(--font-display), serif;
    font-size: 1.4rem;
    color: var(--gold-light);
    font-weight: 700;
    letter-spacing: 1px;
}

.newspaper-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 6px;
}

.newspaper-date {
    color: var(--text-light);
    font-size: 0.75rem;
    font-style: italic;
}

.newspaper-edition {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.newspaper-headline {
    text-align: center;
    padding: 16px 12px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-radius: 8px;
    margin-bottom: 16px;
}

.newspaper-headline h2 {
    font-family: 'Playfair Display', var(--font-display), serif;
    font-size: 1.1rem;
    color: var(--gold-light);
    line-height: 1.3;
    margin: 0;
}

.newspaper-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.news-section {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 2px solid rgba(212, 175, 55, 0.4);
}

.news-section h3 {
    font-size: 0.75rem;
    color: var(--gold-divine);
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.news-section p {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
    margin: 4px 0;
}

.newspaper-extras {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 12px;
}

.prayer-section {
    margin-bottom: 12px;
}

.prayer-section h4 {
    font-size: 0.8rem;
    color: var(--gold-divine);
    margin-bottom: 6px;
}

.prayer-section blockquote {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.85rem;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    padding-left: 10px;
    margin: 0;
}

.ad-section {
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    text-align: center;
}

.ad-section small {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-style: italic;
}

/* Responsive newspaper layout */
@media (max-width: 480px) {
    .newspaper-sections {
        grid-template-columns: 1fr;
    }

    .newspaper-title {
        font-size: 1.1rem;
    }

    .newspaper-headline h2 {
        font-size: 0.95rem;
    }
}

/* Danger button styling */
.icon-btn.danger {
    color: #FF6B6B;
}

.icon-btn.danger:hover {
    background: rgba(255, 107, 107, 0.2);
}

.negative-powers {
    background: rgba(255, 0, 0, 0.1);
}

/* Settings Modal */
.settings-content {
    max-width: 400px;
}

.settings-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    font-family: var(--font-display);
    color: var(--gold-divine);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.settings-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-family: var(--font-body);
}

.settings-input:focus {
    outline: none;
    border-color: var(--gold-divine);
}

.settings-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.8rem;
    transition: all 0.2s ease;
    margin-right: 8px;
    margin-bottom: 8px;
}

.settings-btn.primary {
    background: var(--gold-divine);
    color: var(--blue-night);
}

.settings-btn.primary:hover {
    background: var(--gold-light);
}

.settings-btn.danger {
    background: rgba(255, 107, 107, 0.2);
    color: #FF6B6B;
    border: 1px solid #FF6B6B;
}

.settings-btn.danger:hover {
    background: #FF6B6B;
    color: white;
}

.danger-zone h4 {
    color: #FF6B6B;
}

/* Divine Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 150;
    overflow: hidden;
}

.divine-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleFall 3s ease-out forwards;
    box-shadow: 0 0 10px currentColor;
}

@keyframes particleFall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.particle-gold {
    background: var(--gold-divine);
    color: var(--gold-divine);
}

.particle-green {
    background: #4ECDC4;
    color: #4ECDC4;
}

.particle-purple {
    background: #9370DB;
    color: #9370DB;
}

.particle-red {
    background: #FF6B6B;
    color: #FF6B6B;
}

.particle-blue {
    background: #45B7D1;
    color: #45B7D1;
}

/* ═══════════════════════════════════════════════════════════════
   DIVINE DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

#divine-dashboard {
    position: fixed;
    top: 70px;
    left: 16px;
    width: 220px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 12px;
    z-index: 90;
    backdrop-filter: blur(12px);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.dash-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    color: var(--gold-divine);
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.dash-section {
    margin-bottom: 14px;
}

.dash-section h4 {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-row span:last-child {
    color: var(--text-light);
    font-weight: 500;
}

.belief-bar {
    display: flex;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.belief-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.belief-fill.spiritual {
    background: linear-gradient(90deg, #9370DB, #7B68EE);
}

.belief-fill.secular {
    background: linear-gradient(90deg, #4ECDC4, #45B7D1);
}

.mini-bar {
    width: 80px;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-mid), #4ECDC4);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 50%;
}

.mini-fill.greed {
    background: linear-gradient(90deg, #FF6B6B, #FFE66D);
}

/* ═══════════════════════════════════════════════════════════════
   INSPECTOR PANEL
   ═══════════════════════════════════════════════════════════════ */

#inspector-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 14px;
    z-index: 90;
    backdrop-filter: blur(12px);
}

#inspector-panel.hidden {
    display: none;
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.close-btn svg {
    width: 16px;
    height: 16px;
}

.inspector-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.character-portrait {
    width: 55px;
    height: 55px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--gold-dark);
}

.character-portrait canvas {
    width: 100%;
    height: 100%;
}

.character-info h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--gold-light);
    margin-bottom: 2px;
}

.character-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.inspector-section {
    margin-bottom: 12px;
}

.inspector-section h3 {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--gold-divine);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.attr-grid {
    display: grid;
    gap: 6px;
}

.attr {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attr-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 65px;
}

.attr-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.attr-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-mid), #4ECDC4);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 50%;
    /* Default fallback */
}

/* Per-Attribute Colors */
#attr-health {
    background: linear-gradient(90deg, #ff4444, #ff8888);
}

#attr-happiness {
    background: linear-gradient(90deg, #f9ca24, #f0e130);
}

#attr-wealth {
    background: linear-gradient(90deg, #ffd700, #ffec8b);
}

#attr-social {
    background: linear-gradient(90deg, #9b59b6, #8e44ad);
}

#attr-knowledge {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

#char-activity,
#char-interests {
    font-size: 0.85rem;
    color: var(--text-light);
}

#thought-log {
    max-height: 80px;
    overflow-y: auto;
}

.thought {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding-left: 8px;
    border-left: 2px solid var(--purple-mid);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   MINIMAP
   ═══════════════════════════════════════════════════════════════ */

#minimap {
    position: fixed;
    bottom: 20px;
    right: 16px;
    width: 130px;
    height: 130px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    z-index: 80;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════ */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--blue-night) 0%, var(--purple-deep) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    color: var(--gold-divine);
    margin-bottom: 16px;
    letter-spacing: 4px;
}

.loading-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.loading-bar {
    width: 280px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 12px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: var(--gold-divine);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   ABOUT MODAL
   ═══════════════════════════════════════════════════════════════ */

.about-content {
    max-width: 600px;
    max-height: 85vh;
}

.about-body {
    padding: 24px;
    overflow-y: auto;
}

.about-section {
    margin-bottom: 24px;
}

.about-section h3 {
    font-family: var(--font-display);
    color: var(--gold-divine);
    font-size: 1.1rem;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.about-section p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.control-list {
    list-style: none;
}

.control-list li {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-left: 14px;
    position: relative;
}

.control-list li::before {
    content: '•';
    color: var(--gold-divine);
    position: absolute;
    left: 0;
}

.control-list strong {
    color: var(--text-light);
}

.credits {
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.credits p {
    color: var(--text-muted);
}


.loading-phase {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--purple-mid);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7B5EA7;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - TABLETS & PHONES
   ═══════════════════════════════════════════════════════════════ */

/* TABLET LANDSCAPE (1024px and below) */
@media (max-width: 1024px) {
    #divine-dashboard {
        width: 200px;
        font-size: 0.9em;
    }

    #inspector-panel {
        width: 260px;
    }

    .game-title {
        font-size: 1.1rem;
    }
}

/* TABLET PORTRAIT (768px and below) */
@media (max-width: 768px) {
    #control-bar {
        height: 50px;
        padding: 0 12px;
    }

    .bar-center {
        gap: 12px;
    }

    .game-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .time-display {
        font-size: 0.85rem;
        padding: 3px 8px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        /* Touch-friendly */
    }

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

    #divine-dashboard {
        top: 60px;
        left: 10px;
        width: 180px;
        padding: 10px;
        max-height: calc(100vh - 80px);
    }

    .dash-header {
        font-size: 0.8rem;
    }

    .dash-section h4 {
        font-size: 0.65rem;
    }

    .stat-row {
        font-size: 0.75rem;
    }

    #inspector-panel {
        bottom: 10px;
        right: 10px;
        width: 240px;
        padding: 12px;
    }

    #minimap {
        width: 110px;
        height: 110px;
        bottom: 10px;
        right: 10px;
    }

    /* Hide minimap when inspector is open */
    #inspector-panel:not(.hidden)~#minimap {
        display: none;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .loading-content h1 {
        font-size: 2rem;
    }

    .loading-bar {
        width: 220px;
    }
}

/* PHONE (480px and below) */
@media (max-width: 480px) {

    /* COLLAPSIBLE CONTROL BAR */
    #control-bar {
        height: auto;
        min-height: 48px;
        padding: 8px;
        flex-direction: column;
        gap: 8px;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        padding-top: 40px;
        /* Space for pull tab */
    }

    #control-bar.expanded {
        transform: translateY(0);
    }

    /* Pull tab for control bar */
    #control-bar::before {
        content: '▼ Controls';
        position: absolute;
        bottom: -32px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--panel-bg);
        border: 1px solid var(--panel-border);
        border-top: none;
        padding: 6px 16px;
        border-radius: 0 0 12px 12px;
        font-size: 0.7rem;
        color: var(--gold-divine);
        cursor: pointer;
        font-family: var(--font-display);
    }

    #control-bar.expanded::before {
        content: '▲ Hide';
    }

    .bar-left {
        display: none;
    }

    .bar-right {
        position: static;
    }

    .bar-center {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-group {
        padding: 2px;
        gap: 2px;
    }

    .icon-btn {
        width: 42px;
        height: 42px;
    }

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

    /* COLLAPSIBLE DASHBOARD DRAWER */
    #divine-dashboard {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 45vh;
        border-radius: 16px 16px 0 0;
        z-index: 95;
        transform: translateY(calc(100% - 44px));
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    #divine-dashboard.expanded {
        transform: translateY(0);
    }

    .dash-header {
        cursor: pointer;
        text-align: center;
        justify-content: center;
        padding: 12px;
        position: sticky;
        top: 0;
        background: var(--panel-bg);
        z-index: 1;
    }

    .dash-header::after {
        content: ' ▲ Tap';
        font-size: 0.65rem;
        color: var(--text-muted);
    }

    #divine-dashboard.expanded .dash-header::after {
        content: ' ▼ Close';
    }

    #inspector-panel {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 50vh;
        overflow-y: auto;
    }

    #minimap {
        display: none;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .inbox-list {
        padding: 12px;
    }

    .newsletter {
        padding: 12px;
    }

    .settings-body {
        padding: 16px;
    }

    .settings-btn {
        width: 100%;
        padding: 12px;
        margin-right: 0;
    }

    .loading-content h1 {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    .loading-text {
        font-size: 0.95rem;
    }

    .loading-bar {
        width: 200px;
    }

    .about-content {
        max-width: 100%;
    }

    .about-body {
        padding: 16px;
    }

    .speech-bubble {
        max-width: 160px;
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* SMALL PHONE (360px and below) */
@media (max-width: 360px) {
    #control-bar {
        height: 44px;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
    }

    .icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .loading-content h1 {
        font-size: 1.4rem;
    }
}

/* TOUCH DEVICE ENHANCEMENTS */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .close-btn {
        width: 36px;
        height: 36px;
    }

    .close-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Disable hover states that don't work on touch */
    .icon-btn:hover {
        background: transparent;
    }

    .icon-btn:active {
        background: rgba(255, 255, 255, 0.2);
    }

    .settings-btn:hover {
        transform: none;
    }

    .settings-btn:active {
        opacity: 0.8;
    }

    /* Better scrolling */
    #divine-dashboard,
    #inspector-panel,
    .inbox-list,
    .about-body {
        -webkit-overflow-scrolling: touch;
    }
}

/* ═══════════════════════════════════════════════════════════════
   KO-FI TIP BUTTON
   ═══════════════════════════════════════════════════════════════ */

.tip-btn {
    position: relative;
    color: #FFD700 !important;
    overflow: visible;
}

.tip-btn:hover {
    background: rgba(255, 215, 0, 0.15) !important;
    color: #FFD700 !important;
}

.tip-btn .tip-label {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 10px;
    line-height: 1;
    pointer-events: none;
}

@keyframes tipPulse {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(255, 215, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    }
}

.tip-btn {
    animation: tipPulse 3s ease-in-out infinite;
    border-radius: 6px;
}

/* Ko-fi Modal */
.kofi-content {
    max-width: 420px;
    text-align: center;
}

.kofi-body {
    padding: 24px;
}

.kofi-text {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}

.kofi-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #FF5E5B, #FF813F);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 94, 91, 0.3);
}

.kofi-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 94, 91, 0.5);
}

.kofi-link-btn svg {
    width: 20px;
    height: 20px;
}

.kofi-small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   WORLD STATE ENRICHED DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

.world-state-section h4 {
    font-size: 0.75rem !important;
    color: var(--gold-divine) !important;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.era-row span:last-child {
    color: var(--gold-divine) !important;
    font-weight: 600 !important;
    font-family: var(--font-display);
    font-size: 0.75rem;
}

.era-progress-container {
    position: relative;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    margin: 4px 0 8px 0;
}

.era-progress-bar {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #D4AF37, #FFD700, #F4E4BA);
    transition: width 0.6s ease;
    width: 0%;
    position: relative;
}

.era-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.era-progress-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-family: var(--font-display);
    pointer-events: none;
}

.tech-track {
    margin-bottom: 6px;
}

.tech-track .mini-bar {
    width: 100%;
    height: 4px;
    margin-top: 2px;
}

.economy-fill {
    background: linear-gradient(90deg, #FFD700, #FFA500) !important;
}

.building-fill {
    background: linear-gradient(90deg, #8B7355, #CD853F) !important;
}

.knowledge-fill {
    background: linear-gradient(90deg, #4ECDC4, #45B7D1) !important;
}

.world-state-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    margin: 8px 0;
}

/* LANDSCAPE PHONE */
@media (max-height: 500px) and (orientation: landscape) {
    #control-bar {
        height: 40px;
    }

    #divine-dashboard {
        display: none;
    }

    #inspector-panel {
        max-height: 70vh;
    }

    .modal-content {
        max-height: 95vh;
    }

    .loading-content h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .loading-bar {
        width: 180px;
    }
}