/* css/style.css */
:root {
    --bg-dark: #0f1015;
    --bg-darker: #08080b;
    --text-light: #e0e0e0;
    --text-muted: #9aa0a6;
    --accent-gold: #d4af37;
    --accent-gold-hover: #f1c950;
    --accent-purple: #8e44ad;
    --accent-red: #e74c3c;
    --glass-bg: rgba(25, 26, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #2a1b38 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, #1a1a2e 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-light);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6,
.logo-text,
.logo-text-small {
    font-family: var(--font-heading);
    font-weight: 700;
}

.logo-text {
    font-size: 3rem;
    color: var(--accent-gold);
    text-align: center;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    margin-bottom: 0.2rem;
}

.logo-text-small {
    font-size: 1.5rem;
    color: var(--accent-gold);
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Layout views */
.view {
    display: none !important;
    flex: 1;
    width: 100%;
}

.view.active {
    display: flex !important;
    flex-direction: column;
}

#view-auth.active {
    min-height: 100vh;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

#view-player,
#view-gm {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.app-header {
    padding: 0.7rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1px;
}

.brand-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.brand-badge.gm-badge {
    background: rgba(142, 68, 173, 0.25);
    color: #d896ff;
    border: 1px solid rgba(142, 68, 173, 0.5);
}

.brand-badge.player-badge {
    background: rgba(52, 152, 219, 0.2);
    color: #70a1ff;
    border: 1px solid rgba(52, 152, 219, 0.4);
}

.gm-header {
    border-left: 4px solid var(--accent-purple);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-name-tag {
    font-size: 0.85rem;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
}

.nav-btn {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.82rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    border-radius: 6px !important;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--text-light) !important;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: rgba(212, 175, 55, 0.15) !important;
    border-color: var(--accent-gold) !important;
    color: var(--accent-gold) !important;
}

.nav-btn.hnf-lang-btn {
    border-color: #e67e22 !important;
    color: #e67e22 !important;
}

.nav-btn-new-campaign {
    border-color: var(--accent-purple) !important;
    color: #d896ff !important;
}

.nav-btn-logout {
    border-color: rgba(231, 76, 60, 0.4) !important;
    color: #e74c3c !important;
}

.nav-btn-logout:hover {
    background: rgba(231, 76, 60, 0.15) !important;
    border-color: #e74c3c !important;
    color: #ff7675 !important;
}

/* Forms and Inputs */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-light);
    font-family: var(--font-body);
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), #b8901b);
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
}

.btn-outline:hover {
    background: rgba(212, 175, 55, 0.1);
}

.w-100 {
    width: 100%;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

.auth-form {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.auth-form.active {
    display: block;
}

.error-msg {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 1rem;
    text-align: center;
    min-height: 1.2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Character Sheet Styles */
.sheet-header {
    margin-bottom: 2rem;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-title h2 {
    font-size: 2rem;
    color: var(--accent-gold);
}

.sheet-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.sheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .sheet-grid {
        grid-template-columns: 1fr;
    }
}

.sheet-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.sheet-section h3 {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    color: var(--accent-purple);
}

.attr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.attr-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attr-box:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--accent-gold);
}

.attr-name {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.attr-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
}

.resource-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.resource-row:last-child {
    border-bottom: none;
}

.res-tracker {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.res-tracker button {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-light);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.res-tracker button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.res-val {
    font-weight: bold;
    font-size: 1.1rem;
}

.highlight-gold {
    color: var(--accent-gold);
    font-size: 1.4rem;
}

/* Action Log Panel */
#action-log-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

#action-log-panel h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    color: var(--accent-gold);
}

#log-entries {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.5rem;
}

.log-entry {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 0.8rem;
    font-size: 0.85rem;
    line-height: 1.4;
    border-left: 3px solid var(--text-muted);
    animation: fadeIn 0.3s ease;
}

.log-entry.critical {
    border-left-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.log-entry.fear {
    border-left-color: var(--accent-purple);
}

.log-entry.alert {
    border-left-color: var(--accent-red);
    background: rgba(231, 76, 60, 0.1);
}

/* Visual Resource Bubbles (PV & Stress) */
.pv-circles {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pv-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    background: transparent;
    transition: all 0.2s ease;
}

.pv-circle.filled {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.pv-circle.stress-circle {
    border-color: rgba(231, 76, 60, 0.5);
}

.pv-circle.filled-stress {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

/* Fix dropdown options visibility */
option {
    background-color: var(--bg-darker);
    color: var(--text-light);
}

/* Character Avatar Styles */
.avatar-token {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.8);
    object-fit: cover;
    background-color: rgba(0, 0, 0, 0.6);
    margin: 0 auto 10px auto;
    display: block;
}

.avatar-token-wrapper {
    position: relative;
    display: inline-block;
}

.avatar-full-container {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    text-align: center;
}

.avatar-full-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    background-color: #000;
}

/* =========================================================================
   PDF EXPORT MODE STYLES
   These styles apply temporarily when html2pdf is rendering the character sheet,
   ensuring solid backgrounds, high contrast, and preventing awkward page breaks.
   ========================================================================= */
.pdf-export-mode {
    background: #0f0f13 !important;
    /* Solid dark background instead of any gradients or images */
    color: #ffffff !important;
}

.pdf-export-mode .glass-panel {
    background: #1e1e24 !important;
    /* Solid color instead of rgba transparency */
    border: 1px solid #333 !important;
    box-shadow: none !important;
    /* Remove shadows to prevent render glitches */
    page-break-inside: avoid;
    /* Prevent panel from splitting across pages */
    margin-bottom: 20px !important;
}

.pdf-export-mode .sheet-section {
    page-break-inside: avoid;
    background: #1e1e24 !important;
}

/* Ensure inner transparent panels (like the questions/skills) are solid for contrast */
.pdf-export-mode div[style*="background:rgba("],
.pdf-export-mode div[style*="background: rgba("] {
    background: #2a2a35 !important;
}

/* Specific text contrasts */
.pdf-export-mode .text-muted,
.pdf-export-mode [style*="color:var(--text-muted)"],
.pdf-export-mode [style*="color: var(--text-muted)"] {
    color: #b0b0b0 !important;
}

.pdf-export-mode h3,
.pdf-export-mode h4 {
    page-break-after: avoid;
}

.pdf-export-mode .sheet-grid {
    display: block !important;
    /* Sometimes grid behaves weirdly in canvas splitting. Block might stack them nicely if needed, or we can keep grid but with explicit breaks */
}

/* If we want to keep the 2-column layout in PDF grid, we ensure it doesn't break */
.pdf-export-mode .sheet-col {
    width: 100% !important;
    /* Force single column for better PDF readability and flow */
    margin-bottom: 20px;
}

/* Level Up Wizard Styles */
.adv-card {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.adv-card:hover:not(.disabled) {
    background: rgba(241, 196, 15, 0.05);
    border-color: rgba(241, 196, 15, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.adv-card.selected {
    background: rgba(241, 196, 15, 0.1);
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.2);
}

.adv-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.attr-picker {
    transition: all 0.2s ease;
}

.attr-picker.selected {
    background: rgba(241, 196, 15, 0.2) !important;
    border-color: var(--accent-gold) !important;
    color: var(--accent-gold) !important;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

.card-opt:hover {
    background: rgba(241, 196, 15, 0.05) !important;
    border-color: rgba(241, 196, 15, 0.3) !important;
}

.card-opt.selected {
    background: rgba(46, 204, 113, 0.1) !important;
    border-color: #2ecc71 !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Quick Guide Styles */
.btn-guide-tag {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-guide-tag:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.btn-guide-tag.active {
    background: var(--accent-gold);
    color: #000;
    font-weight: bold;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.guide-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: all 0.2s ease;
}

.guide-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(0, 0, 0, 0.55);
}

.guide-card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
    margin: 0;
}

.guide-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.guide-badge.hope {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.4);
}

.guide-badge.fear {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.4);
}

.guide-badge.critical {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.4);
}

/* NPC Quick Guide Styles */
.btn-npc-tag {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-npc-tag:hover {
    border-color: var(--accent-gold);
    color: white;
    background: rgba(212,175,55,0.1);
}
.btn-npc-tag.active {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
    font-weight: bold;
}
.npc-guide-card {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: all 0.2s;
}
.npc-guide-card:hover {
    border-color: rgba(212,175,55,0.4);
    background: rgba(255,255,255,0.03);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.npc-guide-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding-bottom: 0.5rem;
}
.npc-guide-card-title {
    font-family: 'Cinzel', serif;
    color: var(--accent-gold);
    font-size: 1.05rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.npc-guide-card-body p {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.45;
    margin: 0 0 0.5rem 0;
}
.npc-guide-tip {
    background: rgba(212,175,55,0.08);
    border-left: 3px solid var(--accent-gold);
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #eedca4;
    line-height: 1.4;
    margin-top: 0.4rem;
}
.ability-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    background: rgba(142, 68, 173, 0.25);
    color: #d896ff;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Google Translate Widget & Auto-translation tweaks */
.goog-te-banner-frame.skiptranslate,
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame {
    display: none !important;
}
body {
    top: 0px !important;
    position: static !important;
}
.goog-tooltip,
.goog-tooltip:hover {
    display: none !important;
}
.goog-text-highlight {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
#google_translate_element {
    display: none !important;
}
.skiptranslate:not(#google_translate_element) {
    display: none !important;
}
font[style] {
    background: transparent !important;
    box-shadow: none !important;
}

/* =========================================================================
   RESPONSIVE DESIGN & MOBILE UX BEST PRACTICES
   ========================================================================= */

/* Prevent horizontal page scrolling on mobile devices */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Tablet & Mobile (<= 900px) */
@media (max-width: 900px) {
    #view-player,
    #view-gm {
        padding: 0.75rem 0.5rem;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {
    /* Header Layout */
    /* Header Layout - Sleek single-row mobile app bar */
    .app-header {
        padding: 0.45rem 0.85rem !important;
        margin-bottom: 1rem !important;
        border-radius: 10px !important;
    }

    .header-content {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    .header-brand {
        display: flex !important;
        align-items: center !important;
        gap: 0.45rem !important;
    }

    .brand-title {
        font-size: 1.2rem !important;
        line-height: 1 !important;
    }

    .brand-badge {
        font-size: 0.62rem !important;
        padding: 2px 5px !important;
    }

    .user-info {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0.35rem !important;
        width: auto !important;
    }

    /* On mobile, hide username and redundant new campaign button from the tiny top bar */
    .user-name-tag,
    .nav-btn-new-campaign {
        display: none !important;
    }

    /* On mobile, hide text labels inside buttons so icons fit cleanly */
    .nav-btn .nav-btn-label {
        display: none !important;
    }

    .nav-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
        min-width: 34px !important;
        height: 34px !important;
        justify-content: center !important;
        border-radius: 6px !important;
    }

    /* Campaign Selector Cards */
    .campaign-selector-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-top: 1rem !important;
    }

    .campaign-card {
        padding: 1.1rem !important;
    }

    /* GM Session Header & Action Bar */
    .sheet-header.gm-session-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0.85rem !important;
        gap: 0.75rem !important;
    }

    .sheet-header.gm-session-header .sheet-title {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.6rem !important;
        flex-wrap: wrap !important;
    }

    .sheet-header.gm-session-header .sheet-title h2 {
        font-size: 1.25rem !important;
        line-height: 1.25 !important;
        word-break: break-word !important;
        margin: 0 !important;
    }

    .session-action-bar {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.45rem !important;
    }

    .session-action-bar .session-header-btn,
    .session-action-bar .session-header-pill {
        width: auto !important;
        flex: 1 1 auto !important;
        justify-content: center !important;
        padding: 0.4rem 0.75rem !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
        font-size: 0.8rem !important;
    }

    /* GM Session Player Cards Grid */
    .gm-player-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .gm-player-card {
        padding: 1rem 0.8rem !important;
        box-sizing: border-box !important;
    }

    /* Modals across all views */
    .modal-overlay {
        padding: 0.5rem !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }

    .modal-overlay .glass-panel {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.25rem 0.85rem !important;
        height: auto !important;
        max-height: 94vh !important;
        margin: 0.5rem auto !important;
        box-sizing: border-box !important;
    }

    /* Modal search grids adapt to 1 column */
    #gm-catalog-results-grid,
    #quick-guide-content,
    #npc-guide-content,
    #player-shop-items {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Character Creation Wizard */
    .wizard-container {
        padding: 1rem !important;
        height: 94vh !important;
        box-sizing: border-box !important;
    }

    .wizard-container h2 {
        font-size: 1.25rem !important;
        padding-top: 2.2rem !important; /* clears top-left back button */
    }

    .wizard-container .btn {
        width: 48% !important;
        padding: 0.5rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    /* Player Sheet Sections */
    .sheet-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1rem !important;
        gap: 0.8rem !important;
    }

    .sheet-title h2 {
        font-size: 1.5rem !important;
        text-align: center !important;
    }

    .sheet-subtitle {
        text-align: center !important;
        font-size: 0.95rem !important;
    }

    .sheet-section {
        padding: 1.2rem 0.85rem !important;
        margin-bottom: 1.2rem !important;
    }

    .attr-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }

    .attr-box {
        padding: 0.6rem 0.3rem !important;
    }

    .attr-name {
        font-size: 0.75rem !important;
    }

    .attr-val {
        font-size: 1.25rem !important;
    }

    .attr-tooltip {
        width: 220px !important;
        font-size: 0.78rem !important;
        padding: 10px !important;
    }

    .resource-row {
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
    }

    .pv-circles {
        max-width: 65% !important;
    }

    /* Floating Action Log Panel */
    #action-log-panel {
        width: calc(100% - 20px) !important;
        max-width: 100% !important;
        right: 10px !important;
        bottom: 10px !important;
        left: 10px !important;
        height: 300px !important;
    }

    /* GM Equipment Catalog Mobile Adaptations */
    .gm-catalog-filter-actions {
        flex: 1 1 100% !important;
        display: flex !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .gm-catalog-filter-actions .btn {
        flex: 1 !important;
        text-align: center !important;
        justify-content: center !important;
        font-size: 0.8rem !important;
    }
    .gm-catalog-group-actions {
        width: 100% !important;
        display: flex !important;
        gap: 6px !important;
        margin-top: 6px !important;
    }
    .gm-catalog-group-actions .btn {
        flex: 1 !important;
        text-align: center !important;
        justify-content: center !important;
        font-size: 0.72rem !important;
        padding: 0.35rem 0.5rem !important;
    }
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Very Small Phones (<= 480px) */
@media (max-width: 480px) {
    .logo-text {
        font-size: 2.2rem !important;
    }

    .subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }

    .logo-text-small {
        font-size: 1.15rem !important;
    }

    .btn {
        padding: 0.55rem 0.9rem !important;
        font-size: 0.85rem !important;
    }

    .attr-box span strong {
        font-size: 1.15rem !important;
    }
}