/* style.css - Версия 30 (Финал) - Готическое и Высококонтрастное Оформление Листа Персонажа (Парчмент Тема) */
/* ======================================================================================== */
/* Данная версия полностью адаптирована под Client-Server архитектуру (Server-First логику)  */
/* и включает новые стили для облачной синхронизации, панели Мастера и инлайн-редактирования. */
/* ======================================================================================== */

/* Подключение кастомного шрифта, если пользователь загрузит его в папку проекта */
@font-face {
    font-family: 'WesterosCustom';
    src: url('custom-font.woff2') format('woff2'), url('custom-font.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #121212;
    --bg-parchment: #fcf8f2;
    --bg-panel: #f5edd6;
    --bg-panel-darker: #ebdca9;
    --text-main: #1e130c;
    --text-muted: #5e4a3c;
    --accent-red: #8c1c1c;
    --accent-red-hover: #b52222;
    --border-gold: #9d753d;
    --border-dark: #3c2a1c;
}

* {
    box-sizing: border-box;
}

body.parchment-theme {
    font-family: 'Cormorant Garamond', serif;
    background-color: #f7f1e5;
    background-image: radial-gradient(circle, #fcf8f2 60%, #eedfcc 100%);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    font-size: 19px;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

h1, h2, h3, h4, label, button, .col-title, .skills-header, th {
    font-family: 'Cormorant Garamond', serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

/* Навигация */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px double var(--border-gold);
    margin-bottom: 25px;
}

.nav-left, .nav-right {
    display: flex;
    gap: 12px;
}

button {
    background-color: var(--bg-panel);
    color: var(--accent-red);
    border: 1px solid var(--border-gold);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
    transition: all 0.2s ease-in-out;
}

button:hover {
    background-color: var(--accent-red);
    color: #fcf8f2;
    border-color: var(--accent-red);
    box-shadow: 1px 2px 6px rgba(140, 28, 28, 0.4);
}

.action-btn {
    border-color: var(--border-gold);
    color: var(--text-main);
}

.action-btn:hover {
    background-color: var(--border-gold);
    color: #fcf8f2;
    border-color: var(--border-gold);
}

.tab-btn.active-tab {
    background-color: var(--accent-red);
    color: #fcf8f2;
    border-color: var(--accent-red);
}

/* Вкладки */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ЭЛЕГАНТНАЯ ШАПКА В СТИЛЕ СВИТКА */
.edwin-header-grid {
    display: grid;
    grid-template-columns: 2.2fr 2fr 1.8fr;
    gap: 25px;
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(60, 42, 28, 0.15);
}

.edwin-meta-block {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 10px;
}

.meta-field {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-gold);
}

.meta-field label {
    font-size: 0.8em;
    width: 60px;
    color: var(--accent-red);
    text-shadow: 0.5px 0.5px 0px rgba(255,255,255,0.5);
    cursor: pointer;
}

.meta-field label:hover {
    color: var(--accent-red-hover);
}

.meta-field input {
    flex-grow: 1;
    border: none !important;
    background: transparent !important;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Cormorant Garamond', serif;
    padding: 4px 5px;
}

/* Портрет-Щит */
.edwin-portrait-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.portrait-shield-frame {
    width: 140px;
    height: 170px;
    border: 3px double var(--border-gold);
    border-radius: 10px 10px 70px 70px; /* Элегантный силуэт щита! */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    background: #14100c;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.portrait-shield-frame:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: var(--accent-red);
}

.portrait-shield-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.portrait-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--border-gold);
    padding: 10px;
    text-align: center;
}

.shield-plus {
    font-size: 2.2em;
    margin-bottom: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.shield-text {
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-size: 0.65em;
    font-weight: bold;
}

/* Интерактивный Девиз */
.motto-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    width: 90%;
    border-top: 1px dashed var(--border-gold);
    padding-top: 4px;
}

.motto-quote {
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-size: 1.1em;
    color: var(--accent-red);
    font-weight: bold;
}

.motto-input-editable {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95em;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    width: 100%;
}

.motto-input-editable:focus {
    color: var(--text-main);
}

/* Блок Судьбы */
.edwin-stats-block {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 10px;
}

.destiny-tracker-container {
    text-align: center;
}

.destiny-tracker-container label {
    font-size: 0.8em;
    color: var(--accent-red);
    margin-bottom: 5px;
    display: block;
    cursor: pointer;
}

.destiny-tracker-container label:hover {
    color: var(--accent-red-hover);
}

/* КРУПНЫЕ И КРАСИВЫЕ ОЧКИ СУДЬБЫ */
.destiny-tracker {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 5px;
}

.destiny-slot {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-gold);
    transform: rotate(45deg);
    cursor: pointer;
    transition: all 0.25s ease;
    background: transparent;
}

.destiny-slot:hover {
    transform: rotate(45deg) scale(1.25);
    box-shadow: 0 0 10px var(--border-gold);
}

.destiny-slot.avail { background-color: var(--border-gold); }
.destiny-slot.spent { background-color: transparent; border-color: var(--text-muted); }
.destiny-slot.burnt { background-color: var(--accent-red); border-color: var(--accent-red); position: relative; }
.destiny-slot.none { border-color: #bbb; opacity: 0.3; }

.destiny-slot.burnt::after {
    content: '×';
    position: absolute;
    top: -4px;
    left: 4px;
    color: var(--bg-parchment);
    transform: rotate(-45deg);
    font-weight: bold;
    font-size: 1.1em;
}

/* Кошелек и Опыт */
.xp-and-money-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.xp-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.xp-container label {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.xp-container input {
    width: 65px;
    text-align: center;
    border: 1px solid var(--border-gold) !important;
    background: var(--bg-parchment) !important;
    border-radius: 4px;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--accent-red);
}

/* Казначейство - фикс спин-батонов и расширение полей */
.header-money-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 2;
}

.header-money-container label {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-bottom: 5px;
    cursor: pointer;
}

.header-money-container label:hover {
    color: var(--accent-red-hover);
}

.header-money-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.header-money-box {
    display: flex;
    align-items: center;
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    border-radius: 3px;
    padding: 2px 4px;
    flex: 1;
}

.coin-icon {
    font-size: 0.95em;
    margin-right: 3px;
}

.header-money-box input {
    width: 100%;
    border: none !important;
    background: transparent !important;
    color: var(--text-main);
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.05em;
    text-align: center;
    padding: 0 !important;
    outline: none !important;
    -webkit-appearance: none;
    margin: 0;
}

/* Отключение спин-батонов монет */
.header-money-box input::-webkit-outer-spin-button,
.header-money-box input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.header-money-box input[type="number"] {
    -moz-appearance: textfield;
}

.conversion-helper-text {
    font-size: 0.72em;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    line-height: 1.1;
    margin-top: 4px;
}

/* ДВУХКОЛОНОЧНЫЙ СБАЛАНСИРОВАННЫЙ МАКЕТ */
.main-sheet-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.sheet-column-left, .sheet-column-right {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.char-sub-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.panel-header {
    text-align: center;
    color: var(--accent-red);
    border-bottom: 2px double var(--border-gold);
    padding-bottom: 5px;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.panel-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px double var(--border-gold);
    margin-bottom: 15px;
    padding-bottom: 5px;
}

.panel-header-flex .panel-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.stat-row {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 15px;
}

/* КРАСИВЫЙ СРЕДНЕВЕКОВЫЙ ДИЗАЙН СТАТС-БОКСОВ */
.stat-box {
    text-align: center;
    flex: 1;
    background: #fbf5e6;
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 10px 5px;
    box-shadow: inset 0 0 8px rgba(157, 117, 61, 0.08);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-box:hover {
    transform: translateY(-2px);
    border-color: var(--accent-red);
}

.stat-title {
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-size: 0.8em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 3px;
}

.stat-val {
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-size: 2.2em;
    font-weight: bold;
    color: var(--accent-red);
    display: block;
    line-height: 1;
    margin: 5px 0;
}

.stat-formula {
    font-size: 0.65em;
    color: #7a6e60;
    font-style: italic;
    display: block;
}

.frac {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 1.3em;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    color: var(--accent-red);
    font-weight: bold;
}

.frac input {
    width: 60px !important;
    text-align: center;
    font-size: 1.1em;
    border: 1px solid var(--border-gold) !important;
    background: var(--bg-parchment) !important;
    border-radius: 3px;
    padding: 2px 0;
    color: var(--text-main);
    font-family: 'Cormorant Garamond', serif;
}

.frac span {
    font-size: 1.2em;
    margin-left: 3px;
}

/* Статус-Индикаторы */
.status-indicator-block {
    background: #fdfaf3;
    border: 1px dashed var(--border-gold);
    padding: 10px;
    border-radius: 3px;
}

.double-status-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-indicator-block label {
    font-size: 0.75em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
    text-align: center;
    cursor: pointer;
}

.status-indicator-block label:hover {
    color: var(--accent-red-hover);
}

.indicator-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.status-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: #fafaf7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s ease-in-out;
    filter: grayscale(100%);
    opacity: 0.4;
}

.status-bubble:hover {
    transform: scale(1.15);
    filter: grayscale(0%);
    opacity: 0.8;
}

/* Раны */
.wound-indicator.active {
    border-color: var(--accent-red);
    background: #ffebeb;
    filter: grayscale(0%);
    opacity: 1;
    box-shadow: 0 0 10px rgba(140, 28, 28, 0.4);
}

/* Травмы */
.injury-indicator.active {
    border-color: #d35400;
    background: #fdf2e9;
    filter: grayscale(0%);
    opacity: 1;
    box-shadow: 0 0 10px rgba(211, 84, 0, 0.4);
}

/* Усталость */
.fatigue-indicator.active {
    border-color: #7f8c8d;
    background: #f2f3f4;
    filter: grayscale(0%);
    opacity: 1;
    box-shadow: 0 0 10px rgba(127, 140, 141, 0.4);
}

.status-info {
    text-align: center;
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 5px;
    font-style: italic;
}

.flex-status {
    display: flex;
    gap: 15px;
}

.flex-status .sub-status {
    flex: 1;
}

/* СЕТКА НАВЫКОВ (ОБЛЕГЧЕННЫЙ, КОМПАКТНЫЙ СТИЛЬ) */
.skills-container.compact-ranks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}

.skills-column {
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.skills-header {
    display: flex;
    font-size: 0.7em;
    color: var(--accent-red);
    border-bottom: 1px solid var(--border-gold);
    padding-bottom: 2px;
    margin-bottom: 6px;
    font-weight: bold;
}

.sh-roll { width: 25px; text-align: center; }
.sh-name { width: 110px; }
.sh-stat { width: 30px; text-align: center; }
.sh-action { width: 25px; }

.skill-row {
    display: flex;
    align-items: center;
    border-bottom: 1px dashed #e2d9ca;
    padding: 2px 0;
    min-height: 28px;
}

.skill-row:hover {
    background: rgba(140, 28, 28, 0.03);
}

.sub-row {
    margin-left: 15px;
    border-left: 2px solid var(--border-gold);
    padding-left: 8px;
    width: calc(100% - 15px);
    background: rgba(251, 245, 230, 0.4);
}

.roll-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    margin-right: 5px;
    font-size: 0.9em;
    background: transparent;
    border: 1px solid var(--border-gold);
    color: var(--accent-red);
    cursor: pointer;
    line-height: 1;
}

.roll-btn:hover {
    background-color: var(--accent-red);
    color: #fcf8f2;
    border-color: var(--accent-red);
}

.skill-name {
    font-weight: 700;
    font-size: 0.9em;
    color: var(--text-main);
    cursor: pointer;
}

.skill-name:hover {
    color: var(--accent-red);
}

.skill-row input[type="number"] {
    width: 32px;
    text-align: center;
    border: 1px solid var(--border-gold);
    background: var(--bg-parchment);
    font-size: 0.9em;
    padding: 1px 0;
    border-radius: 2px;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    color: var(--accent-red);
}

.spec-select {
    width: 110px;
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    font-size: 0.8em;
    padding: 1px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: bold;
}

.spec-bonus-input {
    margin: 0 4px;
}

/* ЗАЩИТНОЕ СНАРЯЖЕНИЕ, ОРУЖИЕ, КАЧЕСТВА */
.gear-sub-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.armor-panel-enhanced {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.selector-group {
    margin-bottom: 10px;
}

.selector-group label {
    font-size: 0.8em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 3px;
}

.selector-group select {
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: bold;
    outline: none;
    border-radius: 2px;
}

.armor-inputs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.armor-inputs div {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    cursor: pointer;
}

.armor-inputs label {
    font-size: 0.65em;
    color: var(--text-muted);
}

.armor-inputs input {
    text-align: center;
    border: 1px solid var(--border-gold);
    background: #fbf5e6;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--accent-red);
    width: 100%;
    border-radius: 2px;
    padding: 3px 0;
}

/* Список динамического оружия */
.weapons-scroll-container {
    max-height: 290px;
    overflow-y: auto;
    padding-right: 5px;
}

.weapon-slot {
    background: #fdfaf3;
    border: 1px solid var(--border-gold);
    border-radius: 3px;
    padding: 10px;
    margin-bottom: 10px;
    transition: all 0.25s ease;
}

.weapon-slot:hover {
    background: #fbf5e6;
    box-shadow: 0 2px 8px rgba(60, 42, 28, 0.1);
}

.wep-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wep-row-header select {
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: bold;
    outline: none;
    border-radius: 2px;
}

.wep-custom-inputs {
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--border-gold);
    padding: 8px;
    border-radius: 3px;
}

.wep-custom-inputs input {
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    padding: 3px;
    font-size: 0.9em;
    border-radius: 2px;
    color: var(--text-main);
}

.wep-stats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.85em;
}

.wep-stats span {
    font-weight: bold;
    color: var(--accent-red);
    font-family: 'WesterosCustom', 'Cinzel', serif;
}

.wep-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.quality-tag {
    background: #ebdcb9;
    border: 1px solid var(--border-gold);
    color: var(--accent-red);
    padding: 4px 8px;
    min-width: 140px;
    font-size: 0.75em;
    cursor: pointer;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    border-radius: 2px;
    transition: all 0.2s;
}

.quality-tag:hover {
    background-color: var(--accent-red);
    color: #fcf8f2;
    border-color: var(--accent-red);
}

.wep-action-btn {
    background: var(--bg-panel);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    padding: 4px 8px;
    cursor: pointer;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    font-weight: bold;
    margin-top: 5px;
    width: 100%;
    font-size: 0.8em;
    transition: 0.2s;
}

.wep-action-btn:hover {
    background: var(--accent-red);
    color: #fff;
}

/* Скроллбары */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
}
::-webkit-scrollbar-thumb {
    background: var(--border-gold);
    border-radius: 3px;
}

/* Качества список */
.qualities-scroll-container {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 5px;
}

.quality-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.quality-select {
    flex-grow: 1;
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: bold;
    outline: none;
    border-radius: 2px;
}

/* РЮКЗАК И ТРЕЗОРИ */
.backpack-treasury-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.bottom-panel-enhanced {
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.appearance-panel-v5 .app-fields-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.app-fields-grid div {
    display: flex;
    flex-direction: column;
}

.app-fields-grid label {
    font-size: 0.65em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.app-fields-grid input {
    border: none;
    border-bottom: 1px solid var(--border-gold);
    background: transparent;
    color: var(--text-main);
    font-size: 1.1em;
    font-weight: 600;
    padding: 2px 0;
}

/* Рюкзак снаряжения - Фиксированный и Симпатичный скролл */
.inventory-scroll-container {
    min-height: 80px;
    height: auto !important;
    max-height: none !important;
}

.inventory-row {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fdfaf3;
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 6px;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(60, 42, 28, 0.05);
}

.inventory-row:hover {
    background: #fbf5e6;
    box-shadow: 0 2px 6px rgba(60, 42, 28, 0.1);
}

.inventory-row input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    color: var(--text-main);
    font-family: 'Cormorant Garamond', serif;
    padding: 2px 4px;
}

.inventory-row input[type="text"] {
    flex-grow: 1;
    border-bottom: 1px solid var(--border-gold) !important;
    font-weight: 700;
}

.inventory-row input[type="number"] {
    text-align: center;
    border: 1px solid var(--border-gold) !important;
    background: var(--bg-parchment) !important;
    border-radius: 2px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    color: var(--accent-red);
}

.inv-row-total-span {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    color: var(--accent-red);
}

.inv-qty-input, .inv-weight-input {
    width: 60px !important;
    text-align: center;
    border: 1px solid var(--border-gold) !important;
    background: var(--bg-parchment) !important;
    border-radius: 2px;
}

.inventory-footer {
    text-align: right;
    font-weight: bold;
    font-size: 1em;
    font-family: 'WesterosCustom', 'Cinzel', serif;
    color: var(--accent-red);
    border-top: 1px solid var(--border-gold);
    padding-top: 8px;
    margin-top: 10px;
}

/* Биография и Клятвы */
.personal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.personal-block {
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.personal-block h3 {
    color: var(--accent-red);
    border-bottom: 1px solid var(--border-gold);
    padding-bottom: 5px;
    margin-top: 0;
    font-size: 1.1em;
}

.personal-block textarea {
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 10px;
    width: 100%;
    resize: vertical;
    border-radius: 3px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1em;
    outline: none;
}

.personal-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.personal-table th, .personal-table td {
    padding: 6px;
    text-align: left;
    border-bottom: 1px solid var(--border-gold);
}

.personal-table th {
    font-size: 0.75em;
    color: var(--accent-red);
}

.personal-table input[type="text"] {
    background: transparent !important;
    border: none !important;
    font-size: 0.95em;
    color: var(--text-main);
    font-family: 'Cormorant Garamond', serif;
    padding: 3px;
}

/* Модалки */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 19, 12, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fdfaf3;
    background-image: radial-gradient(circle, #fdfaf3 70%, #ebdca9 100%);
    margin: 8% auto;
    padding: 30px;
    border: 4px double var(--border-gold);
    border-radius: 8px;
    width: 90%;
    max-width: 650px;
    position: relative;
    box-shadow: 0 8px 32px rgba(30, 19, 12, 0.6);
    color: var(--text-main);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1em;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--accent-red);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--accent-red-hover);
}

#modalTitle {
    color: var(--accent-red);
    border-bottom: 2px double var(--border-gold);
    padding-bottom: 8px;
    margin-top: 0;
}

.citadel-title {
    text-align: center;
    color: var(--accent-red);
    font-size: 1.8em;
}

.rules-search-box {
    margin-bottom: 15px;
}

.rules-search-box input {
    background: var(--bg-parchment);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 8px;
    font-family: 'Cormorant Garamond', serif;
}

.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.rules-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 15px;
}

.rules-card h3 {
    color: var(--accent-red);
    border-bottom: 1px dashed var(--border-gold);
    padding-bottom: 5px;
    margin-top: 0;
}

.rules-list {
    max-height: 350px;
    overflow-y: auto;
    padding-left: 20px;
    font-size: 0.9em;
}

.rules-list li {
    margin-bottom: 8px;
}

/* Кнопки добавления/удаления */
.add-btn, .del-btn {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-gold);
    color: var(--accent-red);
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    border-radius: 2px;
}

.add-btn:hover {
    background-color: var(--border-gold);
    color: #fff;
    border-color: var(--border-gold);
}

.del-btn:hover {
    background-color: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

.help-trigger {
    color: var(--border-gold);
    font-size: 0.85em;
    cursor: pointer;
    margin-left: 2px;
}

.help-trigger:hover {
    color: var(--accent-red);
}

/* Блокирующее модальное окно авторизации */
#authModal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
    pointer-events: all;
}
#authModal .close-btn {
    display: none;
}

#authModal input {
    color: #ffffff !important; /* Белые буквы для читаемости в темной теме */
    background-color: #14100c !important; /* Черный фон инпута */
    border: 2.5px solid var(--border-gold) !important; /* Золотая кайма */
    padding: 10px !important;
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 1.1em !important;
    border-radius: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#authModal input::placeholder {
    color: #a6927a !important; /* Медный плейсхолдер */
    opacity: 0.7 !important;
}

/* Применение WesterosCustom СТРОГО к затребованному списку слов через специальный класс */
.custom-got-font {
    font-family: 'WesterosCustom', 'Cinzel', serif !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

/* Стилизация Селекторов Брони и Щита под Оружие */
.gear-card-selector-enhanced {
    background: #fdfaf3 !important;
    border: 1.5px solid var(--border-gold) !important;
    border-radius: 4px !important;
    padding: 10px !important;
    box-shadow: inset 0 0 6px rgba(157, 117, 61, 0.05) !important;
    transition: all 0.25s ease-in-out !important;
}
.gear-card-selector-enhanced:hover {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 10px rgba(140, 28, 28, 0.12) !important;
}

.gear-card-selector label {
    font-size: 0.85em;
    color: var(--accent-red);
    margin-bottom: 5px;
    display: block;
}

/* Поиск в выпадающих селекторах */
.gear-search-input, .wep-search-input, .quality-search-input {
    border: 1px solid var(--border-gold) !important;
    background: var(--bg-parchment) !important;
    color: var(--text-main) !important;
    padding: 4px 8px !important;
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 0.85em !important;
    border-radius: 3px !important;
    outline: none !important;
    transition: border-color 0.2s;
}
.gear-search-input:focus, .wep-search-input:focus, .quality-search-input:focus {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 5px rgba(140, 28, 28, 0.2) !important;
}

/* Очки Опыта (Меньший размер) */
.xp-container label {
    font-size: 0.65em !important;
}
.xp-container input {
    width: 75px !important;
    font-size: 0.85em !important;
    padding: 3px !important;
}

/* Казначейство - Прямоугольный дизайн с золотым, серебряным и медным свечением */
.header-money-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 2.2;
}
.header-money-row {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
    align-items: center;
}
.money-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.money-label {
    font-family: 'WesterosCustom', 'Cinzel', serif !important;
    font-size: 0.65em !important;
    color: var(--text-muted) !important;
    margin-bottom: 2px !important;
    font-weight: bold !important;
    text-transform: uppercase;
    white-space: nowrap;
}
.money-diamond {
    width: 85px !important;
    height: 32px !important;
    border: 2px solid var(--border-gold) !important;
    background-color: var(--bg-parchment) !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1) !important;
    transition: all 0.25s ease-in-out !important;
    transform: none !important;
    margin-top: 5px !important;
}
.money-diamond input {
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-main) !important;
    font-family: 'Cormorant Garamond', serif !important;
    font-weight: bold !important;
    font-size: 0.9em !important;
    text-align: center !important;
    outline: none !important;
    padding: 0 6px !important;
    margin: 0;
}
.money-diamond input::-webkit-outer-spin-button,
.money-diamond input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.money-diamond input[type="number"] {
    -moz-appearance: textfield;
}

/* Свечение при наведении */
.money-item.gold .money-diamond { border-color: #d4ac0d !important; }
.money-item.gold .money-diamond:hover { border-color: #ffd700 !important; box-shadow: 0 0 10px rgba(212, 172, 13, 0.55) !important; }
.money-item.silver .money-diamond { border-color: #7f8c8d !important; }
.money-item.silver .money-diamond:hover { border-color: #bdc3c7 !important; box-shadow: 0 0 10px rgba(149, 165, 166, 0.55) !important; }
.money-item.copper .money-diamond { border-color: #b9770e !important; }
.money-item.copper .money-diamond:hover { border-color: #e67e22 !important; box-shadow: 0 0 10px rgba(211, 84, 0, 0.55) !important; }

/* Кнопка броска d6 - уменьшение размера */
.roll-btn {
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    margin-right: 5px !important;
    font-size: 0.95em !important;
    background: transparent !important;
    border: 1px solid var(--border-gold) !important;
    color: var(--accent-red) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    border-radius: 4px !important;
    vertical-align: middle !important;
}

/* Global Font overrides for ultimate serif readability in content cards */
.modal-content, .modal-content p, .modal-content td, .modal-content th,
.rules-card, .rules-card p, .rules-card li,
.quality-desc-text, .quality-desc-text strong,
.personal-block, .personal-block textarea, .personal-table td {
    font-family: 'Cormorant Garamond', serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 1.05em !important;
}

.clickable-help {
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
}
.clickable-help:hover {
    color: var(--accent-red-hover) !important;
    text-shadow: 0 0 1px rgba(140, 28, 28, 0.2);
}

/* Medieval Dropdown Selectors and Speed Header styles v15 */
.medieval-custom-select {
    width: 100%;
    background-color: var(--bg-parchment) !important;
    color: var(--text-main) !important;
    border: 1.5px solid var(--border-gold) !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
    font-family: 'Cormorant Garamond', serif !important;
    font-weight: bold !important;
    font-size: 0.95em !important;
    outline: none !important;
    box-shadow: 0 1px 3px rgba(60, 42, 28, 0.1) !important;
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238c1c1c' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
.medieval-custom-select:hover, .medieval-custom-select:focus {
    border-color: var(--accent-red) !important;
    box-shadow: 0 2px 8px rgba(140, 28, 28, 0.15) !important;
}

.speed-container-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0.8;
}
.speed-container-header label {
    font-size: 0.65em !important;
    color: var(--text-muted);
    margin-bottom: 5px;
    white-space: nowrap;
}
.speed-val-box {
    width: 55px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-gold);
    background: var(--bg-parchment);
    border-radius: 4px;
    font-family: 'Cinzel', 'WesterosCustom', serif;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--accent-red);
}

/* Стилизация регулярных войск Дома */
.house-unit-card {
    background: #fdfaf3;
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}
.house-unit-card:hover {
    background: #fbf5e6;
    box-shadow: 0 4px 10px rgba(140, 28, 28, 0.08);
}
.house-unit-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.house-unit-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    font-size: 0.85em;
    margin-top: 8px;
    background: rgba(0,0,0,0.02);
    padding: 6px;
    border-radius: 3px;
    border: 1px dashed var(--border-gold);
}
.house-unit-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.house-unit-stat-item label {
    font-size: 0.7em !important;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}
.house-unit-stat-item span {
    font-weight: bold;
    color: var(--accent-red);
    font-family: 'Cinzel', serif;
}
.house-unit-upgrades {
    display: flex;
    gap: 15px;
    font-size: 0.8em;
    margin-top: 8px;
    justify-content: center;
}
.house-unit-upgrades label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.9em !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* Sigil Frame uploader styles */
#sigil-frame {
    width: 120px;
    height: 140px;
    border: 3px double var(--border-gold);
    border-radius: 10px 10px 50px 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    background: #14100c;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
#sigil-frame:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: var(--accent-red);
}
#sigil-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none !important;
}

/* House panel resources styling */
#house input[type="number"] {
    text-align: center !important;
    border: 1.5px solid var(--border-gold) !important;
    background-color: var(--bg-parchment) !important;
    color: var(--accent-red) !important;
    font-weight: bold !important;
    font-size: 1.25em !important;
    border-radius: 4px !important;
    width: 80px !important;
    padding: 2px !important;
    outline: none !important;
    font-family: 'Cinzel', serif !important;
}

#house .meta-field {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid var(--border-gold) !important;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
}

#house .meta-field label {
    font-family: 'WesterosCustom', 'Cinzel', serif !important;
    font-size: 0.85em !important;
    font-weight: bold !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    margin: 0 !important;
    width: auto !important;
}

/* ======================================================== */
/* V23 CLIENT-SERVER REAL-TIME SYNCHRONIZATION OVERRIDES   */
/* ======================================================== */

/* 1. Master Active Editing Notice Panel */
#master-active-edit-notice {
    background: rgba(140, 28, 28, 0.08) !important;
    border: 1.5px solid var(--accent-red) !important;
    border-radius: 4px;
    padding: 12px 18px !important;
    margin-bottom: 20px;
    display: none; /* dynamically toggled */
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(140, 28, 28, 0.12);
    animation: pulseBorder_v23 2.5s infinite ease-in-out;
}

@keyframes pulseBorder_v23 {
    0% { border-color: var(--accent-red); box-shadow: 0 0 5px rgba(140, 28, 28, 0.2); }
    50% { border-color: var(--border-gold); box-shadow: 0 0 15px rgba(157, 117, 61, 0.35); }
    100% { border-color: var(--accent-red); box-shadow: 0 0 5px rgba(140, 28, 28, 0.2); }
}

#master-active-edit-notice span {
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 1em !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

#master-active-edit-notice button {
    font-family: 'Cinzel', serif !important;
    font-size: 0.75em !important;
    padding: 4px 10px !important;
    margin: 0 !important;
    background: var(--accent-red) !important;
    color: #fcf8f2 !important;
    border: 1px solid var(--accent-red) !important;
    transition: all 0.2s ease-in-out;
}

#master-active-edit-notice button:hover {
    background: var(--bg-parchment) !important;
    color: var(--accent-red) !important;
    border-color: var(--accent-red) !important;
}

/* 2. Cloud Synchronization Status Indicators */
.sync-status-badge {
    font-size: 0.75em;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1.5px solid var(--border-gold);
    background: rgba(157, 117, 61, 0.08);
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.sync-status-badge.online {
    border-color: #27ae60 !important;
    color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.06) !important;
}

.sync-status-badge.offline {
    border-color: var(--accent-red) !important;
    color: var(--accent-red) !important;
    background: rgba(140, 28, 28, 0.06) !important;
}

/* 3. Meyster Cloud Synchronization Info Panel (replaces local-sync-warning) */
.local-sync-warning {
    background: rgba(157, 117, 61, 0.05) !important;
    border: 2px solid var(--border-gold) !important;
    border-radius: 4px;
    padding: 16px 20px !important;
    margin-bottom: 25px;
    font-size: 0.95em !important;
    color: var(--text-main) !important;
    line-height: 1.5 !important;
    font-family: 'Cormorant Garamond', serif !important;
    box-shadow: inset 0 0 10px rgba(157, 117, 61, 0.05);
}

.local-sync-warning strong {
    color: var(--accent-red) !important;
    font-weight: 700;
}

/* 4. Master Creator Form Inputs Dark-Fantasy Integration */
.master-create-user-form input, .master-create-user-form select {
    background-color: var(--bg-parchment) !important;
    border: 1.5px solid var(--border-gold) !important;
    color: var(--text-main) !important;
    padding: 8px 12px !important;
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 0.95em !important;
    border-radius: 4px !important;
    outline: none !important;
    transition: all 0.2s ease-in-out;
    box-shadow: inset 0 1px 3px rgba(60, 42, 28, 0.05);
}

.master-create-user-form input:focus, .master-create-user-form select:focus {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 6px rgba(140, 28, 28, 0.25) !important;
}

/* 5. Mobile & Tablet Responsiveness Enhancements */
@media (max-width: 1024px) {
    .main-sheet-two-columns {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    body.parchment-theme {
        padding: 10px;
        font-size: 17px;
    }
    .edwin-header-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    .appearance-panel-v5 .app-fields-grid {
        grid-template-columns: 1fr 1fr;
    }
    .personal-grid {
        grid-template-columns: 1fr;
    }
    .rules-grid {
        grid-template-columns: 1fr;
    }
    nav {
        flex-direction: column !important;
        gap: 15px !important;
        padding-bottom: 15px !important;
    }
    .nav-right {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ПЕЧАТЬ */
@media print {
    body.parchment-theme {
        background: #fff !important;
        color: #000 !important;
        font-size: 13px;
        padding: 0;
    }
    .no-print, .help-trigger {
        display: none !important;
    }
    input, select, textarea {
        color: #000 !important;
        border-bottom: 1px solid #333 !important;
        background: transparent !important;
    }
    .edwin-header-grid, .char-sub-panel, .skills-column, .gear-sub-panel, .bottom-panel-enhanced, .personal-block {
        background: #fff !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        color: #000 !important;
    }
    .col-title, .panel-header, .stat-val, .motto-text {
        color: #000 !important;
        border-color: #000 !important;
    }
    .status-bubble {
        border-color: #000 !important;
        opacity: 0.3 !important;
    }
    .status-bubble.active {
        opacity: 1 !important;
        background: #ccc !important;
    }
    .destiny-slot {
        border-color: #000 !important;
    }
    .destiny-slot.avail {
        background-color: #000 !important;
    }
}

/* Overrides for larger and more readable qualities (ASIFR v28) */
.quality-select {
    font-size: 1.25em !important;
    padding: 6px !important;
    height: auto !important;
}
.quality-desc-text {
    font-size: 1.2em !important;
    line-height: 1.45 !important;
    color: #1e130c !important; /* higher contrast dark color */
    margin-top: 6px !important;
}
.quality-search-input {
    font-size: 1.05em !important;
    padding: 6px !important;
    width: 120px !important;
}
.quality-card {
    background: rgba(157, 117, 61, 0.02) !important;
    border: 1.5px solid var(--border-gold) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    border-radius: 4px !important;
}