/* ============================================================
   FEODAL WEB — дизайн-система как точная копия Android-клиента
   Палитра: app/src/main/res/values/colors.xml (полные #RRGGBB)
   Стили:   styles.xml (FeodalButton и др.)
   Формы:   app/src/main/res/drawable/bg_*.xml
   ============================================================ */
:root {
    /* --- colors.xml: серые / тема --- */
    --gray-500: #616161;
    --gray-700: #424242;
    --gray-200: #EEEEEE;
    --teal-200: #03DAC5;
    --teal-700: #018786;
    --black: #000000;
    --white: #FFFFFF;
    --red: #FF0000;

    /* --- новости --- */
    --news-bg: #282828;
    --news-header-bg: #282828;
    --news-accent-blue: #2196F3;
    --article-blue-stroke: #1565C0;
    --news-positive-green: #4CAF50;
    --news-text-secondary: #B0B0B0;
    --news-filter-bg: #3A3A3A;
    --red-progress: #E53935;
    --news-divider: #333333;
    --news-fab-green: #4CAF50;

    /* --- нижняя навигация --- */
    --nav-panel-frame: #3D3D3D;
    --nav-bottom-bg: #2A2A2A;
    --nav-divider: #50505050;

    /* --- боевой отчёт --- */
    --battle-report-bg: #5A5A5A;
    --battle-report-section: #404040;

    /* --- кланы --- */
    --clan-bg: #1E1E1E;
    --clan-card-bg: #282828;
    --clan-surface: #2D2D2D;
    --clan-btn-green: #4CAF50;
    --clan-btn-blue: #2196F3;
    --gold: #FFD700;
    --gold-value: #FFD54F;
    --clan-text-secondary: #B0B0B0;
    --clan-tab-bg: #3A3A3A;
    --clan-avatar-bg: #404040;
    --clan-edit-bg: #252525;
    --clan-edit-danger: #D32F2F;

    /* --- дипломатия --- */
    --diplomacy-vassal: #E65100;
    --diplomacy-ally: #4CAF50;
    --diplomacy-nap: #90A4AE;
    --diplomacy-neutral: #37474F;
    --diplomacy-opponents: #F44336;

    /* --- парламент --- */
    --parliament-chamber: #1A1A2E;
    --parliament-seat-stroke: #4A4A6A;
    --parliament-podium: #16213E;
    --parliament-card: #2D2D44;
    --parliament-accent: #3949AB;
    --parliament-section-title: #E8EAF6;
    --parliament-bill-voting: #3949AB;
    --parliament-bill-passed: #2E7D32;
    --parliament-bill-rejected: #C62828;
    --parliament-btn-positive: #4CAF50;
    --parliament-btn-negative: #F44336;

    /* --- государство --- */
    --state-card-bg: #E8E8E8;
    --state-card-text-primary: #212121;
    --state-card-text-secondary: #757575;

    /* --- исследования / миссии / ресурсы --- */
    --research-card-bg: #2D2D2D;
    --missions-accent-gold: #D4A017;
    --missions-accent-green: #4CAF50;
    --ore-color: #9E9E9E;

    /* --- панели/карточки --- */
    --panel-dark-blue: #1A3A5C;
    --panel-dark-blue-80: #CC1A3A5C;
    --panel-dark-blue-purple: #2A2A4A;
    --castle-card-bg: #1A2A4A;
    --army-card-bg: #1A1A1A;
    --army-row-bg: #353535;
    --army-text-tertiary: #888888;
    --text-gray: #808080;

    /* --- кнопки --- */
    --btn-vk-blue: #0077FF;
    --btn-orange: #FF9800;
    --btn-goldenrod: #B8860B;

    /* --- медали --- */
    --medal-gold: #FFD700;
    --medal-gold-stroke: #B8860B;
    --medal-row-owned-bg: #3A3A3A;

    /* --- дополнительные Android-цвета --- */
    --btn-danger-bg: #8B0000;
    --btn-danger-stroke: #FF4444;
    --summary-plaque: #8F97A1;
    --badge-bg: #3D3D3D;
    --badge-stroke: #FFD700;
    --upgrade-timer-bg: #252525;
    --scrim-50: #80000000;
    --scrim-60: #99000000;
    --scrim-20: #33000000;
    --scrim-13: #22000000;
    --near-black-80: #CC0F0F0F;

    /* --- радиусы (bg_*.xml) --- */
    --radius-btn: 12px;      /* bg_parliament_btn_* */
    --radius-card: 10px;     /* bg_unit_card */
    --radius-plaque: 12px;   /* bg_summary_plaque_light */
    --radius-region: 8px;    /* bg_region */
    --radius-timer: 8px;     /* bg_upgrade_timer */
    --radius-block: 8px;     /* bg_profile_block */
    --radius-badge: 16px;    /* bg_badge_red */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--news-bg);
    color: #fff;
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

.screen {
    flex: 1;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding-bottom: 70px;
    position: relative;
}
.screen.cv-bg { background: var(--gray-700); } /* colorPrimaryVariant */

/* ==================== Кнопки (FeodalButton / bg_parliament_btn_*) ==================== */
button { font-family: inherit; cursor: pointer; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--parliament-card);      /* bg_parliament_btn_secondary */
    border: 1px solid var(--parliament-seat-stroke);
    color: #fff;
    font-size: 14px;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: var(--radius-btn);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
    transition: filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { filter: brightness(.9); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.small { min-height: 28px; font-size: 13px; padding: 4px 10px; border-radius: var(--radius-sm, 8px); }

.btn-primary { background: var(--parliament-accent); border-color: transparent; }  /* bg_parliament_btn_primary */
.btn-green { background: var(--clan-btn-green); border-color: transparent; }
.btn-blue { background: var(--clan-btn-blue); border-color: transparent; }
.btn-red { background: var(--btn-danger-bg); border-color: var(--btn-danger-stroke); } /* bg_parliament_btn_danger */
.btn-gold { background: var(--missions-accent-gold); border-color: transparent; color: #1E1E1E; font-weight: 600; }
.btn-teal { background: var(--teal-700); border-color: transparent; }
.btn-vk { background: #2787F5; border-color: transparent; }
.btn-google { background: #ffffff; border-color: #dadce0; color: #1f1f1f; }

/* Кнопка «Назад» в стиле Android (FeodalButton, inline, со стрелкой) */
.btn-back-android {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--parliament-card);
    border: 1px solid var(--parliament-seat-stroke);
    color: #fff;
    font-size: 14px;
    min-height: 36px;
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}
.btn-back-android:hover { filter: brightness(1.15); }

/* Кнопка-иконка «справка» (ImageButton 44dp ic_info) */
.help-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: .9;
}
.help-btn img { width: 28px; height: 28px; }
.help-btn:hover { opacity: 1; }

/* ==================== Карточки (bg_unit_card) ==================== */
.panel, .card {
    background: linear-gradient(180deg, #3A3A3A 0%, #333333 50%, #2A2A2A 100%);
    border-radius: var(--radius-card);
    padding: 12px;
    margin: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.panel.blue { background: var(--castle-card-bg); }
.panel.dark { background: var(--army-card-bg); }
.panel.parliament { background: var(--parliament-card); border-radius: var(--radius-btn); }

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--parliament-section-title);
    padding: 12px 12px 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.card {
    padding: 10px 12px;
    margin: 8px 10px;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { background: linear-gradient(180deg, #434343 0%, #3B3B3B 50%, #333333 100%); }

/* Светлая плашка-суммарий (bg_summary_plaque_light) */
.summary-plaque {
    background: var(--summary-plaque);
    border-radius: var(--radius-plaque);
    padding: 12px;
    margin: 0 10px 10px;
    color: #282828;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.summary-plaque .text-secondary { color: rgba(40, 40, 40, .75); }
.summary-plaque .text-tertiary { color: rgba(40, 40, 40, .6); }

/* Полупрозрачная карточка региона (bg_region) */
.region-card {
    background: var(--scrim-50);
    border-radius: var(--radius-region);
    padding: 6px;
    margin-bottom: 6px;
    overflow: hidden;
}

/* Таймер улучшения (bg_upgrade_timer) */
.timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--upgrade-timer-bg);
    border-radius: var(--radius-timer);
    padding: 10px 12px;
    color: var(--teal-200);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
}
.timer img { width: 20px; height: 20px; flex-shrink: 0; }

/* ==================== Новости: шапка + вкладки (fragment_news.xml) ==================== */
.news-head {
    background: var(--news-header-bg);
    border-bottom: 2px solid rgba(255, 213, 79, .6); /* clan_value_gold alpha .6 (buy_gold) */
}
.news-headbar {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 4px 0 0;
}
.news-headbar .head-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.news-headbar .head-btn img { width: 24px; height: 24px; }
.news-headbar .head-title {
    flex: 1;
    text-align: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}
.news-headbar .head-spacer { width: 48px; flex-shrink: 0; }

/* Вкладки новостей (bg_news_tab_underline) */
.ntabs {
    display: flex;
    background: var(--news-header-bg);
    height: 44px;
    padding-top: 4px;
}
.ntab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--news-text-secondary);
    font-size: 12px;
    padding: 0;
    position: relative;
    cursor: pointer;
}
.ntab.active { color: #fff; }
.ntab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--news-accent-blue);
    display: none;
}
.ntab.active::after { display: block; }

/* Кнопка «Мир» (bg_parliament_btn_secondary) */
.btn-world {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parliament-card);
    border: 1px solid var(--parliament-seat-stroke);
    color: #fff;
    font-size: 14px;
    min-height: 32px;
    padding: 5px 12px;
    margin: 4px 12px;
    border-radius: var(--radius-btn);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
    cursor: pointer;
}
.btn-world:hover { filter: brightness(1.15); }

/* ==================== Карточка исследования (bg_mission_card) ==================== */
.research-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2A2A2A;
    border: 2px solid var(--teal-200);
    border-radius: 12px;
    padding: 8px 12px 8px 10px;
    margin: 0 10px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.research-ico { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* Кнопка действия миссии/исследования (bg_mission_btn, purple_500) */
.mission-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #6200EE;
    color: #fff;
    font-size: 12px;
    min-height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}
.mission-btn:hover { filter: brightness(1.15); }
.mission-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==================== Пак магазина (bg_upgrade_timer + item_shop_pack.xml) ==================== */
.shop-pack {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--upgrade-timer-bg);
    border-radius: var(--radius-timer);
    padding: 14px;
    margin: 0 12px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.shop-ico { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.shop-section {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    padding: 28px 12px 14px;
}

/* ==================== Профиль (bg_profile_block = news_divider) ==================== */
.profile-main {
    background: var(--news-divider);
    border-radius: var(--radius-block);
    padding: 16px;
    margin: 0 12px 8px;
}
.profile-block {
    background: var(--news-divider);
    border-radius: var(--radius-block);
    padding: 6px;
    margin: 0 12px 8px;
}
.profile-row {
    display: flex;
    align-items: center;
    min-height: 28px;
    gap: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}
.profile-row:hover { background: rgba(255, 255, 255, .05); }
.coat {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--news-filter-bg);
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}
.avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 6px;
    background: var(--news-divider);
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-ph-lg {
    width: 96px;
    height: 96px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--news-divider);
    color: #fff;
    font-size: 40px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Кнопка «Приобрести золото» (в профиле, с выходом на поля) */
.btn-buy-gold {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parliament-card);
    border: 1px solid var(--parliament-seat-stroke);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    min-height: 44px;
    padding: 10px 12px;
    margin: 0 0 6px;
    width: calc(100% + 24px);
    margin-left: -12px;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
    cursor: pointer;
}
.btn-buy-gold:hover { filter: brightness(1.15); }

/* Прогресс уровня (level_progress_drawable) */
.level-progress {
    height: 8px;
    background: rgba(255, 255, 255, .2);
    border-radius: 4px;
    overflow: hidden;
    flex: 1;
}
.level-progress > div {
    height: 100%;
    background: #FFC107;
    border-radius: 4px;
}
.info-q {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #44FFFFFF;
    border: 1px solid #88FFFFFF;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
}

/* ==================== Перелёты (fragment_travel.xml) ==================== */
.travel-loc {
    background: linear-gradient(180deg, #3A3A3A 0%, #333333 50%, #2A2A2A 100%);
    border-radius: var(--radius-card);
    padding: 12px;
    margin: 8px 10px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.travel-label {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 16px 10px 0;
}
.emerg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--upgrade-timer-bg);
    border-radius: var(--radius-timer);
    padding: 8px;
    margin: 8px 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.emerg-row .lbl { flex: 1; font-size: 14px; color: #fff; }
.emerg-check {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
}
.emerg-check img { width: 32px; height: 32px; display: block; }

/* ==================== Навигация ==================== */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }

.text-secondary { color: var(--clan-text-secondary); }
.text-tertiary { color: var(--army-text-tertiary); }
.text-gold { color: var(--gold-value); }
.text-green { color: var(--news-positive-green); }
.text-red { color: var(--parliament-btn-negative); }
.text-blue { color: var(--news-accent-blue); }
.text-teal { color: var(--teal-200); }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.text-bold { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.divider { height: 1px; background: var(--news-divider); margin: 8px 10px; }

/* ==================== Формы ==================== */
.input, select.input, textarea.input {
    width: 100%;
    background: var(--news-filter-bg);
    border: 1px solid var(--nav-panel-frame);
    color: #fff;
    border-radius: var(--radius-block);
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.input:focus { border-color: var(--teal-200); }
.input::placeholder { color: var(--text-gray); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--clan-text-secondary); margin-bottom: 5px; }

/* ==================== Шапка ресурсов ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--gray-700);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--news-divider);
}
.res-bar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; flex: 1; }
.res-item { font-size: 13px; white-space: nowrap; display: flex; align-items: center; gap: 3px; }
.res-item .ico { opacity: .9; }
.res-item .val { font-weight: 600; }
.res-item .res-ico { width: 18px; height: 18px; object-fit: contain; }
.res-ico { width: 16px; height: 16px; object-fit: contain; vertical-align: -2px; }
.topbar .btn-back { background: transparent; border: none; font-size: 20px; padding: 2px 6px; color: #fff; }

/* ==================== Нижняя навигация (include_bottom_nav.xml) ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bottom-bg);
}
.bottom-nav.hidden { display: none; }
.nav-divider { height: 4px; background: linear-gradient(270deg, #555555, #404040, var(--nav-bottom-bg)); }
.nav-buttons { display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.nav-btn img { width: auto; height: 34px; object-fit: contain; opacity: .85; }
.nav-btn.active img { opacity: 1; filter: drop-shadow(0 0 4px rgba(3, 218, 197, .55)); }
.nav-btn:hover img { opacity: 1; }
.nav-badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 9px);
    background: var(--badge-bg);            /* bg_badge_red */
    border: 1px solid var(--badge-stroke);
    border-radius: var(--radius-badge);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.hidden { display: none !important; }

/* ==================== Табы ==================== */
.tabs { display: flex; background: var(--clan-tab-bg); border-radius: var(--radius-block); margin: 10px; overflow: hidden; }
.tabs .tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--clan-text-secondary);
    padding: 10px 4px;
    font-size: 13px;
    white-space: nowrap;
}
.tabs .tab.active { color: #fff; background: var(--news-filter-bg); font-weight: 600; border-bottom: 2px solid var(--teal-200); }

/* ==================== Списки (item_building / list) ==================== */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--news-divider); }
.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--clan-surface); }

/* ==================== Загрузка / пусто ==================== */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--news-filter-bg);
    border-top-color: var(--teal-200);
    border-radius: 50%;
    margin: 40px auto;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; color: var(--clan-text-secondary); padding: 40px 20px; font-size: 14px; }

/* ==================== Тосты ==================== */
.toast-container { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 400px); }
.toast {
    background: #3D3D3D;
    color: #fff;
    border: 1px solid var(--nav-panel-frame);
    border-radius: var(--radius-block);
    padding: 10px 14px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
    animation: toast-in .2s ease-out;
}
.toast.success { border-color: var(--news-positive-green); }
.toast.error { border-color: var(--parliament-btn-negative); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== Модалка ==================== */
.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal-scrim { position: absolute; inset: 0; background: var(--scrim-60); }
.modal-box {
    position: relative;
    background: var(--clan-card-bg);
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    overflow-y: auto;
    border-radius: var(--radius-btn) var(--radius-btn) 0 0;
    padding: 16px;
    border: 1px solid var(--nav-panel-frame);
    border-bottom: none;
    animation: modal-in .2s ease-out;
}
@keyframes modal-in { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ==================== Прогресс ==================== */
.progress { height: 8px; background: rgba(255, 255, 255, .2); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: #FFC107; border-radius: 4px; transition: width .3s; }

/* ==================== Аватар ==================== */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--clan-avatar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .ph { font-size: 18px; color: #fff; }

/* ==================== Чипы ==================== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--news-filter-bg);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    color: #fff;
    border: 1px solid var(--nav-panel-frame);
}
.chip.green { background: rgba(76, 175, 80, .18); border-color: var(--news-positive-green); color: var(--news-positive-green); }
.chip.red { background: rgba(244, 67, 54, .18); border-color: var(--parliament-btn-negative); color: #ff8a80; }
.chip.blue { background: rgba(33, 150, 243, .18); border-color: var(--news-accent-blue); color: var(--news-accent-blue); }
.chip.gold { background: rgba(255, 215, 0, .15); border-color: var(--missions-accent-gold); color: var(--gold-value); }
.chip.orange { background: rgba(255, 152, 0, .15); border-color: var(--btn-orange); color: #ffb74d; }

/* ==================== Карта ==================== */
.map-frame {
    width: 100%;
    height: calc(100vh - 190px);
    min-height: 300px;
    border: none;
    background: var(--panel-dark-blue);
    display: block;
}

/* ==================== Экраны ==================== */
.screen-title { padding: 14px 12px 4px; font-size: 18px; font-weight: 700; }

.list-title { padding: 10px 12px 2px; font-size: 14px; font-weight: 600; color: var(--parliament-section-title); text-transform: uppercase; letter-spacing: .3px; }

.badge-num { background: var(--parliament-accent); color: #fff; font-size: 11px; border-radius: 9px; padding: 1px 6px; font-weight: 600; }

/* Сетка ресурсов */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Юниты */
.unit-cell { background: var(--army-row-bg); border-radius: var(--radius-block); padding: 8px; display: flex; flex-direction: column; gap: 2px; }

/* Чат */
.chat-scroll { height: calc(100vh - 200px); overflow-y: auto; padding: 10px; }
.chat-input-bar { display: flex; gap: 8px; padding: 8px 10px; position: sticky; bottom: 70px; background: var(--news-bg); }

/* Новости */
.news-header { background: var(--news-header-bg); padding: 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--news-divider); }
.news-item { padding: 12px; border-bottom: 1px solid var(--news-divider); }
.news-item .news-title { font-size: 16px; font-weight: 700; color: var(--news-accent-blue); margin-bottom: 4px; }

/* Таблица */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--news-divider); text-align: left; }
table.tbl th { color: var(--clan-text-secondary); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .3px; }

/* Флаг/нация */
.flag-emoji { font-size: 22px; }

/* ==================== Экран «Замок» (fragment_castle_tab.xml) ==================== */
.castle-wrap { position: relative; margin: 0; }
.castle-wrap img.castle-img {
    width: 100%;
    height: auto;
    display: block;
}
/* Зоны касания построек: left/top = проценты constraint-guideline,
   размер = dp в расчёте на дизайн-ширину 360dp (1dp = 100%/360). */
.hotspot {
    position: absolute;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 6px;
}
.hotspot:hover { background: rgba(3, 218, 197, .18); }
.hotspot:active { background: rgba(3, 218, 197, .3); }

/* ==================== Сводка замков (fragment_castles_summary.xml) ==================== */
.cv-scroll { padding: 16px; }
.cv-label { color: var(--news-text-secondary); font-size: 14px; font-weight: 700; }
.cv-sum-grid { display: flex; margin-top: 8px; }
.cv-sum-cell { flex: 1; text-align: center; }
.cv-sum-cell img { width: 20px; height: 20px; object-fit: contain; }
.cv-sum-cell div { margin-top: 2px; font-size: 12px; color: var(--news-header-bg); }
.cv-unit-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; color: var(--news-header-bg); }
.cv-unit-row img { width: 22px; height: 22px; object-fit: contain; }
.cv-unit-row .nm { flex: 1; }
.cv-unit-row .vl { font-weight: 700; }
.cv-castle-head { display: flex; align-items: center; gap: 8px; }
.cv-castle-head .nm { flex: 1; font-size: 15px; font-weight: 700; color: var(--news-header-bg); }
.btn-open {
    background: var(--summary-plaque);
    border: none;
    color: var(--news-header-bg);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-plaque);
    cursor: pointer;
}
.btn-open:hover { filter: brightness(1.08); }

/* ==================== Список построек (item_building.xml) ==================== */
.building-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px;
    margin-bottom: 6px;
    background: var(--scrim-50);
    border-radius: var(--radius-region);
    overflow: hidden;
    cursor: pointer;
}
.building-item:hover { background: rgba(0, 0, 0, .62); }
.building-item .ico { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.building-item .info { flex: 1; min-width: 0; }
.building-item .nm { color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.building-item .lv { color: var(--teal-200); font-size: 14px; margin-top: 2px; }
.building-item .tm { color: var(--teal-200); font-size: 12px; }
.building-item .btn-hammer {
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .9;
}
.building-item .btn-hammer img { width: 28px; height: 28px; }
.building-item .btn-hammer:hover { opacity: 1; filter: brightness(1.2); }
.building-item .btn-speed {
    background: var(--parliament-card);
    border: 1px solid var(--parliament-seat-stroke);
    color: #fff;
    font-size: 12px;
    min-height: 40px;
    padding: 4px 10px;
    border-radius: var(--radius-btn);
    white-space: nowrap;
}
.building-item .lock-note { width: 96px; font-size: 9px; color: #999; text-align: center; margin-top: 4px; line-height: 1.2; }

/* ==================== Строка ресурса с иконкой (деталь здания) ==================== */
.res-line {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
}
.res-line img { width: 14px; height: 14px; object-fit: contain; }
.res-line .val { color: #fff; font-size: 14px; font-weight: 700; margin-left: auto; min-width: 32px; text-align: right; }
.res-line .lbl { color: var(--news-text-secondary); font-size: 14px; flex: 1; }

/* Шапка детали здания (item: изображение 120dp + имя 22sp) */
.building-header { display: flex; align-items: center; gap: 16px; }
.building-header img { width: 120px; height: 120px; object-fit: contain; flex-shrink: 0; }
.building-header .name { font-size: 22px; font-weight: 700; color: #fff; }
.building-header .desc { margin-top: 8px; font-size: 14px; line-height: 1.2; color: #fff; }

/* Панель-карточка с разделителями строк (как bg_unit_card + nav_bottom_divider) */
.metric-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
}
.metric-row .lbl { flex: 1; color: var(--news-text-secondary); font-size: 14px; }
.metric-row .val { color: #fff; font-weight: 700; text-align: right; min-width: 48px; }
.metric-row .val.teal { color: var(--teal-200); }

/* Иконка юнита */
.unit-ico { width: 22px; height: 22px; object-fit: contain; vertical-align: -3px; }

/* ==================== Профиль (по образцу Android) ==================== */
.pf-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--news-bg);
    border-radius: var(--radius-block);
}
.pf-ava {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--clan-avatar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.pf-ava img { width: 100%; height: 100%; object-fit: cover; }
.pf-ava .ph { font-size: 24px; color: #fff; font-weight: 700; }
.pf-nick {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.pf-edit {
    font-size: 15px;
    cursor: pointer;
    opacity: .85;
}
.pf-edit:hover { opacity: 1; }
.pf-gold {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 213, 79, .08);
    flex-shrink: 0;
}
.pf-gold.clickable { cursor: pointer; }
.pf-gold.clickable:hover { background: rgba(255, 213, 79, .16); }

/* Меню профиля */
.pf-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 88vw;
    background: var(--news-bg);
    padding: 56px 12px 24px;
    overflow-y: auto;
    border-left: 1px solid var(--news-divider);
}
.pf-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 10px;
    font-size: 16px;
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
}
.pf-menu-item:hover { background: var(--news-filter-bg); }
.pf-menu-danger { color: #F44336; }
.pf-menu-danger:hover { background: rgba(244, 67, 54, .1); }

/* Карточка перелёта */
.pf-travel {
    border: 1px solid var(--news-accent-blue);
    background: rgba(33, 150, 243, .06);
}
.clickable { cursor: pointer; }

/* Сетка выбора аватара */
.pf-ava-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.pf-ava-option {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--news-divider);
}
.pf-ava-option:hover { border-color: var(--news-accent-blue); }
