/* ========================================================
   1. GLOBÁLIS ÉS ALAPBEÁLLÍTÁSOK
   ======================================================== */
body {
    font-family: 'Georgia', Times, serif;
    background: #e6e3d6;
    padding: 20px;
    margin: 0;
}

.character-sheet {
    background: #fff;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 25px;
    border: 1px solid #777;
    box-shadow: 0 0 15px rgba(0,0,0,0.15);
    box-sizing: border-box;
    display: block !important;
}

h2 {
    text-align: center;
    color: #000;
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 20px;
}

/* ========================================================
   2. FEJLÉC ÉS FAJI PANEL (HIVATALOS LEKEREKÍTETT DIZÁJN)
   ======================================================== */
.header-box {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 30px !important;
    border: 3px solid #7a0000 !important;      
    border-radius: 18px !important;         
    padding: 20px !important;               
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    float: none !important;
}

.dnd-name-section {
    flex: 1.5 1 250px !important;
    display: flex !important;
    align-items: center !important;
}

.name-field {
    width: 100% !important;
    border-bottom: 2px solid #000 !important;
}

.name-field label {
    font-size: 0.85em !important;
    font-weight: bold;
    text-transform: uppercase;
}

.name-field input {
    font-size: 1.7em !important;
    font-weight: bold;
    height: 48px !important;
}

.dnd-details-section {
    flex: 2 1 450px !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important;
}

.dnd-details-column {
    flex: 1 !important;
    min-width: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.header-box .field-group {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    border-bottom: 1px solid #000 !important;
}

.header-box .field-group label {
    font-size: 0.72em !important;
    font-weight: bold;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 2px !important;
}

.header-box .field-group input, 
.header-box .field-group select {
    height: 28px !important;
    padding: 2px 0 !important;
    font-size: 0.95em !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.class-level-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
}

#charClass { flex: 1 1 auto !important; display: block !important; }
#charLevel { width: 32px !important; flex: 0 0 32px !important; text-align: center !important; font-weight: bold !important; }

.bonus-panel {
    display: none; background: #fffde6; padding: 12px; border: 1px dashed #d4af37;
    margin-top: 10px; border-radius: 4px; width: 100%; box-sizing: border-box; font-size: 0.9em; flex-basis: 100% !important;
}
.bonus-panel select { padding: 4px; font-size: 0.9em; width: auto; display: inline-block; }

/* ========================================================
   3. ALAP TULAJDONSÁGOK (STAT KÁRTYÁK ELRENDEZÉSE)
   ======================================================== */
.dnd-abilities-sidebar {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
}

.ability-card {
    border: 2px solid #7a0000;
    border-radius: 10px;
    width: 100%;
    max-width: 75px;
    margin: 0 auto;
    text-align: center;
    padding: 6px 4px;
    background: #fff;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box;
}

.ability-card label { font-size: 0.7em !important; font-weight: bold; color: #333; margin-bottom: 2px; }
.ability-card .mod-display { font-size: 1.5em; font-weight: bold; color: #7a0000; margin: 2px 0 4px 0; }
.ability-card input { width: 42px !important; height: 24px !important; text-align: center !important; border: 1px solid #777 !important; border-radius: 6px !important; font-size: 0.85em !important; background: #fafafa !important; }
/* ========================================================
   4. EGYSÉGES KONTÉNER STÍLUSOK A DOBOZOKNAK (1. RÉSZLET)
   ======================================================== */

/* Szoftveres fő keretek a 4 oszlop új dobozainak */
.dnd-main-block-box, 
.dnd-sub-block-box, 
.dnd-traits-container {
    border: 2px solid #7a0000 !important;
    border-radius: 6px !important;
    padding: 12px !important;
    background: #fff !important;
    box-sizing: border-box !important;
    margin-bottom: 15px !important;
    width: 100% !important;
}

.dnd-main-block-box h4 {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
    color: #7a0000;
}

.dnd-sub-block-box h5 {
    margin: 0 0 8px 0;
    font-size: 0.8em;
    text-transform: uppercase;
    border-bottom: 1px dashed #777;
    padding-bottom: 3px;
    color: #000;
}

/* Mentődobások és Képzettségek (Skills) belső sorai */
.save-line, .skill-line {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 0.8em !important;
    margin-bottom: 5px !important;
}

.save-line input[type="checkbox"], 
.skill-line input[type="checkbox"] {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    cursor: pointer;
}

.save-val, .skill-val {
    font-weight: bold !important;
    color: #7a0000 !important;
    min-width: 22px !important;
    text-align: center !important;
}

.save-line label, .skill-line label {
    font-size: 1em !important;
    color: #000 !important;
    text-transform: none !important;
    min-height: auto !important;
}

/* Egybefogva mozgó kerek papír-kártyák (Inspiráció, Jártasság, Passzív) */
.dnd-paper-row-card {
    border: 2px solid #7a0000;
    border-radius: 6px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 6px 10px !important;
    background: #fff !important;
    margin-bottom: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.dnd-paper-row-card input, 
.dnd-paper-row-card .passive-val {
    width: 32px !important;
    height: 32px !important;
    border: 2px solid #7a0000 !important;
    border-radius: 50% !important;
    text-align: center !important;
    font-weight: bold !important;
    font-size: 1.05em !important;
    line-height: 28px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    padding: 0 !important;
}

.dnd-paper-row-card label {
    font-size: 0.75em !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    color: #000 !important;
}

/* Képzettség-számláló sáv stílusa */
.skill-info-bar {
    background: #eef6ff !important;
    border: 1px dashed #1e70bf !important;
    padding: 6px !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    font-size: 0.8em !important;
    font-weight: bold;
    color: #1e70bf !important;
    text-align: center !important;
}
.skill-info-bar.hidden { display: none !important; }
.choices-badge { background: #1e70bf; color: white; padding: 1px 5px; border-radius: 4px; }
.choices-badge.complete { background: #2e7d32; }

/* 3. OSZLOP: Harci négyzetek (AC, Init, Speed) */
.dnd-combat-top-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    margin-bottom: 15px !important;
}

.dnd-combat-square {
    border: 2px solid #7a0000;
    border-radius: 6px;
    flex: 1 !important;
    text-align: center !important;
    padding: 8px 2px !important;
    background: #fff;
}
.dnd-combat-square label { font-size: 0.68em !important; font-weight: bold !important; display: block !important; text-transform: uppercase !important; }
.dnd-combat-square input { border: none !important; font-size: 1.25em !important; font-weight: bold !important; text-align: center !important; width: 100% !important; background: transparent !important; margin-top: 4px !important; }
.combat-val { font-size: 1.25em; font-weight: bold; color: #000; margin-top: 4px; }
/* ========================================================
   4. EGYSÉGES KONTÉNER STÍLUSOK A DOBOZOKNAK (2. RÉSZLET)
   ======================================================== */

/* Életerő (HP) dobozok formázása */
.dnd-hp-container-box {
    border: 2px solid #7a0000;
    border-radius: 6px;
    padding: 10px;
    background: #fff;
    margin-bottom: 15px;
}
.dnd-hp-sub-line { display: flex; flex-direction: column; align-items: center; }
.max-hp-line { border-bottom: 1px dashed #ccc; padding-bottom: 6px; margin-bottom: 8px; }
.max-hp-line label { font-size: 0.7em !important; color: #555; }
.max-hp-line input { border: none !important; border-bottom: 1px solid #000 !important; text-align: center; font-size: 0.95em; width: 60px; background: transparent; }
.current-hp-line label { font-size: 0.75em !important; font-weight: bold; text-transform: uppercase; margin-bottom: 4px; }
.current-hp-line input { width: 100%; max-width: 120px; text-align: center; font-size: 1.5em; font-weight: bold; border: 1px solid #000 !important; border-radius: 4px; padding: 2px; }

.rest-buttons-row { display: flex !important; gap: 4px !important; margin-top: 5px !important; width: 100% !important; }
.rest-btn { flex: 1 !important; height: 18px !important; padding: 0 !important; font-size: 0.7em !important; font-weight: bold; border-radius: 2px; border: 1px solid #7a0000; cursor: pointer; }
#shortRestBtn { background: #fff; color: #7a0000; }
#longRestBtn { background: #7a0000; color: #fff; }

.dnd-dice-death-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }

/* Halál mentők egyedi buborékjai */
.death-saves-box { display: flex; flex-direction: column; justify-content: center; padding: 8px 10px !important; }
.death-saves-rows { display: flex; flex-direction: column; gap: 4px; }
.death-save-line { display: flex; align-items: center; justify-content: space-between; font-size: 0.75em; font-weight: bold; }
.death-bubble { -webkit-appearance: none; appearance: none; width: 14px !important; height: 14px !important; border: 2px solid #7a0000 !important; border-radius: 50% !important; cursor: pointer; background: #fff; margin: 0 !important; }
.death-bubble:checked { background: #7a0000 !important; box-shadow: inset 0 0 0 2px #fff; }

/* Fegyvertáblázat stílusai az Attacks panelen */
.dnd-weapons-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}
.dnd-weapons-table th { font-size: 0.65em; text-transform: uppercase; color: #555; text-align: left; padding-bottom: 4px; border-bottom: 1px solid #000; }
.dnd-weapons-table td { padding: 4px 0; border-bottom: 1px solid #ccc; }
.dnd-weapons-table input { width: 100%; border: none !important; background: transparent !important; font-size: 0.9em !important; padding: 2px 0 !important; height: auto !important; }
.center-input { text-align: center !important; }

/* Személyiség és szerepjátékos kártyák a 4. oszlopban */
.dnd-trait-card { border-bottom: 1px dashed #aaa; padding-bottom: 6px; margin-bottom: 6px; }
.dnd-trait-card:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.dnd-trait-card label { font-size: 0.7em !important; font-weight: bold; color: #7a0000; text-transform: uppercase; display: block; margin-bottom: 4px; }

/* TEXTAREA GÖRGETHETŐSÉGÉNEK ALAPBEÁLLÍTÁSAI */
textarea {
    width: 100% !important;
    padding: 8px !important;
    border: 1px solid #aaa !important;
    border-radius: 4px !important;
    font-family: inherit !important;
    font-size: 0.88em !important;
    box-sizing: border-box !important;
    resize: vertical !important;    
    overflow-y: auto !important;    
    background: #fff !important;
}

/* FIX OSZLOPSZINTŰ GÖRGETŐS MAGASSÁGOK */
#char-features { height: 320px !important; min-height: 200px; }
#inv-items { height: 180px !important; min-height: 120px; }
#prof-languages, #prof-other { height: 80px !important; min-height: 60px; }
.dnd-trait-card textarea { height: 65px !important; min-height: 50px; }

.language-picker-row { display: flex; gap: 8px; margin-top: 8px; }
.language-picker-row select { flex: 2; padding: 4px; font-size: 0.85em; }
.language-picker-row button { flex: 1; padding: 4px 8px; font-size: 0.85em; background: #1e70bf; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* MOBIL ALAPHELYZET (EGYMÁS ALATT) */
.dnd-main-body-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100% !important;
    box-sizing: border-box !important;
    clear: both !important;
    margin-top: 25px !important;
}

/* TELJES OLDALAS NAGY VARÁZSLATLISTA DIZÁJN (3. OLDAL ALAPJÁN) */
.dnd-full-page-spell-list {
    width: 100%;
    margin-top: 40px;
    border: 3px solid #000;
    border-radius: 18px;
    padding: 25px;
    background: #fff;
    box-sizing: border-box;
    page-break-before: always; 
}
.dnd-full-page-spell-list h3 { text-align: center; text-transform: uppercase; color: #7a0000; margin-top: 0; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 5px; }
.spell-sheet-top-banner { display: flex; flex-direction: row; flex-wrap: wrap; gap: 30px; margin-bottom: 30px; align-items: flex-end; }
.class-spell-field { flex: 1.2 1 250px !important; border-bottom: 2px solid #000 !important; }
.class-spell-field input { font-size: 1.4em !important; font-weight: bold; border: none !important; background: transparent !important; height: 40px !important; }
.spell-header-stats { flex: 2 1 450px !important; display: flex; gap: 15px; margin-bottom: 0 !important; border-bottom: none !important; padding-bottom: 0 !important; }
.spell-stat-box { flex: 1; display: flex; flex-direction: column; align-items: center; border-bottom: 1px solid #000; }
.spell-stat-box label { font-size: 0.7em; font-weight: bold; text-transform: uppercase; color: #555; margin-bottom: 4px; }
.spell-stat-box input { border: none !important; background: transparent !important; text-align: center; font-size: 1.2em; font-weight: bold; height: 30px !important; width: 100%; }
.spell-page-triple-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; width: 100%; }
.spell-mega-column { display: flex; flex-direction: column; gap: 20px; }
.spell-level-block { display: flex; flex-direction: column; width: 100%; }
.level-badge-header { display: flex; align-items: center; gap: 10px; border: 2px solid #000; border-radius: 6px; background: #f4f2ea; padding: 4px 8px; margin-bottom: 10px; }
.badge-num { width: 24px; height: 24px; border: 2px solid #000; background: #fff; transform: rotate(45deg); display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.9em; }
.slots-tracker { display: flex; gap: 4px; align-items: center; }
.slots-tracker input { width: 30px !important; height: 22px !important; text-align: center !important; font-weight: bold !important; border: 1px solid #000 !important; border-radius: 4px !important; background: #fff !important; padding: 0 !important; }
.spell-lines-list { display: flex; flex-direction: column; gap: 4px; padding-left: 5px; }
.spell-lines-list input[type="text"] { width: 100% !important; height: 26px !important; border: none !important; border-bottom: 1px solid #aaa !important; background: transparent !important; font-size: 0.9em !important; padding: 2px 0 !important; box-sizing: border-box; }
.spell-lines-list input[type="text"]:focus { border-bottom: 2px solid #7a0000 !important; outline: none; }

button#pdfBtn { display: block; width: 100%; max-width: 200px; margin: 25px auto 0; padding: 12px; background: #7a0000; color: white; border: none; border-radius: 4px; font-size: 1.1em; cursor: pointer; font-weight: bold; }
button#pdfBtn:hover { background: #5c0000; }

/* ========================================================
   5. A SPECIFIKUS 4 OSZLOPOS RÁCSRENDSZER GENERÁLÁSA
   ======================================================== */
@media (min-width: 600px) {
    .dnd-main-body-grid {
        display: grid !important; 
        grid-template-columns: 80px 1fr 1fr 1fr !important; 
        gap: 20px !important;
    }
    .dnd-col-1 { grid-column: 1 !important; grid-row: 1 !important; width: 80px !important; }
    .dnd-col-2 { grid-column: 2 !important; grid-row: 1 !important; }
    .dnd-col-languages-cross { grid-column: 1 / span 2 !important; grid-row: 2 !important; }
    .dnd-col-3 { grid-column: 3 !important; grid-row: 1 / span 2 !important; }
    .dnd-col-4 { grid-column: 4 !important; grid-row: 1 / span 2 !important; }
    button#pdfBtn { grid-column: span 4 !important; }
}

@media print {
    body { background: white; padding: 0; }
    .character-sheet { border: none; box-shadow: none; padding: 0; }
    #pdfBtn, .rest-buttons-row, .skill-info-bar, .language-picker-row { display: none !important; }
}
/* ========================================================
   6. MULTI-PAGE SPA NAVIGÁCIÓ ÉS PORTRE STÍLUSAI
   ======================================================== */

/* Elrejtő osztály a nem aktív oldalaknak */
.dnd-spa-page-hidden {
    display: none !important;
}

/* Navigációs gomb kerete a fejléc jobb alsó sarkában */
.dnd-header-nav-wrapper {
    display: flex !important;
    align-items: flex-end !important;
    height: 34px !important; /* Hajszálpontosan egy vonalba hozza a bal oldali Faj dobozzal */
    margin-top: 6px;
}

/* Hivatalos D&D stílusú, fejlécbe simuló navigációs gomb */
.dnd-nav-link-btn {
    width: 100% !important;
    height: 28px !important;
    background: #f4f2ea !important; /* Enyhe pergamen tónus */
    border: 1px solid #000 !important;
    border-radius: 4px !important;
    color: #000 !important;
    font-family: inherit;
    font-size: 0.8em !important;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.dnd-nav-link-btn:hover {
    background: #7a0000 !important; /* D&D vörös kiemelés vörös háttérrel */
    color: #fff !important;
    border-color: #7a0000 !important;
}

/* Vissza gomb stílusa a történet oldalon */
.dnd-back-nav-btn {
    background: #fff;
    border: 2px solid #000;
    color: #000;
    padding: 6px 12px;
    font-size: 0.85em;
    font-family: inherit;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.2s;
}
.dnd-back-nav-btn:hover { background: #f4f2ea; border-color: #7a0000; color: #7a0000; }

/* Fizikai tulajdonságok felső sávja a 2. oldalon */
.dnd-appearance-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    background: #fafafa;
    padding: 12px;
    border: 1px solid #000;
    border-radius: 6px;
}

/* Kép és történet felosztás asztali elrendezése */
.dnd-details-main-split { display: flex; flex-direction: row; flex-wrap: wrap; gap: 20px; width: 100%; }
.dnd-details-left-side { flex: 1 1 320px; display: flex; flex-direction: column; }
.dnd-details-right-side { flex: 1.5 1 420px; display: flex; }
.dnd-avatar-box { margin-bottom: 15px !important; }

/* Szaggatott vonalú, interaktív képkeret */
..avatar-placeholder {
    width: 100% !important;
    aspect-ratio: 6 / 9 !important; /* ATOMBIZTOS 6:9-ES FÜGGŐLEGES KÉPARÁNY */
    height: auto !important;         /* Kivesszük a fix 240px-es magasságot */
    border: 2px dashed #7a0000 !important; /* D&D vörös szaggatott keret */
    border-radius: 6px !important;
    background: #fafafa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}
.avatar-placeholder:hover { background: #f0f0f0; border-color: #7a0000; }
.avatar-placeholder span { font-size: 0.85em; color: #666; font-style: italic; text-align: center; padding: 10px; }
.avatar-placeholder img { width: 100%; height: 100%; object-fit: cover; }
.dnd-story-box textarea { height: 100% !important; min-height: 380px; }

/* NYOMTATÁSI JAVÍTÁS: Exportáláskor a böngésző kényszerítve megmutatja az összes oldalt egymás alatt */
@media print {
    .dnd-spa-page-hidden { display: block !important; }
    .dnd-main-body-grid { display: grid !important; }
    .dnd-nav-link-btn, .dnd-back-nav-btn { display: none !important; }
}
/* ========================================================
   7. ISTENI SZFÉRA MODAL FELUGRÓ ABLAK STÍLUSAI
   ======================================================== */
.dnd-modal-overlay {
    position: fixed !important;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
}

.dnd-modal-card {
    background: #fff !important;
    border: 3px solid #7a0000 !important;
    border-radius: 14px !important;
    padding: 25px !important;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    text-align: center;
    font-family: 'Georgia', serif;
}

.dnd-modal-card h4 {
    margin-top: 0;
    color: #7a0000;
    font-size: 1.2em;
    text-transform: uppercase;
    border-bottom: 2px solid #7a0000;
    padding-bottom: 8px;
}

.dnd-modal-card p {
    font-size: 0.88em;
    color: #444;
    line-height: 1.4;
    margin: 15px 0;
}

.dnd-modal-card select {
    width: 100% !important;
    height: 36px !important;
    padding: 5px !important;
    font-family: inherit;
    font-size: 0.9em !important;
    border: 1px solid #7a0000 !important;
    border-radius: 4px !important;
    background: #f4f2ea !important;
    margin-bottom: 10px;
}

#dndModalSaveBtn {
    background: #7a0000 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 12px 20px !important;
    font-size: 0.95em !important;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    width: 100%;
    transition: background 0.2s;
}
#dndModalSaveBtn:hover {
    background: #5c0000 !important;
}
