/**
 * /assets/css/gm.css
 *
 * Purpose:  Game Master Mode Styles – Grid, Initiative, EXP, Log, Referenz, Standort
 *           Glassmorphism Design System, responsive Grid-Layout
 * Deps:     app.css (variables: --accent, --danger, --gold, --exp)
 * Load:     index.php
 * Version:  6.0.0 – GM-Dashboard: Statistik-Badges, Gruppen-HP-Balken, World-Cards
 * Version:  5.0.0 – Item-Vergabe: gm-item-type-btn Filter-Buttons
 */

/* ============================================================================
 * GM Dashboard (Selection Page)
 * ============================================================================ */

.gm-dash-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(6px);
    font-size: .8rem;
}

.gm-dash-stat__val {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.gm-dash-stat__lbl {
    color: rgba(255, 255, 255, 0.5);
    font-size: .72rem;
}

.gm-dash-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-size: .7rem;
    color: rgba(255, 255, 255, 0.55);
    cursor: default;
}

.gm-dash-badge i {
    font-size: .6rem;
    opacity: .7;
}

.gm-dash-world {
    transition: border-color .2s, box-shadow .2s;
}

.gm-dash-world:hover {
    border-color: rgba(255, 211, 107, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Group row */
.gm-dash-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    transition: background .15s, border-color .15s;
}

.gm-dash-group:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.gm-dash-group__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-dash-group__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Health bar */
.gm-dash-group__health {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    min-width: 70px;
}

.gm-dash-group__hp-bar {
    width: 70px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.gm-dash-group__hp-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}

/* Status indicators */
.gm-dash-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: .55rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.gm-dash-status--warn {
    background: rgba(255, 193, 7, 0.6);
}

.gm-dash-status--dead {
    background: rgba(255, 107, 107, 0.6);
}

@media (max-width: 576px) {
    .gm-dash-group__health {
        min-width: 55px;
    }
    .gm-dash-group__hp-bar {
        width: 55px;
    }
}

/* ============================================================================
 * GM Header
 * ============================================================================ */

.gm-header {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(255, 211, 107, 0.4);
    border-radius: 14px;
    backdrop-filter: blur(12px) saturate(1.3);
}

/* ============================================================================
 * Character Grid
 * ============================================================================ */

.gm-grid {
    display: grid;
    gap: 12px;
}

@media (min-width: 768px) {
    .gm-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .gm-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gm-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    padding: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gm-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Faded cards (unconscious, dead, banned) */
.gm-card--faded {
    opacity: 0.55;
}

.gm-card--faded:hover {
    opacity: 0.8;
}

/* ============================================================================
 * Group Sections (Status-Gruppen)
 * ============================================================================ */

.gm-group-section {
    /* no extra styles needed for active section */
}

.gm-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    user-select: none;
}

.gm-group-section--collapsed .gm-group-header {
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.gm-group-section--collapsed .gm-group-header:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.18);
}

.gm-group-chevron {
    margin-left: auto;
    font-size: 0.65rem;
    opacity: 0.4;
    transition: transform 0.25s ease;
}

.gm-group-header[aria-expanded="true"] .gm-group-chevron {
    transform: rotate(180deg);
}

/* Card Header (Bild + Info) */
.gm-card-header {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.gm-card-avatar {
    width: 56px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.gm-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-card-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.4rem;
}

.gm-card-info {
    flex: 1;
    min-width: 0;
}

.gm-card-name {
    font-size: 0.95rem;
    line-height: 1.3;
}

.gm-card-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.gm-card-actions {
    flex-shrink: 0;
}

/* Quick Stats Row */
.gm-stats-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.gm-stat {
    flex: 1;
    text-align: center;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 0.7rem;
    line-height: 1.3;
}

.gm-stat i {
    display: block;
    font-size: 0.65rem;
    opacity: 0.5;
    margin-bottom: 2px;
}

.gm-stat span {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
}

.gm-stat small {
    display: block;
    opacity: 0.5;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Conditions */
.gm-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    min-height: 24px;
}

.gm-condition-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.65rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid color-mix(in srgb, var(--cond-color, #fff) 40%, transparent);
    color: var(--cond-color, #fff);
}

.gm-condition-badge i {
    font-size: 0.6rem;
}

.gm-condition-remove {
    background: none;
    border: none;
    color: inherit;
    padding: 0 0 0 2px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.5;
    line-height: 1;
}

.gm-condition-remove:hover {
    opacity: 1;
}

.gm-condition-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.6rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.gm-condition-add:hover {
    border-color: rgba(93, 214, 201, 0.5);
    color: var(--accent, #5dd6c9);
}

/* HP/Mana Pools */
.gm-pool {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gm-pool-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.gm-pool-value {
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.gm-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.gm-bar > div {
    height: 100%;
    transition: width 0.3s ease;
}

.gm-bar--sm {
    height: 6px;
}

.gm-bar--exp {
    background: rgba(77, 163, 255, 0.1);
}

.gm-bar-fill--exp {
    height: 100%;
    background: var(--exp, #4da3ff);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.gm-pool-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.gm-pool-btns form {
    margin: 0;
}

/* Pool Buttons */
.gm-btn-damage {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.gm-btn-damage:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.5);
}

.gm-btn-heal {
    background: rgba(77, 200, 100, 0.1);
    border: 1px solid rgba(77, 200, 100, 0.3);
    color: #4dc864;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.gm-btn-heal:hover {
    background: rgba(77, 200, 100, 0.2);
    color: #4dc864;
    border-color: rgba(77, 200, 100, 0.5);
}

.gm-btn-mana-down {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.gm-btn-mana-down:hover {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.5);
}

.gm-btn-mana-up {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.gm-btn-mana-up:hover {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.5);
}

/* Bulk Actions */
.gm-bulk-bar {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

/* ============================================================================
 * Initiative Tracker
 * ============================================================================ */

.gm-initiative-panel {
    max-width: 800px;
}

.gm-round-counter {
    padding: 6px 14px;
    background: rgba(255, 211, 107, 0.1);
    border: 1px solid rgba(255, 211, 107, 0.25);
    border-radius: 999px;
    color: var(--gold, #ffd36b);
    font-size: 0.85rem;
}

.gm-init-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gm-init-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    transition: all 0.2s;
}

.gm-init-entry--active {
    background: rgba(93, 214, 201, 0.08);
    border-color: rgba(93, 214, 201, 0.3);
    box-shadow: 0 0 15px rgba(93, 214, 201, 0.1);
}

.gm-init-entry--dead {
    opacity: 0.4;
    text-decoration: line-through;
}

.gm-init-entry--npc {
    border-left: 3px solid rgba(255, 107, 107, 0.4);
}

.gm-init-entry--hero {
    border-left: 3px solid rgba(93, 214, 201, 0.4);
}

.gm-init-order {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.gm-init-roll {
    width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gold, #ffd36b);
    flex-shrink: 0;
}

.gm-init-info {
    flex: 1;
    min-width: 0;
}

.gm-init-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.gm-init-hp {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.gm-init-hp .gm-bar {
    flex: 1;
    max-width: 100px;
}

.gm-init-hp-text {
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
}

.gm-init-active-marker {
    color: var(--accent, #5dd6c9);
    font-size: 1.2rem;
    animation: gm-pulse 1.5s ease infinite;
}

@keyframes gm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
    .gm-init-active-marker {
        animation: none;
    }
}

.gm-init-npc-btns {
    display: flex;
    gap: 3px;
}

.gm-init-npc-btns form {
    margin: 0;
}

/* Initiative Preview (vor Kampfstart) */
.gm-init-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gm-init-preview-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ============================================================================
 * EXP Panel
 * ============================================================================ */

.gm-exp-panel {
    max-width: 800px;
}

.gm-exp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gm-exp-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.gm-exp-info {
    flex: 1;
    min-width: 0;
}

.gm-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.gm-title-row:last-child {
    border-bottom: none;
}

/* ============================================================================
 * Combat Log
 * ============================================================================ */

.gm-log-panel {
    max-width: 800px;
}

.gm-log-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.gm-log-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    font-size: 0.8rem;
}

.gm-log-entry--manual {
    border-left: 2px solid rgba(93, 214, 201, 0.4);
}

.gm-log-entry--combat {
    border-left: 2px solid rgba(255, 107, 107, 0.4);
}

.gm-log-entry--rest {
    border-left: 2px solid rgba(77, 200, 100, 0.4);
}

.gm-log-entry--exp {
    border-left: 2px solid rgba(255, 211, 107, 0.4);
}

.gm-log-entry--status {
    border-left: 2px solid rgba(160, 120, 255, 0.4);
}

.gm-log-entry--init {
    border-left: 2px solid rgba(96, 165, 250, 0.4);
}

.gm-log-icon {
    width: 20px;
    text-align: center;
    opacity: 0.5;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.gm-log-text {
    flex: 1;
    min-width: 0;
}

.gm-log-time {
    font-size: 0.65rem;
    opacity: 0.4;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ============================================================================
 * Reference Panel (Weltwissen)
 * ============================================================================ */

.gm-reference-panel {
    max-width: 900px;
}

.gm-reference-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.gm-ref-section {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px;
}

.gm-ref-toggle {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.gm-ref-toggle::-webkit-details-marker {
    display: none;
}

.gm-ref-toggle::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.6rem;
    opacity: 0.4;
    margin-left: auto;
    transition: transform 0.2s;
}

details[open] > .gm-ref-toggle::after {
    transform: rotate(180deg);
}

.gm-ref-grid {
    display: grid;
    gap: 8px;
}

@media (min-width: 768px) {
    .gm-ref-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gm-ref-card {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.8rem;
}

/* Bestiary monster thumbnail */
.gm-beast-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.gm-beast-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.gm-beast-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-size: 1.1rem;
}

/* Monster Detail Modal — Large 2:3 Image */
.gm-detail-image-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 1rem 1rem 0 0;
}

.gm-detail-img {
    width: 100%;
    aspect-ratio: 2 / 3;
    max-height: 380px;
    object-fit: cover;
    object-position: center 20%;
    display: block;
    animation: detailKenBurns 20s ease-in-out infinite alternate;
}

.gm-detail-image-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    background: linear-gradient(to top, rgba(20,20,35,0.95), transparent);
    pointer-events: none;
}

/* Monster Detail Modal — Tags */
.gm-detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}

/* Monster Detail Modal — Section Headers */
.gm-detail-section {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.4);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.gmw-skill-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: color-mix(in srgb, var(--stat-color, #fff) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--stat-color, #fff) 25%, transparent);
    color: var(--stat-color, #fff);
}

.gm-rep-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid color-mix(in srgb, var(--rep-color, #fff) 30%, transparent);
    color: var(--rep-color, #fff);
}

.gm-rep-badge small {
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

/* ============================================================================
 * Shared Sections
 * ============================================================================ */

.gm-section {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
}

.gm-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.gm-section-header i {
    opacity: 0.6;
}

/* ============================================================================
 * Responsive — Touch-friendly buttons for mobile/tablet GM use
 * ============================================================================ */

/* Tablet (≤992px): enlarge all interactive elements */
@media (max-width: 992px) {
    /* GM Header — back button */
    .gm-header .btn {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-height: 42px;
    }

    /* Pool buttons (HP/Mana ±) — larger touch targets */
    .gm-pool-btns {
        gap: 5px;
    }

    .gm-pool-btns .btn,
    .gm-btn-damage,
    .gm-btn-heal,
    .gm-btn-mana-down,
    .gm-btn-mana-up {
        padding: 6px 12px;
        font-size: 0.85rem;
        min-height: 40px;
        min-width: 44px;
        border-radius: 8px;
    }

    /* Card action buttons (edit/view character) */
    .gm-card-actions .btn {
        padding: 6px 10px;
        font-size: 0.9rem;
        min-width: 42px;
        min-height: 42px;
    }

    /* Condition add button */
    .gm-condition-add {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    /* Condition remove button */
    .gm-condition-remove {
        font-size: 1rem;
        padding: 2px 4px;
    }

    /* Condition badge — larger for touch */
    .gm-condition-badge {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    /* Bulk action bar buttons */
    .gm-bulk-bar .btn {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* Initiative NPC HP buttons */
    .gm-init-npc-btns {
        gap: 4px;
    }

    .gm-init-npc-btns .btn {
        padding: 6px 10px;
        font-size: 0.85rem;
        min-width: 40px;
        min-height: 40px;
    }

    /* Initiative control buttons (start, next, end) */
    .gm-initiative-panel .btn {
        padding: 8px 16px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    /* Initiative entry remove button */
    .gm-init-entry .btn-outline-secondary {
        min-width: 40px;
        min-height: 40px;
    }

    /* Spawn buttons (Monster Quick-Select) */
    .gm-spawn-btn {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    .gm-spawn-btn-name {
        font-size: 0.8rem;
    }

    /* GM section buttons (EXP, titles, log, reference, bestiary) */
    .gm-section .btn,
    .gm-ref-section .btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        min-height: 40px;
        min-width: 40px;
    }

    /* Full-width action buttons (Event starten, Quest zuweisen) */
    .gm-event-start-bar .btn,
    .gm-quest-spawner .btn {
        padding: 10px 16px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Location edit button */
    .gm-location-edit {
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    /* Region map toggle button */
    .gm-ref-region .btn {
        min-width: 40px;
        min-height: 40px;
    }
}

/* Mobile (≤576px): even larger for one-hand use */
@media (max-width: 576px) {
    /* GM Header — back button larger on phone */
    .gm-header .btn {
        padding: 10px 16px;
        font-size: 0.95rem;
        min-height: 46px;
    }

    .gm-card-avatar {
        width: 44px;
        height: 56px;
    }

    .gm-stats-row {
        gap: 4px;
    }

    /* Pool buttons — full width row, equal sizing */
    .gm-pool-btns {
        gap: 4px;
    }

    .gm-pool-btns .btn,
    .gm-btn-damage,
    .gm-btn-heal,
    .gm-btn-mana-down,
    .gm-btn-mana-up {
        padding: 8px 10px;
        font-size: 0.9rem;
        min-height: 44px;
        flex: 1;
    }

    /* Card action buttons */
    .gm-card-actions .btn {
        padding: 8px 12px;
        font-size: 1rem;
        min-width: 46px;
        min-height: 46px;
    }

    /* Bulk action bar — stack vertically */
    .gm-bulk-bar {
        flex-direction: column;
    }

    .gm-bulk-bar .btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 0.95rem;
        min-height: 48px;
    }

    /* Initiative control buttons */
    .gm-initiative-panel > .d-flex > form > .btn,
    .gm-initiative-panel > .d-flex > .btn {
        padding: 10px 18px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Initiative NPC HP buttons */
    .gm-init-npc-btns .btn {
        padding: 8px 10px;
        font-size: 0.9rem;
        min-width: 44px;
        min-height: 44px;
    }

    /* Full-width action buttons */
    .gm-event-start-bar .btn,
    .gm-quest-spawner .btn {
        padding: 12px 16px;
        font-size: 1.05rem;
        min-height: 52px;
    }

    /* GM section buttons — ensure touch-friendly in small screens */
    .gm-section .btn,
    .gm-ref-section .btn {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-height: 44px;
        min-width: 44px;
    }

    /* Condition add button */
    .gm-condition-add {
        width: 40px;
        height: 40px;
        font-size: 0.85rem;
    }

    /* Location edit button */
    .gm-location-edit {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    /* Spawn buttons */
    .gm-spawn-btn {
        padding: 14px 10px;
        font-size: 0.9rem;
    }

    .gm-spawn-btn-icon {
        font-size: 1.3rem;
    }

    .gm-spawn-btn-name {
        font-size: 0.82rem;
    }
}

/* ============================================================================
 * Character Location
 * ============================================================================ */

.gm-location {
    padding: 4px 10px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.gm-location-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.gm-location-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gm-location-edit {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.gm-location-edit:hover {
    color: var(--accent, #5dd6c9);
    background: rgba(93, 214, 201, 0.1);
}

.gm-location-form {
    padding: 6px 0 2px;
}

.gm-location-select {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
}

.gm-location-select:focus {
    border-color: var(--accent, #5dd6c9);
    box-shadow: 0 0 0 0.15rem rgba(93, 214, 201, 0.15);
}

.gm-location-custom-wrap input {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
}

.gm-location-custom-wrap input:focus {
    border-color: var(--accent, #5dd6c9);
    box-shadow: 0 0 0 0.15rem rgba(93, 214, 201, 0.15);
}

/* ============================================================================
 * Location Picker Modal
 * ============================================================================ */

.gm-loc-modal-content {
    background: rgba(18, 18, 30, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(16px) saturate(1.4);
    color: rgba(255, 255, 255, 0.9);
}

.gm-loc-modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
}

.gm-loc-modal-header .modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.gm-loc-modal-body {
    padding: 16px 18px;
    max-height: 50vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.gm-loc-modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 18px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Step Grid (Region + Location cards) */
.gm-loc-step-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 400px) {
    .gm-loc-step-grid {
        grid-template-columns: 1fr;
    }
}

/* Region Button */
.gm-loc-region-btn,
.gm-loc-location-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: center;
}

.gm-loc-region-btn:hover,
.gm-loc-location-btn:hover {
    border-color: rgba(93, 214, 201, 0.4);
    background: rgba(93, 214, 201, 0.06);
    box-shadow: 0 2px 12px rgba(93, 214, 201, 0.1);
}

.gm-loc-region-btn i,
.gm-loc-location-btn i {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.gm-loc-region-name,
.gm-loc-location-name {
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.3;
}

.gm-loc-region-count,
.gm-loc-location-type {
    font-size: 0.65rem;
    opacity: 0.5;
    text-transform: capitalize;
}

/* Detail Step */
.gm-loc-detail-step {
    padding: 4px 0;
}

.gm-loc-selected-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(93, 214, 201, 0.06);
    border: 1px solid rgba(93, 214, 201, 0.2);
    border-left: 3px solid rgba(93, 214, 201, 0.5);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.gm-loc-input {
    background: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.8rem !important;
}

.gm-loc-input:focus {
    border-color: var(--accent, #5dd6c9) !important;
    box-shadow: 0 0 0 0.15rem rgba(93, 214, 201, 0.15) !important;
}

.gm-loc-input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* ============================================================================
 * GM Export Panel
 * ============================================================================ */

.gm-export-panel {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(93, 214, 201, 0.4);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(12px) saturate(1.3);
}

.gm-export-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    padding: 12px;
    resize: vertical;
}

.gm-export-textarea:focus {
    outline: none;
    border-color: var(--accent, #5dd6c9);
    box-shadow: 0 0 0 0.15rem rgba(93, 214, 201, 0.15);
}

/* ============================================================================
 * Monster Spawner + Quest Spawner (Shared)
 * ============================================================================ */

.gm-spawn-panel {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
}

.gm-spawn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
}

@media (max-width: 575px) {
    .gm-spawn-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gm-spawn-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid color-mix(in srgb, var(--spawn-color, #dc3545) 30%, transparent);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
    text-align: center;
    font-size: 0.75rem;
}

.gm-spawn-btn:hover {
    border-color: var(--spawn-color, #dc3545);
    background: color-mix(in srgb, var(--spawn-color, #dc3545) 10%, transparent);
    box-shadow: 0 2px 12px color-mix(in srgb, var(--spawn-color, #dc3545) 15%, transparent);
    transform: translateY(-2px);
}

.gm-spawn-btn:active {
    transform: translateY(0);
}

.gm-spawn-btn--done {
    opacity: 0.4;
    cursor: not-allowed;
}

.gm-spawn-btn--done:hover {
    transform: none;
    box-shadow: none;
}

.gm-spawn-btn--selected {
    border-color: var(--spawn-color, #dc3545);
    background: color-mix(in srgb, var(--spawn-color, #dc3545) 12%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--spawn-color, #dc3545) 20%, transparent);
}

.gm-spawn-btn-icon {
    font-size: 1.1rem;
    color: var(--spawn-color, #dc3545);
}

.gm-spawn-btn-name {
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1.2;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gm-spawn-btn-info {
    font-size: 0.6rem;
    opacity: 0.55;
}

/* Monster image in spawn button */
.gm-spawn-btn-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid color-mix(in srgb, var(--spawn-color, #dc3545) 40%, transparent);
}

.gm-spawn-btn-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Rarity + Boss Badges */
.gm-spawn-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 1px;
}

.gm-spawn-badge--boss {
    background: rgba(255, 80, 80, 0.15);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
}

.gm-spawn-badge--uncommon {
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

.gm-spawn-badge--rare {
    background: rgba(52, 152, 219, 0.12);
    border: 1px solid rgba(52, 152, 219, 0.3);
    color: #3498db;
}

.gm-spawn-badge--epic {
    background: rgba(155, 89, 182, 0.12);
    border: 1px solid rgba(155, 89, 182, 0.3);
    color: #9b59b6;
}

.gm-spawn-badge--legendary {
    background: rgba(243, 156, 18, 0.12);
    border: 1px solid rgba(243, 156, 18, 0.35);
    color: #f39c12;
    animation: gm-badge-glow-gold 2s ease-in-out infinite;
}

.gm-spawn-badge--mythic {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.35);
    color: #e74c3c;
    animation: gm-badge-glow-mythic 2s ease-in-out infinite;
}

@keyframes gm-badge-glow-gold {
    0%, 100% { box-shadow: 0 0 4px rgba(243, 156, 18, 0.1); }
    50% { box-shadow: 0 0 10px rgba(243, 156, 18, 0.25); }
}

@keyframes gm-badge-glow-mythic {
    0%, 100% { box-shadow: 0 0 4px rgba(231, 76, 60, 0.1); }
    50% { box-shadow: 0 0 10px rgba(231, 76, 60, 0.25); }
}

@media (prefers-reduced-motion: reduce) {
    .gm-spawn-badge--legendary,
    .gm-spawn-badge--mythic {
        animation: none;
    }
}

.gm-spawn-form {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Quest Spawner */
.gm-quest-spawner .gm-spawn-btn {
    padding: 8px 10px;
}

.gm-quest-spawner .gm-spawn-btn-name {
    max-width: 120px;
}

/* Log entry for quest */
.gm-log-entry--quest {
    border-left: 2px solid rgba(255, 193, 7, 0.4);
}

@media (prefers-reduced-motion: reduce) {
    .gm-spawn-btn:hover {
        transform: none;
    }
}

/* ============================================================================
 * Quest Modal Tabs
 * ============================================================================ */

.gm-quest-tab-btn {
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.gm-quest-tab-btn.--active {
    background: rgba(255, 255, 255, 0.1);
    border-color: currentColor;
    font-weight: 600;
}

/* ============================================================================
 * GM Select Modal – Group Selection Cards
 * ============================================================================ */

.gm-select-card {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(255, 211, 107, 0.4);
    border-radius: var(--r, 14px);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    color: var(--text, #e6edf3);
    cursor: pointer;
}

.gm-select-card:hover {
    border-color: rgba(255, 211, 107, 0.6);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 12px rgba(255, 211, 107, 0.1);
    color: var(--text, #e6edf3);
}

.gm-select-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 1.2rem;
    color: var(--gold, #ffd36b);
}

.gm-select-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-select-card__info {
    flex: 1 1 auto;
    min-width: 0;
}

.gm-select-card__name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gm-select-card__meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--muted, #8b949e);
    margin-top: 2px;
}

.gm-select-card__arrow {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.25);
    transition: color 0.2s, transform 0.2s;
}

.gm-select-card:hover .gm-select-card__arrow {
    color: var(--gold, #ffd36b);
    transform: translateX(2px);
}

/* ==========================================================================
   Item-Vergabe: Typ-Filter Buttons
   ========================================================================== */
.gm-item-type-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s;
}

.gm-item-type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
}

.gm-item-type-btn.--active {
    background: rgba(93, 214, 201, 0.12);
    border-color: var(--accent, #5dd6c9);
    color: var(--accent, #5dd6c9);
}
