/* ============================================================
   GAME MODE — Spelläge Combat Interface
   All rules scoped under .game-mode-container
   ============================================================ */

/* ---- CSS Custom Properties ---- */
.game-mode-container {
    --bg-body:            #111015;
    --bg-deep:            #15141a;
    --bg-panel:           #1a191f;
    --bg-card:            #1e1d24;
    --bg-card-inner:      #161519;
    --bg-surface:         #222129;
    --gold:               #c5a44e;
    --gold-bright:        #dfc06a;
    --gold-border:        rgba(197,164,78,0.18);
    --gold-border-mid:    rgba(197,164,78,0.30);
    --gold-border-strong: rgba(197,164,78,0.55);
    --text-bright:        #ede4d3;
    --text-primary:       #d4c9b5;
    --text-secondary:     #9e927e;
    --hp:                 #a83a2a;
    --hp-bright:          #c94432;
    --wp:                 #3a6e8a;
    --green:              #4a8a4e;
    --green-bright:       #5aaa5e;

    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* ============================================================
   TOPBAR / HEADER
   ============================================================ */
.gm-topbar {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    min-height: 52px;
    margin-top: 60px;
}

.gm-breadcrumb {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gm-breadcrumb-sep {
    margin: 0 0.4em;
    color: var(--gold-border-mid);
}

.gm-title-main {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold-bright);
    letter-spacing: 0.06em;
}

.gm-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

/* ============================================================
   ENCOUNTER TABS
   ============================================================ */
.gm-encounter-tabs {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.gm-encounter-tabs::-webkit-scrollbar { display: none; }

.gm-tab {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4em;
    transition: color 0.15s, border-color 0.15s;
}
.gm-tab:hover { color: var(--text-primary); }

.gm-tab.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold);
}

.gm-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.gm-tab.active .gm-tab-dot    { background: var(--green-bright); }
.gm-tab.prepared .gm-tab-dot  { background: var(--gold); }

.gm-tab-add {
    margin-left: 0.25rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}
.gm-tab-add:hover { color: var(--gold-bright); }

/* ============================================================
   CONTROLS BAR
   ============================================================ */
.gm-controls-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.gm-round-badge {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--gold);
    background: rgba(197,164,78,0.10);
    border: 1px solid var(--gold-border-mid);
    border-radius: 4px;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
}

.gm-spacer { flex: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.gm-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    border: 1px solid var(--gold-border-mid);
    border-radius: 4px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    min-height: 36px;
}

.gm-btn-xs {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    min-height: 26px;
}

.gm-btn-primary {
    background: rgba(197, 164, 78, 0.12);
    color: var(--gold-bright);
    border: 1px solid;
    border-color: #dfa42f45;
}
.gm-btn-primary:hover {
    background: rgba(197,164,78,0.22);
    border-color: var(--gold-border-strong);
}

.gm-btn-success {
    background: rgba(74,138,78,0.15);
    color: var(--green-bright);
    border-color: rgba(74,138,78,0.35);
}
.gm-btn-success:hover {
    background: rgba(74,138,78,0.28);
    border-color: rgba(74,138,78,0.6);
}

.gm-btn-victory {
    background: rgba(197,164,78,0.2);
    color: var(--gold-bright);
    border-color: var(--gold-border-strong);
}
.gm-btn-victory:hover {
    background: rgba(197,164,78,0.35);
}

.gm-btn-gold {
    background: var(--gold);
    color: var(--bg-deep);
    border-color: var(--gold-bright);
    font-weight: 700;
}
.gm-btn-gold:hover {
    background: var(--gold-bright);
}

.gm-btn-danger {
    background: rgba(168,58,42,0.15);
    color: #e06050;
    border-color: rgba(168,58,42,0.40);
}
.gm-btn-danger:hover {
    background: rgba(168,58,42,0.28);
    border-color: rgba(168,58,42,0.65);
}

.gm-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: rgba(255,255,255,0.10);
}
.gm-btn-ghost:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.20);
}

/* ============================================================
   INITIATIVE STRIP
   ============================================================ */
.gm-initiative-strip {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    flex-shrink: 0;
    min-height: 70px;
    scrollbar-width: none;
}
.gm-initiative-strip::-webkit-scrollbar { display: none; }

.gm-strip-label {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding-right: 0.5rem;
    border-right: 1px solid var(--gold-border);
    margin-right: 0.25rem;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.gm-strip-tokens {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.gm-strip-arrow {
    color: var(--gold-border-mid);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.gm-strip-token {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    min-height: 52px;
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 6px;
    padding: 0.25rem;
    cursor: default;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.gm-strip-token.active {
    border-color: var(--gold-border-strong);
    background: rgba(197,164,78,0.08);
    box-shadow: 0 0 10px rgba(197,164,78,0.15);
    animation: gm-active-pulse 1.5s ease-in-out infinite;
}

.gm-strip-token.monster-token { border-color: rgba(168,58,42,0.35); }
.gm-strip-token.dead-token { opacity: 0.38; }

.gm-token-init-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--gold);
    color: var(--bg-deep);
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gold-bright);
    box-shadow: 0 0 8px rgba(197,164,78,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-token-initials {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-bright);
    line-height: 1;
}

.gm-token-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.gm-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

.gm-main-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-border) transparent;
}

.gm-main-area::-webkit-scrollbar { width: 5px; }
.gm-main-area::-webkit-scrollbar-thumb { background: var(--gold-border-mid); border-radius: 3px; }

/* 2-col grid: content + sidebar */
.gm-content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    flex: 1;
}

/* ============================================================
   COMBATANT SECTIONS
   ============================================================ */
.gm-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.gm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

/* ============================================================
   COMBATANT CARD
   ============================================================ */
.gm-combatant-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s;
    display: flex;
    flex-direction: column;
}

@keyframes gm-active-pulse {
    0%, 100% { box-shadow: 0 0 14px rgba(197,164,78,0.12); }
    50%       { box-shadow: 0 0 24px rgba(197,164,78,0.30); }
}

.gm-combatant-card.active {
    border-color: var(--gold-border-strong);
    box-shadow: 0 0 14px rgba(197, 164, 78, 0.12);
    border: 2px solid #d19845;
    animation: gm-active-pulse 1.5s ease-in-out infinite;
    transform: translateY(-10px);
}

.gm-combatant-card.dead {
    opacity: 0.45;
    filter: grayscale(0.6);
}

.gm-combatant-card.excluded {
    opacity: 0.4;
    filter: grayscale(0.7);
    pointer-events: auto;
}

/* Gold ornamental corners */
.gm-combatant-card::before,
.gm-combatant-card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--gold-border-mid);
    border-style: solid;
    pointer-events: none;
}
.gm-combatant-card::before {
    top: 4px; left: 4px;
    border-width: 1px 0 0 1px;
}
.gm-combatant-card::after {
    bottom: 4px; right: 4px;
    border-width: 0 1px 1px 0;
}
.gm-combatant-card.active::before,
.gm-combatant-card.active::after {
    border-color: var(--gold-border-strong);
}

.gm-card-header {
    padding: 0.6rem 0.75rem 0.4rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: var(--bg-card-inner);
    border-bottom: 1px solid var(--gold-border);
}

.gm-card-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--gold-border-mid);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.gm-card-avatar .race-icon,
.gm-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.gm-card-exclude-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 0.2rem;
    line-height: 1;
    opacity: 0.7;
    flex-shrink: 0;
    align-self: center;
}
.gm-card-exclude-btn:hover { opacity: 1; }

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

.gm-card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    font-weight: 500;
    color: #f1efe9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gm-card-meta {
   font-size: 0.65rem;
    color: #c5a44e;
    letter-spacing: 0.6px;
    margin-top: 1px;
    font-family: 'Cinzel';
}

.gm-card-body {
    padding: 0.6rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* HP / WP bars */
.gm-stat-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gm-stat-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gm-stat-label {
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.gm-stat-value {
    font-family: 'Crimson Text', serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
}

.gm-bar-wrap {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}

.gm-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.gm-bar-fill.hp { background: var(--hp-bright); }
.gm-bar-fill.hp.critical { background: #ff2222; animation: gm-critical-pulse 1s ease-in-out infinite; }
.gm-bar-fill.wp { background: var(--wp); }

.gm-stat-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.gm-stat-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--gold-border);
    border-radius: 3px;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    min-height: 24px;
}
.gm-stat-btn:hover { background: var(--bg-panel); border-color: var(--gold-border-mid); }
.gm-stat-btn.minus:hover { background: rgba(168,58,42,0.2); border-color: rgba(168,58,42,0.5); color: #e06050; }
.gm-stat-btn.plus:hover  { background: rgba(74,138,78,0.2); border-color: rgba(74,138,78,0.5); color: var(--green-bright); }

/* Stat chips */
.gm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.1rem;
}

.gm-chip {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

/* Status pills */
.gm-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.gm-pill {
    font-size: 0.62rem;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.04em;
}
.gm-pill.dead    { background: rgba(168,58,42,0.3); color: #e06050; }
.gm-pill.active  { background: rgba(74,138,78,0.25); color: var(--green-bright); }
.gm-pill.injured { background: rgba(197,164,78,0.2); color: var(--gold-bright); }

/* Card footer */
.gm-card-footer {
    padding: 0.4rem 0.75rem;
    border-top: 1px solid var(--gold-border);
    display: flex;
    gap: 0.35rem;
    background: var(--bg-card-inner);
    flex-wrap: wrap;
}

.gm-card-action {
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--gold-border);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
    min-height: 28px;
}
.gm-card-action:hover {
    color: var(--gold-bright);
    border-color: var(--gold-border-mid);
    background: rgba(197,164,78,0.08);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.gm-sidebar {
    background: var(--bg-panel);
    border-left: 1px solid var(--gold-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: -15px;
}

/* Scoreboard */
.gm-scoreboard {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gold-border);
    display: flex;
    gap: 0.5rem;
}

.gm-score-item {
    flex: 1;
    text-align: center;
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 5px;
    padding: 0.4rem;
}

.gm-score-num {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--text-bright);
    line-height: 1;
}

.gm-score-label {
    font-family: 'Cinzel', serif;
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Sidebar tabs */
.gm-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--gold-border);
}

.gm-sidebar-tab {
    flex: 1;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-align: center;
}
.gm-sidebar-tab.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold);
}
.gm-sidebar-tab:hover:not(.active) { color: var(--text-primary); }

/* Sidebar content panels */
.gm-sidebar-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-border) transparent;
}
.gm-sidebar-panel.active { display: flex; }
.gm-sidebar-panel::-webkit-scrollbar { width: 4px; }
.gm-sidebar-panel::-webkit-scrollbar-thumb { background: var(--gold-border-mid); border-radius: 2px; }

/* Combat log */
.gm-log-entry {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.5rem;
    border-left: 2px solid transparent;
    border-radius: 0 3px 3px 0;
}
.gm-log-entry.damage  { border-color: var(--hp);      color: #e8a090; }
.gm-log-entry.heal    { border-color: var(--green);    color: #90c890; }
.gm-log-entry.turn    { border-color: var(--gold);     color: var(--gold-bright); }
.gm-log-entry.round   { border-color: var(--wp);       color: #90b8d0; font-weight: 600; }
.gm-log-entry.system  { border-color: var(--text-secondary); }
.gm-log-entry.victory { border-color: var(--gold);     color: var(--gold-bright); font-weight: 600; }

.gm-log-time {
    font-size: 0.62rem;
    color: var(--text-secondary);
    opacity: 0.6;
    display: block;
    margin-top: 1px;
}

/* Quick dice roller */
.gm-dice-roller {
    padding: 0.5rem;
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 5px;
}

.gm-dice-title {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.gm-dice-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.gm-dice-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--gold-border);
    border-radius: 3px;
    color: var(--gold);
    cursor: pointer;
    transition: background 0.12s;
    min-height: 28px;
}
.gm-dice-btn:hover { background: rgba(197,164,78,0.12); }

.gm-dice-result {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--gold-bright);
    font-family: 'Crimson Text', serif;
    min-height: 1.2em;
    text-align: center;
}

/* Notes textarea */
.gm-notes-textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: 'Crimson Text', serif;
    font-size: 0.9rem;
    padding: 0.5rem;
    resize: vertical;
    box-sizing: border-box;
}
.gm-notes-textarea:focus {
    outline: none;
    border-color: var(--gold-border-mid);
}

/* ============================================================
   CONTEXT MENU
   ============================================================ */
.gm-context-menu {
    position: fixed;
    z-index: 9000;
    background: var(--bg-panel);
    border: 1px solid var(--gold-border-mid);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    min-width: 160px;
    padding: 0.3rem 0;
    display: none;
}
.gm-context-menu.open { display: block; }

.gm-context-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 0.45rem 1rem;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}
.gm-context-item:hover {
    background: rgba(197,164,78,0.1);
    color: var(--gold-bright);
}
.gm-context-item.danger:hover {
    background: rgba(168,58,42,0.15);
    color: #e06050;
}
.gm-context-sep {
    height: 1px;
    background: var(--gold-border);
    margin: 0.2rem 0;
}

/* ============================================================
   PREP MODAL (Förbered Ny Strid)
   ============================================================ */
.gm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.gm-modal {
    background: var(--bg-panel);
    border: 1px solid var(--gold-border-mid);
    border-radius: 10px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

.gm-modal-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--gold-bright);
}

.gm-form-group { margin-bottom: 0.9rem; }

.gm-form-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 0.65px;
    color: #d9b528;
    margin-bottom: 0.3rem;
}

.gm-form-input,
.gm-form-textarea {
    width: 100%;
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    padding: 0.45rem 0.65rem;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.gm-form-input:focus,
.gm-form-textarea:focus {
    outline: none;
    background: #12141a;
    border-color: var(--gold-border-mid);
}
/* Prevent iOS zoom */
@media screen and (max-width: 768px) {
    .gm-form-input,
    .gm-form-textarea,
    .gm-notes-textarea {
        font-size: 16px;
    }
}

.gm-form-textarea {
    min-height: 72px;
    resize: vertical;
}

.gm-monster-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }

.gm-monster-entry {
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 5px;
    padding: 0.6rem;
}

.gm-monster-entry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.gm-monster-entry-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    float: right;
    margin-top: -2px;
}
.gm-monster-entry-remove:hover { color: #e06050; }

.gm-modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* ============================================================
   PLAYER VIEW — Read-only combat viewer
   ============================================================ */
.gm-player-view {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Crimson Text', 'Georgia', serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* Gold screen glow when it's player's turn — Siri-style inner glow via ::after on container */
.gm-player-view.your-turn {
    animation: none;
    box-shadow: none;
}

#gameModeContainer.player-turn-active::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    box-shadow: inset 0 0 40px 15px rgba(197,164,78,0.12), inset 0 0 80px 30px rgba(197,164,78,0.06);
    animation: gm-turn-pulse 2s ease-in-out infinite;
}

@keyframes gm-turn-pulse {
    0%, 100% {
        box-shadow:
            inset 0 0 40px 10px rgba(197,164,78,0.15),
            inset 0 0 80px 25px rgba(197,164,78,0.08),
            inset 0 0 120px 40px rgba(197,164,78,0.03);
    }
    50% {
        box-shadow:
            inset 0 0 50px 15px rgba(223,192,106,0.22),
            inset 0 0 100px 35px rgba(223,192,106,0.12),
            inset 0 0 150px 50px rgba(223,192,106,0.05);
    }
}

.gm-player-header {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.gm-player-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--gold-bright);
    flex: 1;
}

/* Initiative display — large, visible from across the table */
.gm-player-initiative-display {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

.gm-player-init-num {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1;
    animation: gm-player-init-glow 2s ease-in-out infinite;
}

@keyframes gm-player-init-glow {
    0%, 100% { text-shadow: 0 0 15px rgba(197,164,78,0.3), 0 0 30px rgba(197,164,78,0.15); }
    50% { text-shadow: 0 0 30px rgba(197,164,78,0.7), 0 0 60px rgba(197,164,78,0.35), 0 0 90px rgba(197,164,78,0.15); }
}

.gm-player-init-label {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

.gm-player-init-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Player's own character highlight */
.gm-player-my-char {
    background: var(--bg-panel);
    border: 1px solid var(--gold-border-mid);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.75rem;
}

.gm-player-my-char-name {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold-bright);
    margin-bottom: 0.5rem;
}

/* ── Player Turn Bar ── */
.gm-player-turn-bar {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 36px;
}
.gm-player-turn-bar .gm-player-turn-text {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: #c6c4c0;
    letter-spacing: 0.08em;
    flex: 1;
    text-align: center;
}
.gm-player-turn-bar.my-turn .gm-player-turn-text {
    color: var(--gold-bright);
    font-weight: 700;
    font-size: 1rem;
}
.gm-player-leave-btn {
    flex-shrink: 0;
    font-size: 0.8rem !important;
    padding: 0.25rem 0.5rem !important;
}

/* ── Player Char Card (with integrated initiative) ── */
.gm-player-char-card {
    background: var(--bg-panel);
    border: 1px solid var(--gold-border-mid);
    border-radius: 8px;
    margin: 0.75rem;
    overflow: hidden;
}
.gm-player-char-top {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 0.75rem;
}
.gm-player-char-identity {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}
.gm-player-char-portrait {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}
.gm-player-char-portrait img,
.gm-player-char-portrait .race-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--gold-border-mid);
}
.gm-player-char-name-wrap {
    min-width: 0;
}
.gm-player-char-name {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gm-player-char-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.gm-player-char-init {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 0 0.25rem;
}
.gm-player-char-init-num {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1;
    animation: gm-player-init-glow 2s ease-in-out infinite;
}
.gm-player-char-init-label {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.gm-player-char-bars {
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid var(--gold-border);
}

.gm-player-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============================================================
   VICTORY SCREEN
   ============================================================ */
.gm-victory-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(15, 13, 18, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 2rem;
    border: 3px solid var(--gold);
    box-shadow: inset 0 0 60px rgba(197,164,78,0.12);
    animation: gm-victory-border 2s ease-in-out infinite;
}

@keyframes gm-victory-border {
    0%, 100% { box-shadow: inset 0 0 60px rgba(197,164,78,0.12); border-color: var(--gold); }
    50%       { box-shadow: inset 0 0 100px rgba(197,164,78,0.22); border-color: var(--gold-bright); }
}

.gm-victory-icon { font-size: 4rem; animation: gm-victory-pop 0.4s ease-out; }

@keyframes gm-victory-pop {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.gm-victory-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: var(--gold-bright);
    letter-spacing: 0.06em;
    text-shadow: 0 0 20px rgba(197,164,78,0.5);
}

.gm-victory-stats {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* Initiative round overlay — huge number */
.gm-init-overlay-number {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(5rem, 20vw, 10rem);
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1;
    animation: gm-init-number-pop 0.6s ease-out, gm-init-number-glow 2s ease-in-out infinite 0.6s;
}

@keyframes gm-init-number-pop {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes gm-init-number-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(197,164,78,0.4), 0 0 40px rgba(197,164,78,0.2); }
    50%       { text-shadow: 0 0 40px rgba(197,164,78,0.8), 0 0 80px rgba(197,164,78,0.4), 0 0 120px rgba(197,164,78,0.2); }
}

/* ============================================================
   DAMAGE FLASH (Player view — when HP is reduced by DM)
   ============================================================ */
.gm-damage-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9900;
    background: rgba(168, 58, 42, 0.45);
    animation: gm-damage-flash-anim 1.2s ease-out forwards;
}

@keyframes gm-damage-flash-anim {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.gm-damage-pulse {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9899;
    animation: gm-damage-pulse-anim 0.8s ease-out forwards;
}

@keyframes gm-damage-pulse-anim {
    0%   {
        box-shadow:
            inset 0 0 100px 40px rgba(255, 30, 30, 0.7),
            inset 0 0 200px 80px rgba(200, 30, 30, 0.4),
            inset 0 0 300px 120px rgba(168, 42, 42, 0.2);
        opacity: 1;
    }
    100% {
        box-shadow: inset 0 0 0px 0px rgba(168, 42, 42, 0);
        opacity: 0;
    }
}

.gm-damage-text {
    position: fixed;
    pointer-events: none;
    z-index: 9901;
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 2rem;
    color: #ff4040;
    text-shadow: 0 0 10px rgba(255,64,64,0.7);
    animation: gm-float-up 1.5s ease-out forwards;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
}

@keyframes gm-float-up {
    0%   { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-80px); opacity: 0; }
}

@keyframes gm-screen-shake {
    0%, 100% { transform: translate(0, 0); }
    20%       { transform: translate(-4px, 2px); }
    40%       { transform: translate(4px, -2px); }
    60%       { transform: translate(-3px, 3px); }
    80%       { transform: translate(3px, -1px); }
}

.gm-shaking { animation: gm-screen-shake 0.35s ease-in-out; }

@keyframes gm-critical-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ============================================================
   TABLET (769px – 1024px)
   ============================================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .gm-content-grid {
        grid-template-columns: 1fr 280px;
    }

    .gm-btn {
        font-size: 0.73rem;
        padding: 0.35rem 0.7rem;
    }

    .gm-topbar, .gm-controls-bar {
        padding: 0.4rem 1rem;
    }
}

/* ============================================================
   MOBILE FAB BAR (≤768px)
   ============================================================ */
.gm-fab-bar {
    display: none;
}

@media screen and (max-width: 768px) {
    .game-mode-container {
        font-size: 15px;
        position: absolute;
        z-index: 2000;
    }

   .gm-player-char-init-label {
        font-family: 'Cinzel', serif;
        font-size: 0.6rem;
        color: var(--text-secondary);
        letter-spacing: 0.15em;
        text-transform: uppercase;
        rotate: -90deg;
        position: absolute;
        right: -9px;
        margin-top: 14px;
   }

   .gm-player-char-init-num {
        font-family: 'Cinzel Decorative', 'Cinzel', serif;
        font-size: 4rem;
        font-weight: 900;
        margin-top: -18px;
        color: var(--gold-bright);
        line-height: 1;
        animation: gm-player-init-glow 2s ease-in-out infinite;
   }

   .gm-player-turn-bar {
       background: var(--bg-deep);
       border-bottom: 1px solid var(--gold-border);
       padding: 0.5rem 1rem;
       display: flex;
       align-items: center;
       justify-content: center;
       flex-shrink: 0;
       min-height: 30px;
       height: 40px;
   }

   .gm-strip-token {
       position: relative;
       display: flex;
       flex-direction: column;
       align-items: center;
       justify-content: center;
       width: 50px;
       min-height: 52px;
       background: var(--bg-card);
       border: 1px solid var(--gold-border);
       border-radius: 6px;
       padding: 0.25rem;
       cursor: default;
       flex-shrink: 0;
       transition: border-color 0.15s;
   }

    .gm-fab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1100;
        background: var(--bg-deep);
        border-top: 1px solid var(--gold-border);
        height: 56px;
        align-items: stretch;
    }

    .gm-fab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: var(--text-secondary);
        background: none;
        border: none;
        cursor: pointer;
        gap: 2px;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }
    .gm-fab-btn:hover, .gm-fab-btn.active { color: var(--gold-bright); }

    .gm-fab-label {
        font-family: 'Cinzel', serif;
        font-size: 0.55rem;
        letter-spacing: 0.04em;
    }

    /* Bottom sheet */
    .gm-bottom-sheet {
        position: fixed;
        bottom: 56px;
        left: 0;
        right: 0;
        z-index: 1050;
        background: var(--bg-panel);
        border-top: 1px solid var(--gold-border-mid);
        border-radius: 12px 12px 0 0;
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    }
    .gm-bottom-sheet.open { transform: translateY(0); }

    .gm-bottom-sheet-handle {
        width: 36px;
        height: 4px;
        background: var(--gold-border-mid);
        border-radius: 2px;
        margin: 0 auto 0.75rem;
    }

    /* On mobile hide the sidebar */
    .gm-sidebar { display: none; }

    /* Single column */
    .gm-content-grid {
        grid-template-columns: 1fr;
    }

    /* Controls bar padding for FAB */
    .gm-body { padding-bottom: 56px; }

    /* Encounter tabs scrollable */
    .gm-encounter-tabs { padding: 0 0.5rem; }

    /* Controls bar wrap */
    .gm-controls-bar { flex-wrap: wrap; padding: 0.4rem 0.75rem; }

    /* Stat buttons always visible */
    .gm-stat-controls { display: flex !important; }

    /* Touch targets */
    .gm-stat-btn,
    .gm-card-action,
    .gm-btn,
    .gm-tab,
    .gm-dice-btn {
        min-height: 40px;
    }

    /* No context menu */
    .gm-context-menu { display: none !important; }

    /* Strip horizontal scroll */
    .gm-initiative-strip { padding: 0.4rem 0.75rem; margin-left: -10px; margin-right: -10px; }

    /* Cards single column */
    .gm-cards-grid { grid-template-columns: 1fr; }

}

/* ============================================================
   DICE MODAL (rollDiceFAB)
   ============================================================ */
.gm-dice-modal .gm-dice-pick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0;
}

.gm-dice-pick-btn {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    color: var(--gold);
    border: 1px solid var(--gold-border-mid);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    min-width: 56px;
}

.gm-dice-pick-btn:hover {
    background: var(--bg-surface);
    color: var(--gold-bright);
    border-color: var(--gold-border-strong);
}

.gm-dice-fab-result {
    text-align: center;
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold-bright);
    min-height: 3.5rem;
    margin: 0.5rem 0;
}

@keyframes gmDiceRoll {
    0%   { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1);   opacity: 1;   }
}

.gm-dice-fab-result.gm-dice-fab-animate {
    animation: gmDiceRoll 0.3s ease-out forwards;
}

/* ============================================================
   NOTIFICATION CENTER — raise above game mode container
   ============================================================ */
.notification-center {
    z-index: 2000;
}

/* ============================================================
   BROADCAST OVERLAY
   ============================================================ */
@keyframes gm-broadcast-in {
    0%   { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes gm-broadcast-out {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.04); }
}

.gm-broadcast-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gm-broadcast-in 0.5s ease;
}

.gm-broadcast-text {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold-bright);
    text-align: center;
    padding: 2rem;
    max-width: 80%;
    text-shadow: 0 0 20px rgba(197,164,78,0.5);
}

/* ============================================================
   DICE ROLL OVERLAY
   ============================================================ */
.gm-dice-overlay {
    position: fixed;
    inset: 0;
    z-index: 9950;
    background: rgba(10, 12, 18, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: gm-broadcast-in 0.3s ease-out;
    pointer-events: none;
}

.gm-dice-overlay-type {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
}

.gm-dice-overlay-result {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(5rem, 25vw, 12rem);
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1;
    animation: gm-init-number-pop 0.5s ease-out;
    text-shadow: 0 0 30px rgba(197,164,78,0.6), 0 0 60px rgba(197,164,78,0.3);
}

/* ============================================================
   CUSTOM DAMAGE / HEAL MODAL
   ============================================================ */
.gm-custom-damage-modal {
    max-width: 320px;
}

.gm-custom-damage-input {
    font-size: 1.5rem;
    text-align: center;
    padding: 0.5rem;
    width: 100%;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

/* ============================================================
   CHARACTER SHEET MODAL
   ============================================================ */
.gm-charsheet-modal {
    max-height: 80vh;
    overflow-y: auto;
}

.gm-charsheet-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.gm-charsheet-portrait {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--gold-border-mid);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
}
.gm-charsheet-portrait img,
.gm-charsheet-portrait .race-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.gm-charsheet-identity {
    flex: 1;
    min-width: 0;
}

.gm-charsheet-name {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.15rem;
    color: var(--gold-bright);
    letter-spacing: 0.04em;
}

.gm-charsheet-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.gm-charsheet-attributes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gm-charsheet-attr {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg-card-inner);
    border-radius: 6px;
    border: 1px solid var(--gold-border);
}

.gm-charsheet-attr-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.gm-charsheet-attr-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-bright);
}

.gm-charsheet-vitals {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.gm-charsheet-vital {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.gm-charsheet-vital-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    margin-right: 0.3rem;
}

.gm-charsheet-section {
    margin-bottom: 0.75rem;
}

.gm-charsheet-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.gm-charsheet-weapon-list {
    margin: 0;
    padding-left: 1.2rem;
    list-style: disc;
}

.gm-charsheet-weapon {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.15rem 0;
}

.gm-charsheet-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

/* ============================================================
   XP (EP) BADGE — shown on character cards in the Grupp page
   ============================================================ */
.gm-xp-badge {
    display: inline-block;
    margin-top: 0.25rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    color: var(--bg-deep);
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    box-shadow: 0 0 6px rgba(197,164,78,0.5);
}

/* ============================================================
   AWARD XP MODAL
   ============================================================ */
.gm-award-xp-modal {
    max-width: 480px;
}

.gm-award-xp-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.gm-award-xp-row {
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gm-award-xp-name {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--text-bright);
    font-weight: 600;
}

.gm-award-xp-current {
    font-size: 0.8rem;
    color: var(--gold);
}

.gm-award-xp-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.gm-xp-input {
    width: 70px;
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 4px;
    color: var(--text-bright);
    font-size: 0.85rem;
    padding: 0.25rem 0.4rem;
}

.gm-victory-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* ============================================================
   PHASE BADGE
   ============================================================ */
.gm-phase-badge {
    display: inline-block;
    background: var(--bg-surface);
    border: 1px solid var(--gold-border);
    border-radius: 20px;
    padding: 0.15rem 0.65rem;
    font-size: 0.7rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    margin-left: 0.75rem;
    vertical-align: middle;
}

/* ============================================================
   PHASE TRANSITION ANIMATIONS
   ============================================================ */
.gm-phase-exit {
    animation: gm-phase-exit 0.3s ease-in forwards;
}
@keyframes gm-phase-exit {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.98); }
}

.gm-phase-enter {
    animation: gm-phase-enter 0.5s ease-out forwards;
}
@keyframes gm-phase-enter {
    0%   { opacity: 0; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

.gm-phase-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9950;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: gm-phase-transition-in 0.3s ease-out forwards;
}
@keyframes gm-phase-transition-in {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

.gm-phase-transition-content {
    text-align: center;
    padding: 2rem 3rem;
    border-radius: 12px;
    border: 2px solid;
}

.gm-phase-combat {
    background: rgba(168, 58, 42, 0.85);
    border-color: #c94432;
    color: #ffe8e8;
}

.gm-phase-explore {
    background: rgba(197, 164, 78, 0.85);
    border-color: var(--gold-bright);
    color: #1a1608;
}

.gm-phase-rest {
    background: rgba(58, 110, 138, 0.85);
    border-color: #4a8aaa;
    color: #e8f4ff;
}

.gm-phase-transition-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.gm-phase-transition-text {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

/* ============================================================
   EXPLORE CONTROLS BAR
   ============================================================ */
.gm-explore-controls {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.gm-explore-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.gm-explore-label {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.gm-time-select,
.gm-location-input,
.gm-activity-select {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 16px;
    padding: 0.35rem 0.6rem;
    min-height: 40px;
    font-family: 'Crimson Text', 'Georgia', serif;
}

.gm-time-select:focus,
.gm-location-input:focus,
.gm-activity-select:focus {
    outline: none;
    border-color: var(--gold-border-mid);
}

.gm-location-input {
    min-width: 140px;
}

.gm-explore-control-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ============================================================
   EXPLORE EMPTY STATE
   ============================================================ */
.gm-explore-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.gm-explore-empty-icon {
    font-size: 3rem;
}

.gm-explore-empty-text {
    font-size: 0.95rem;
    max-width: 280px;
}

/* ============================================================
   EXPLORE LOCATION CARD (Player view)
   ============================================================ */
.gm-explore-location-card {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    margin: 0.75rem;
    padding: 1rem 1.25rem;
    text-align: center;
}

.gm-explore-time {
    font-size: 1.1rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    margin-bottom: 0.25rem;
}

.gm-explore-location-name {
    font-size: 1.3rem;
    color: var(--text-bright);
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    margin-bottom: 0.25rem;
}

.gm-explore-activity-badge {
    display: inline-block;
    background: var(--bg-surface);
    border: 1px solid var(--gold-border);
    border-radius: 20px;
    padding: 0.2rem 0.8rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================================
   REST VIEW
   ============================================================ */
.gm-rest-controls {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--gold-border);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.gm-rest-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.gm-rest-player-card {
    background: var(--bg-card);
    border: 1px solid rgba(58, 110, 138, 0.35);
    border-radius: 10px;
    margin: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.gm-rest-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.gm-rest-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

/* ============================================================
   ADVENTURE TOC (Places sidebar)
   ============================================================ */
.gm-toc-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.gm-toc-place {
    padding: 0.5rem 0.75rem;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--gold-border);
    transition: background 0.15s;
}

.gm-toc-place:hover {
    background: var(--bg-surface);
}

.gm-toc-scene {
    padding: 0.35rem 1.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.gm-toc-scene:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.gm-toc-scene.active {
    color: var(--gold-bright);
    background: rgba(197, 164, 78, 0.08);
}

/* ============================================================
   SCENE VIEWER
   ============================================================ */
.gm-scene-viewer {
    padding: 0.5rem;
}

.gm-scene-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gold-border);
}

.gm-scene-place-name {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.gm-scene-name {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--gold-bright);
}

.gm-scene-image {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.gm-scene-description {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
}

.gm-scene-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    margin: 0.75rem 0 0.4rem;
}

.gm-scene-entities {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.gm-scene-entity-card {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 5px;
    padding: 0.4rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gm-scene-entity-name {
    color: var(--text-bright);
    font-size: 0.85rem;
}

.gm-scene-entity-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}

/* ============================================================
   RANDOM EVENT MODAL
   ============================================================ */
.gm-random-event-result {
    background: var(--bg-card-inner);
    border: 1px solid var(--gold-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    min-height: 48px;
}

.gm-random-event-roll {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 0.25rem;
}

.gm-random-event-text {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* ============================================================
   AWARD SKILL MODAL
   ============================================================ */
.gm-award-skill-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gold-border);
}

.gm-award-skill-name {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--gold-bright);
    margin-bottom: 0.4rem;
}

.gm-award-skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.gm-award-skill-btn {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    min-height: 32px;
}

/* ============================================================
   SKILL AWARD OVERLAY (Player achievement)
   ============================================================ */
.gm-skill-award-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9950;
    background: rgba(197, 164, 78, 0.95);
    border: 2px solid var(--gold-bright);
    border-radius: 14px;
    padding: 2rem 2.5rem;
    text-align: center;
    color: #1a1608;
    animation: gm-skill-award-in 0.4s ease-out forwards;
    box-shadow: 0 0 60px 20px rgba(197, 164, 78, 0.3);
}

@keyframes gm-skill-award-in {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.gm-skill-award-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.gm-skill-award-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.gm-skill-award-text {
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================================
   MOBILE RESPONSIVE — Explore controls
   ============================================================ */
@media screen and (max-width: 768px) {
    .gm-explore-controls {
        gap: 0.5rem;
    }

    .gm-explore-control-actions {
        margin-left: 0;
        width: 100%;
    }

    .gm-location-input {
        min-width: 100px;
    }
}

/* ============================================================
   TIME OF DAY — Ambient visual themes
   ============================================================ */

/* Morgon (Morning) — warm golden dawn tones */
.game-mode-container.time-morgon {
    --bg-body: #131010;
    --bg-deep: #1a1512;
    --bg-panel: #1f1a15;
    --bg-card: #241e18;
    --bg-card-inner: #1a1510;
    --bg-surface: #28221a;
}
.game-mode-container.time-morgon .gm-topbar,
.game-mode-container.time-morgon .gm-explore-controls,
.game-mode-container.time-morgon .gm-player-header {
    border-bottom-color: rgba(210, 160, 60, 0.22);
}

/* Förmiddag (Late morning) — slightly brighter, clear gold */
.game-mode-container.time-formiddag {
    --bg-body: #121110;
    --bg-deep: #18160f;
    --bg-panel: #1d1b14;
    --bg-card: #222018;
    --bg-card-inner: #17150e;
    --bg-surface: #26241b;
}

/* Middag (Noon) — brightest, warm light */
.game-mode-container.time-middag {
    --bg-body: #141210;
    --bg-deep: #1b1810;
    --bg-panel: #201d15;
    --bg-card: #262219;
    --bg-card-inner: #1a1710;
    --bg-surface: #2a261c;
    --gold-bright: #e8cc78;
    --gold: #d4b058;
}

/* Eftermiddag (Afternoon) — amber/orange warmth fading */
.game-mode-container.time-eftermiddag {
    --bg-body: #121012;
    --bg-deep: #191418;
    --bg-panel: #1d181c;
    --bg-card: #221c20;
    --bg-card-inner: #171218;
    --bg-surface: #261f24;
    --gold: #c9985a;
    --gold-bright: #dbb06c;
}

/* Kväll (Evening) — deep blue-purple dusk */
.game-mode-container.time-kvall {
    --bg-body: #0d0e14;
    --bg-deep: #111320;
    --bg-panel: #141625;
    --bg-card: #18192a;
    --bg-card-inner: #0f1020;
    --bg-surface: #1c1d2e;
    --gold: #9a8a5e;
    --gold-bright: #b8a872;
    --gold-border: rgba(154, 138, 94, 0.18);
    --gold-border-mid: rgba(154, 138, 94, 0.28);
    --text-primary: #bfb8ad;
    --text-secondary: #7e7668;
}

/* Natt (Night) — dark blue/indigo, moonlit feel */
.game-mode-container.time-natt {
    --bg-body: #090a12;
    --bg-deep: #0d0e18;
    --bg-panel: #10111d;
    --bg-card: #141522;
    --bg-card-inner: #0b0c16;
    --bg-surface: #181928;
    --gold: #7a8aaa;
    --gold-bright: #94a8c8;
    --gold-border: rgba(122, 138, 170, 0.15);
    --gold-border-mid: rgba(122, 138, 170, 0.25);
    --gold-border-strong: rgba(122, 138, 170, 0.45);
    --text-bright: #c8d0e0;
    --text-primary: #a8b0c0;
    --text-secondary: #6a7080;
    --hp: #8a3a3a;
    --wp: #3a5a7a;
}

/* ============================================================
   INITIATIVE DRAMATIC ENTRANCE
   ============================================================ */
@keyframes gm-initiative-reveal {
    0%   { transform: scale(0.3); opacity: 0; filter: blur(10px); }
    60%  { transform: scale(1.1); opacity: 1; filter: blur(0); }
    100% { transform: scale(1); }
}

.gm-initiative-dramatic {
    animation: gm-initiative-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    font-size: 1.1em;
    text-shadow: 0 0 20px rgba(197,164,78,0.6), 0 0 40px rgba(197,164,78,0.3);
}

/* ============================================================
   DAMAGE SLASH EFFECT
   ============================================================ */
.gm-damage-slash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9902;
    overflow: hidden;
}

.gm-damage-slash::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, transparent 20%, rgba(255,60,60,0.9) 50%, transparent 80%, transparent 100%);
    transform: rotate(-45deg);
    transform-origin: center;
    animation: gm-slash-swipe 0.4s ease-out forwards;
    box-shadow: 0 0 20px 8px rgba(255,40,40,0.5), 0 0 60px 20px rgba(255,40,40,0.2);
}

@keyframes gm-slash-swipe {
    0%   { transform: rotate(-45deg) translateX(-100%); opacity: 1; }
    70%  { transform: rotate(-45deg) translateX(50%);  opacity: 1; }
    100% { transform: rotate(-45deg) translateX(100%); opacity: 0; }
}

.gm-damage-red-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9898;
    box-shadow:
        inset 0 0 60px 20px rgba(255,40,40,0.25),
        inset 0 0 120px 40px rgba(200,30,30,0.15);
    animation: gm-damage-glow-fade 1.2s ease-out forwards;
}

@keyframes gm-damage-glow-fade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}
