/* Responsive Design — Neftaria
 * İki çalışma modu:
 *   <html.view-mode-desktop> → masaüstü (varsayılan, 1280px+ tasarım)
 *   <html.view-mode-mobile>  → mobil layout (drawer sidebar, full-screen modal, dokunmatik butonlar)
 *
 * Mobil class'ı KULLANICI seçimine bağlıdır (lobby'de checkbox) — sadece ekran genişliğine değil.
 */

:root {
    --mobile: 480px;
    --tablet: 768px;
    --desktop: 1024px;
    --wide: 1440px;
}

/* ===== ORTAK ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.carousel-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gh-res-icon,
.gh-currency-icon {
    max-width: 100%;
    height: auto;
}

/* ============================================================
   MOBİL GÖRÜNÜM — Travian-tarzı düzen
   Header: sadece kaynaklar + progress bar (logo yok)
   Hero: sol üst (header altında)
   Battle panel: sağ üst (header altında, otomatik)
   İnşaat: alt bar (nav bar üstünde)
   ============================================================ */

/* ── Temel layout ── */
.view-mode-mobile body.game-mode {
    overflow: hidden !important;
    height: 100dvh !important;
    height: 100vh !important;
}

.view-mode-mobile .game-wrapper {
    position: fixed !important;
    inset: 0 !important;
    overflow: hidden !important;
}

.view-mode-mobile #scale-container,
.view-mode-mobile .scale-container {
    transform: none !important;
    margin: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    position: relative !important;
    overflow: visible !important;
    transition: none !important;
}

/* ── KÖY ALANI ── */
.view-mode-mobile .gm {
    position: absolute !important;
    inset: 0 !important;
    overflow: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    /* background-attachment: local → arka plan içerikle birlikte kayar */
    background-attachment: local !important;
    background-size: 1920px auto !important;
    background-position: 0 0 !important;
}

.view-mode-mobile .gm-canvas {
    width: 1920px !important;
    min-height: 1080px !important;
    height: auto !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none !important;
}

/* ══════════════════════════════════════════════════════════
   MOBILE HEADER - Clean rewrite.
   Layout: 44px beige bar (closed) → 88px dark bar (open)
   Inside beige: icon+amount vertically centered, bar below.
   Inside dark: hourly production + capacity icons.
══════════════════════════════════════════════════════════ */

/* Remove body scrollbar on mobile - game scrolls via touch/canvas */
.view-mode-mobile body {
    overflow: hidden !important;
}

.view-mode-mobile header.gh-marble-strip {
    position: fixed !important;
    /* Override game.css position:absolute */
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    /* Override game.css width:1920px */
    height: 44px !important;
    background-color: transparent !important;
    border: none !important;
    /* No manual borders - ::before handles it */
    box-shadow: none !important;
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
    /* Override game.css padding:0 100px */
    gap: 0 !important;
    z-index: 13000 !important;
    /* Above game.css z-index:12000 */
    overflow: hidden !important;
    flex-wrap: nowrap !important;
    transition: height 0.3s ease, background-color 0.3s ease !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    pointer-events: auto !important;
    /* Override game.css pointer-events:none */
}

/* Match ::before height to the 44px mobile header
   so BOTH top and bottom decorative stripes from headerbar.webp are visible */
.view-mode-mobile header.gh-marble-strip::before {
    height: 44px !important;
    border-width: 6px 0 6px 0 !important;
    /* Tighter borders for 44px */
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
}

/* Open state: extra room below for hourly+capacity */
.view-mode-mobile header.gh-marble-strip.dock-open {
    height: 88px !important;
    background-color: #f4f4ce !important;
    /* Beige theme */
    background-image: none !important;
    border-bottom: 2px solid rgba(139, 95, 40, 0.4) !important;
}

/* ── Center section (resource banner container) ── */
.view-mode-mobile .gh-section-l {
    display: none !important;
}

.view-mode-mobile .gh-section-c {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    height: 100% !important;
}

.view-mode-mobile .gh-resource-banner {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    background: none !important;
    box-shadow: none !important;
    gap: 0 !important;
    /* Override game.css desktop min-width */
    min-height: unset !important;
    align-self: unset !important;
    margin-top: 0 !important;
}

/* Override game.css ::before pseudo-element on banner (desktop frame) */
.view-mode-mobile .gh-resource-banner::before {
    display: none !important;
}

/* ── Resource Groups ── */
.view-mode-mobile .gh-res-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    min-width: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    gap: 0 !important;
}

.view-mode-mobile .gh-res-group:nth-child(1) {
    flex: 3 !important;
}

.view-mode-mobile .gh-res-group:nth-child(3) {
    flex: 1 !important;
}

.view-mode-mobile .gh-res-group:nth-child(5) {
    flex: 1 !important;
}

/* Hide the separate capacity row items */
.view-mode-mobile .gh-res-item[data-tooltip-bottom="Depo Kapasitesi"],
.view-mode-mobile .gh-res-item[data-tooltip-bottom="Silo Kapasitesi"],
.view-mode-mobile .gh-res-item[data-tooltip-bottom="Neft Deposu Kapasitesi"] {
    display: none !important;
}

.view-mode-mobile .gh-thin-sep,
.view-mode-mobile .gh-separator {
    display: none !important;
}

/* ── Each resource cell ── */
.view-mode-mobile .gh-res-item {
    /* Override game.css display:grid */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    /* ← THIS centers icon+amount in the beige bar */
    flex: 1 !important;
    min-width: 0 !important;
    height: 44px !important;
    /* Matches the closed header height */
    padding: 0 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.2) !important;
    background: transparent !important;
    border-radius: 0 !important;
    position: relative !important;
    overflow: visible !important;
    gap: 0 !important;
}

.view-mode-mobile .gh-res-group:last-child .gh-res-item:last-child {
    border-right: none !important;
}

/* ── Icon + Amount row (lives inside flex column, auto-centered) ── */
.view-mode-mobile .gh-res-row {
    display: flex !important;
    position: static !important;
    /* No absolute - let flex column center it */
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.view-mode-mobile .gh-res-icon {
    width: 13px !important;
    height: 13px !important;
    margin-right: 2px !important;
    flex-shrink: 0 !important;
    display: block !important;
    transform: translateY(1px) !important; /* İkonu biraz aşağı alarak yazıyla hizala */
}

.view-mode-mobile .gh-res-amount {
    font-size: 0.6rem !important;
    font-weight: bold !important;
    color: #1a1107 !important;
    text-shadow: none !important;
    display: block !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

/* ── Progress bar: sits right under the row ── */
.view-mode-mobile .gh-res-bar {
    width: 85% !important;
    height: 3px !important;
    margin-top: 3px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border-radius: 2px !important;
    overflow: hidden !important;
    display: block !important;
    /* Override game.css if it uses grid-column */
    grid-column: unset !important;
    grid-row: unset !important;
}

.view-mode-mobile .gh-res-fill {
    height: 100% !important;
    border-radius: 2px !important;
    display: block !important;
    /* NO !important here - JS sets inline background-color for red/orange when full */
    background-color: #7bb929;
}

/* ── Dropdown info: hourly production ──
   KEY FIX: display:none (not opacity:0) so it NEVER takes up
   flex space in the closed state, keeping icon+amount centered. */
.view-mode-mobile .gh-res-hourly {
    display: none !important;
    /* Out of flex flow completely */
    position: absolute !important;
    top: 48px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 0.55rem !important;
    color: #2e662e !important;
    /* Darker green for beige background */
    font-weight: 800 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

/* ── Dropdown info: capacity via ::after ── */
.view-mode-mobile .gh-res-item[data-cap]::after {
    content: attr(data-cap) !important;
    display: none !important;
    /* Hidden when closed */
    position: absolute !important;
    top: 66px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    white-space: nowrap !important;
    font-size: 0.5rem !important;
    font-weight: 700 !important;
    color: #1a1107 !important; /* Siyah/koyu kahve */
    padding-left: 13px !important;
    background-size: 10px 10px !important;
    background-repeat: no-repeat !important;
    background-position: left 55% !important; /* İkonu hafif aşağı kaydır */
    pointer-events: none !important;
}

.view-mode-mobile .gh-res-group:nth-child(1) .gh-res-item[data-cap]::after {
    background-image: url('/images/ui/resources/warehouse.webp') !important;
}

.view-mode-mobile .gh-res-group:nth-child(3) .gh-res-item[data-cap]::after {
    background-image: url('/images/ui/resources/granary.webp') !important;
}

.view-mode-mobile .gh-res-group:nth-child(5) .gh-res-item[data-cap]::after {
    background-image: url('/images/ui/resources/naphtha_well.webp') !important;
}

/* Show dropdown content when open */
.view-mode-mobile header.gh-marble-strip.dock-open .gh-res-hourly,
.view-mode-mobile header.gh-marble-strip.dock-open .gh-res-item[data-cap]::after {
    display: block !important;
}

/* Right Section: Gold & Burger */
.view-mode-mobile .gh-section-r {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 4px !important;
    flex-shrink: 0 !important;
    height: 44px !important;
    /* Match closed header height */
    margin-top: 0 !important;
    position: relative !important;
}

.view-mode-mobile .gh-action-group-frame {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    height: 100% !important;
    margin: 0 !important;
}

.view-mode-mobile .gh-currency {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

.view-mode-mobile .gh-currency-col {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

.view-mode-mobile .gh-currency-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: 0 !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    height: 100% !important;
    position: relative !important;
    /* Anchor for absolute value */
}

.view-mode-mobile .gh-currency-icon {
    position: static !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
}

.view-mode-mobile .gh-currency-value {
    display: none !important;
    /* Hidden when closed */
    position: absolute !important;
    top: 57px !important; /* Dropdown içinde dikey ortalama */
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 0.6rem !important;
    font-weight: bold !important;
    color: #1a1107 !important; /* Siyah/koyu kahve */
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

/* Gold icon prepended in dropdown */
.view-mode-mobile .gh-currency-value::before {
    content: "" !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important; /* Flex içinde kaybolmasını engelle */
    transform: translateY(1px) !important; /* İkonu yazıyla hizala */
    background-image: url('/images/ui/money/gold.webp') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.view-mode-mobile header.gh-marble-strip.dock-open .gh-currency-value {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
}

.view-mode-mobile .gh-actions {
    display: none !important;
}

.view-mode-mobile .gh-mobile-burger {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    background: linear-gradient(180deg, #f3e5c8 0%, #e1cd9f 100%) !important;
    border: 1px solid #b79c6d !important;
    border-radius: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #634b2e !important;
    font-size: 20px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.view-mode-mobile header.gh-marble-strip::after,
.view-mode-mobile .gh-resource-banner::before {
    display: none !important;
}

/* Deleted duplicate header code */
.view-mode-mobile .gh-section-l {
    display: none !important;
}

.view-mode-mobile #gh-resource-banner {
    opacity: 1 !important;
}

.view-mode-mobile .gh-separator,
.view-mode-mobile .gh-thin-sep {
    display: none !important;
}
}

.view-mode-desktop .gh-mobile-burger {
    display: none !important;
}

/* Mobil action menüsü */
.view-mode-mobile .gh-mobile-menu {
    position: fixed !important;
    top: 44px !important;
    right: 0 !important;

    /* BEIGE THEME */
    background-color: #f4f4ce !important;
    background-image: none !important;
    border-style: solid !important;
    border-width: 0 0 16px 16px !important;
    /* Bottom and left borders */
    border-image-source: url('/images/ui/frame/frame.webp') !important;
    border-image-slice: 18% !important;
    border-image-repeat: stretch stretch !important;

    border-radius: 0 !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    z-index: 13001 !important;
    min-width: 140px !important;
    transform: translateX(110%) !important;
    transition: transform 0.2s ease !important;
}

.view-mode-mobile .gh-mobile-menu.menu-open {
    transform: translateX(0) !important;
}

.view-mode-mobile .gh-mob-action {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 4px !important;
    color: #4a3b2c !important;
    /* Dark text for beige bg */
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    border-bottom: 1px solid rgba(139, 95, 40, 0.12) !important;
}

.view-mode-mobile .gh-mob-action:last-child {
    border-bottom: none !important;
}

.view-mode-mobile .gh-mob-action:hover {
    background: rgba(200, 155, 80, 0.15) !important;
}

.view-mode-mobile .gh-mob-action img {
    width: 20px !important;
    height: 20px !important;
}

.view-mode-desktop .gh-mobile-menu {
    display: none !important;
}

/* ── HERO MADALYON: sol üst, header altında ── */
.view-mode-mobile .gh-hero-medallion {
    position: fixed !important;
    top: 48px !important;
    left: 8px !important;
    bottom: auto !important;
    right: auto !important;
    width: 64px !important;
    height: 64px !important;
    z-index: 11300 !important;
    cursor: pointer !important;
    padding: 3px !important;
}

/* Harita sayfasında kahraman portresi gizli — haritanın önünü kapatmasın */
.view-mode-mobile body[data-page="map"] .gh-hero-medallion {
    display: none !important;
}

.view-mode-mobile .gh-hero-center {
    width: 54px !important;
    height: 54px !important;
    padding: 3px !important;
}

.view-mode-mobile .gh-hero-avatar {
    width: 44px !important;
    height: 44px !important;
    border-width: 1px !important;
}

.view-mode-mobile .gh-hero-status-badge {
    width: 28px !important;
    height: 28px !important;
    bottom: -10px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

.view-mode-mobile .gh-hero-status-badge-star {
    width: 14px !important;
    height: 14px !important;
}

/* ── BATTLE PANEL: sağ üst, header altında ── */
.view-mode-mobile #battle-panel,
.view-mode-mobile .battle-panel {
    position: fixed !important;
    top: 48px !important;
    right: 8px !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: calc(100vw - 90px) !important;
    z-index: 11500 !important;
    border-radius: 6px !important;
    transform: none !important;
}

.view-mode-mobile .battle-panel-content {
    gap: 3px !important;
    padding: 5px 8px !important;
}

.view-mode-mobile .battle-item {
    padding: 3px 6px !important;
    font-size: 0.7rem !important;
    gap: 5px !important;
}

.view-mode-mobile .battle-arrival {
    font-size: 0.68rem !important;
}

/* ── İNŞAAT PANELİ: köy bar + nav bar üstünde ── */
.view-mode-mobile .gn-construction-panel {
    position: fixed !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    /* 54px nav + 34px vbar */
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transform: none !important;
    border-radius: 0 !important;
    /* neft-frame çerçevesi kaldırıldığı için arka planı da kendimiz veriyoruz;
       aksi halde liste alanında beyaz boşluklar görünüyor */
    border-image: none !important;
    border: none !important;
    border-top: 2px solid var(--accent-gold, #c9a24b) !important;
    background: #f4f4ce !important;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.35) !important;
    padding: 0 !important;
    z-index: 11800 !important;
}

/* Liste alanı da bej — hiç şeffaf/beyaz boşluk kalmasın */
.view-mode-mobile .gn-construction-panel .gn-cq-list {
    background: #f4f4ce !important;
}

.view-mode-mobile .gn-construction-panel.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(8px) !important;
}

.view-mode-mobile .gn-cq-header {
    padding: 5px 10px !important;
    font-size: 0.7rem !important;
    border-radius: 0 !important;
}

.view-mode-mobile .gn-cq-complete-btn {
    padding: 3px 8px !important;
    font-size: 0.62rem !important;
    min-width: unset !important;
}

.view-mode-mobile .gn-cq-list {
    max-height: 72px !important;
    overflow-y: auto !important;
}

.view-mode-mobile .gn-cq-row {
    padding: 3px 10px !important;
}

.view-mode-mobile .gn-cq-name {
    font-size: 0.7rem !important;
}

.view-mode-mobile .gn-cq-duration {
    font-size: 0.65rem !important;
}

/* ── MOBİL KÖY NAVİGASYON BARI ── */
.gn-mobile-vbar {
    display: none;
    /* masaüstünde gizli */
}

.view-mode-mobile .gn-mobile-vbar {
    display: flex !important;
    position: fixed !important;
    bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    height: 34px !important;
    z-index: 11850 !important;

    /* BEIGE THEME */
    background-color: #f4f4ce !important;
    background-image: none !important;
    border-style: solid !important;
    border-width: 2px 0 0 0 !important;
    border-color: rgba(139, 95, 40, 0.4) !important;
    border-image: none !important;

    align-items: center !important;
    flex-direction: row !important;
}

.gn-mvbar-arrow {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 60px !important;
    flex-shrink: 0 !important;

    /* BEIGE THEME BUTTONS */
    background-color: #f4f4ce !important;
    border: 2px solid rgba(139, 95, 40, 0.6) !important;
    color: #4a3b2c !important;

    font-size: 1.2rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 13500 !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6) !important;
}

#gn-mvbar-left {
    left: 0 !important;
    border-left: none !important;
    border-radius: 0 6px 6px 0 !important;
}

#gn-mvbar-right {
    right: 0 !important;
    border-right: none !important;
    border-radius: 6px 0 0 6px !important;
}

.gn-mvbar-center {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    min-width: 0 !important;
}

.gn-mvbar-name {
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    color: #4a3b2c !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
}

.gn-mvbar-coords {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    color: #8b7355 !important;
    white-space: nowrap !important;
}

/* Sol drawer: köy listesi */
.gn-mobile-vlist-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 14000;
}

.gn-mobile-vlist-overlay.open {
    display: block;
}

.gn-mobile-vlist {
    position: fixed;
    top: 44px;
    /* Under header */
    left: 0;
    bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    /* Above navbar */
    height: calc(100vh - 44px - 54px - env(safe-area-inset-bottom, 0px));
    width: 260px;
    max-width: 80vw;
    /* BEIGE THEME */
    background-color: #f4f4ce !important;
    border-style: solid;
    border-width: 16px 16px 16px 0;
    border-image-source: url('/images/ui/frame/frame.webp');
    border-image-slice: 18%;
    border-image-repeat: stretch stretch;
    z-index: 14001;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.gn-mobile-vlist.open {
    transform: translateX(0);
}

.gn-mobile-vlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: transparent;
    border-bottom: 2px solid rgba(139, 95, 40, 0.3);
    color: #4a3b2c;
    font-size: 0.85rem;
    font-weight: 800;
}

.gn-mobile-vlist-header button {
    background: none;
    border: none;
    color: #999;
    font-size: 1rem;
    cursor: pointer;
}

.gn-mobile-vlist-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.gn-mobile-vlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(139, 95, 40, 0.12);
    transition: background 0.15s;
}

.gn-mobile-vlist-item:hover,
.gn-mobile-vlist-item.active {
    background: rgba(200, 155, 80, 0.15);
}

.gn-mobile-vlist-item.active .gn-mvli-name {
    color: #8b1a1a;
}

.gn-mvli-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: #4a3b2c;
}

.gn-mvli-coords {
    font-size: 0.68rem;
    color: #8b7355;
}

/* ── BOTTOM NAV BAR — tema rengi beige ── */
.view-mode-mobile .gn-sidebar-frame {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: calc(54px + env(safe-area-inset-bottom, 0px)) !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    gap: 0 !important;

    /* BEIGE THEME */
    background-color: #f4f4ce !important;
    background-image: none !important;
    border-style: solid !important;
    border-width: 16px 0 0 0 !important;
    /* Only top border */
    border-image-source: url('/images/ui/frame/frame.webp') !important;
    border-image-slice: 18% !important;
    border-image-repeat: stretch stretch !important;

    box-shadow: 0 -3px 16px rgba(0, 0, 0, 0.8) !important;
    z-index: 12000 !important;
    transform: none !important;
}

.view-mode-mobile .gn-sidebar-frame .gn-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 54px !important;
    gap: 2px !important;
    min-width: 0 !important;
    cursor: pointer !important;
}

.view-mode-mobile .gn-sidebar-frame .gn-nav-circle {
    width: 28px !important;
    height: 28px !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.view-mode-mobile .gn-sidebar-frame .gn-nav-circle img {
    width: 26px !important;
    height: 26px !important;
}

.view-mode-mobile .gn-sidebar-frame .gn-nav-label {
    display: block !important;
    position: static !important;
    font-size: 0.45rem !important;
    /* Smaller to fit */
    font-weight: 700 !important;
    color: #4a3b2c !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    max-width: none !important;
    /* Allow it to naturally fill flex container */
    width: 100% !important;
    text-overflow: clip !important;
    /* Prevent ellipsis */
    text-align: center !important;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* Fix notification badges positioning */
.view-mode-mobile .gn-sidebar-frame .gn-nav-item>span[id$="-badge"] {
    right: 50% !important;
    transform: translateX(14px) !important;
    top: 4px !important;
}

/* Fix burger menu icon color */
.view-mode-mobile .gn-mobile-dock-btn span {
    color: #4a3b2c !important;
    font-weight: bold !important;
}

/* ── KISAYOL DOCK ── */
.view-mode-mobile .gn-bottom-dock {
    position: fixed !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    /* nav + vbar */
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transform: translateY(20px) !important;
    transition: transform 0.25s ease, opacity 0.25s ease !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 11900 !important;

    /* BEIGE THEME */
    background-color: #f4f4ce !important;
    background-image: none !important;
    border-style: solid !important;
    border-width: 16px 0 0 0 !important;
    /* Only top border */
    border-image-source: url('/images/ui/frame/frame.webp') !important;
    border-image-slice: 18% !important;
    border-image-repeat: stretch stretch !important;
    padding: 6px 16px 10px !important;
}

.view-mode-mobile .gn-bottom-dock.dock-open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.view-mode-mobile .gn-dock-options-btn {
    display: none !important;
}

.view-mode-mobile .gn-bottom-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    justify-content: space-between !important;
}

.view-mode-mobile .gn-nav-item-bottom {
    min-width: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.view-mode-mobile .gn-nav-circle.gn-circle-sm {
    width: 38px !important;
    height: 38px !important;
}

.view-mode-mobile .gn-nav-circle.gn-circle-sm img {
    width: 24px !important;
    height: 24px !important;
}

.view-mode-mobile .gn-nav-label-bottom {
    display: block !important;
    font-size: 0.45rem !important;
    color: #777 !important;
    text-align: center !important;
    border: none !important;
    background: none !important;
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
}

/* Sağ sidebar, toggle'lar gizle */
.view-mode-mobile .gn-sidebar-right {
    display: none !important;
}

.view-mode-mobile .gn-drawer-toggle-left,
.view-mode-mobile .gn-drawer-toggle-right {
    display: none !important;
}

.view-mode-desktop .gn-mobile-dock-btn {
    display: none !important;
}

.view-mode-mobile .gn-mobile-dock-btn {
    display: flex !important;
}

/* ── MODALLER ── */
.view-mode-mobile .messages-modal,
.view-mode-mobile .reports-modal,
.view-mode-mobile .alliance-modal,
.view-mode-mobile .statistics-modal,
.view-mode-mobile .gold-shop-modal,
.view-mode-mobile #profile-modal,
.view-mode-mobile #settings-modal,
.view-mode-mobile #hero-modal,
.view-mode-mobile .hero-modal {
    position: fixed !important;
    inset: 0 !important;
    transform: none !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    z-index: 20000 !important;
}

.view-mode-mobile .reports-card,
.view-mode-mobile .messages-card,
.view-mode-mobile .stats-card,
.view-mode-mobile .alliance-card {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

/* ── Tablolar ── */
.view-mode-mobile .stats-table-container,
.view-mode-mobile .reports-list,
.view-mode-mobile .messages-list {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.view-mode-mobile table {
    font-size: 0.8rem;
}

/* ── Toast ── */
.view-mode-mobile #toast-container {
    left: 10px !important;
    right: 10px !important;
    top: 48px !important;
    z-index: 25000 !important;
}

/* ── Harita: fullscreen ── */
.view-mode-mobile .g-center {
    position: fixed !important;
    top: 46px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
}

.view-mode-mobile .map-frame-wrapper {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.view-mode-mobile .gvw-frame-pro {
    width: 100% !important;
    height: 100% !important;
    border-image: none !important;
    border-radius: 0 !important;
}

.view-mode-mobile #map-viewport,
.view-mode-mobile .map-viewport {
    width: 100% !important;
    height: calc(100% - 40px) !important;
    /* toolbar yüksekliği çıkarılır */
}

.view-mode-mobile #map-canvas {
    touch-action: none !important;
    width: 100% !important;
    height: 100% !important;
}

.view-mode-mobile .map-toolbar {
    flex-wrap: wrap !important;
    gap: 4px !important;
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
}

/* Mobilde tam ekran butonu gereksiz — harita zaten ekranı kaplıyor, zoom çalışıyor.
   Ayrıca fullscreen modu kare-tile mantığını atlar, o yüzden gizli. */
.view-mode-mobile #fullscreen-btn,
.view-mode-mobile #exit-fullscreen-btn {
    display: none !important;
}

/* ── Harita: Tile Detay Modalı (mobil ortalama) ──
   Masaüstünde scale-container transform ile ortalanır; mobilde transform yok,
   bu yüzden 1920x1080 sabit boyut ekran dışına taşıyor. Görünen alana sabitleyip
   kartı ortalıyoruz (üst kaynak barı ile alt navbar arasında). */
.view-mode-mobile .tile-detail-modal {
    position: fixed !important;
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    padding: 12px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    z-index: 20000 !important;
}

.view-mode-mobile .tdm-card {
    width: 100% !important;
    max-width: min(420px, 92vw) !important;
    min-height: auto !important;
    height: auto !important;
    max-height: 100% !important;
    padding: 18px 20px !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    /* Kaydırma çubuğunu gizle (gerekirse kayar ama çubuk görünmez) */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.view-mode-mobile .tdm-card::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Kartın dekoratif çerçevesini mobilde incelt (50px çok kalın, içeriğe yer bırakmıyor) */
.view-mode-mobile .tdm-card::before {
    border-width: 26px !important;
}

.view-mode-mobile .tdm-card::after {
    top: 3px !important;
    left: 3px !important;
    right: 3px !important;
    bottom: 3px !important;
}

/* Başlık: mobilde küçült, X'in ve çerçevenin üstüne binmesin */
.view-mode-mobile .tdm-header {
    margin-bottom: 14px !important;
    height: auto !important;
    padding: 0 !important;
}

.view-mode-mobile .tdm-header h2 {
    font-size: 0.78rem !important;
    letter-spacing: 0.3px !important;
    height: 30px !important;
    padding: 0 14px !important;
    border-width: 0 14px !important;
    max-width: 82% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Kapatma (X) butonu — mobilde daha görünür ve dokunulabilir */
.view-mode-mobile .tdm-close-btn {
    top: 12px !important;
    right: 12px !important;
    width: 20px !important;
    height: 20px !important;
    z-index: 20 !important;
}

/* Desktop'ta olan .gn-nav-village-box mobilde gizli — kendi mobile vbar var */
.view-mode-mobile .gn-nav-village-box {
    display: none !important;
}

.view-mode-mobile .gn-village-dropdown {
    display: none !important;
}

.view-mode-mobile .gn-yp-progress {
    display: none !important;
}

.view-mode-mobile .gn-construction-panel {
    left: 0 !important;
    width: 100% !important;
}

/* ── Lobby ── */
.view-mode-mobile .lobby-container,
.view-mode-mobile .lobby-wrapper {
    grid-template-columns: 1fr !important;
    padding: 0 8px !important;
}

.view-mode-mobile .panel {
    padding: 12px !important;
}

/* ===== MASAÜSTÜ ===== */
.view-mode-desktop .gn-drawer-toggle-left,
.view-mode-desktop .gn-drawer-toggle-right {
    display: none;
}

.view-mode-desktop .gn-mobile-vlist,
.view-mode-desktop .gn-mobile-vlist-overlay {
    display: none !important;
}

/* ============================================================
   PUBLIC SAYFALAR (index / haberler / takvim) — MOBİL
   Ekran genişliği ≤768px'de otomatik devreye girer.
   view-mode class'ından bağımsız — class sistemi sadece oyun içi.
   ============================================================ */
@media (max-width: 768px) {

    /* ── Ortak header ── */
    .main-header {
        height: 56px;
        padding: 0.4rem 0.8rem;
    }

    .main-header .header-center img {
        height: 36px !important;
    }

    .burger-btn {
        font-size: 1.6rem;
        margin-right: 0.5rem;
        min-height: 44px;
        min-width: 44px;
        padding: 0;
    }

    .header-right .btn {
        font-size: 0.72rem;
        padding: 4px 10px;
        height: 30px;
        min-height: 30px;
        white-space: nowrap;
    }

    .header-right {
        gap: 6px;
    }

    .sidebar,
    .sidebar-overlay {
        top: 56px;
    }

    .sidebar-overlay {
        height: calc(100% - 56px);
    }

    #userDropdown {
        top: 58px !important;
        right: 8px !important;
    }

    /* ── INDEX (hero) ── */
    .hero {
        height: auto;
        min-height: unset;
        overflow: visible;
        padding: 70px 12px 100px;
        background-attachment: scroll;
    }

    .tagline {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
        letter-spacing: 0.5px;
    }

    .carousel-wrapper {
        height: 230px;
        max-width: 100%;
    }

    .carousel-card {
        width: 140px;
        height: 210px;
    }

    .carousel-card.prev {
        transform: translateX(-85px) scale(0.78) translateZ(-50px) rotateY(15deg);
    }

    .carousel-card.next {
        transform: translateX(85px) scale(0.78) translateZ(-50px) rotateY(-15deg);
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .race-desc-box {
        margin: 0.8rem auto;
    }

    .race-desc-box h2 {
        font-size: 1.3rem;
        letter-spacing: 1px;
        margin-bottom: 0.3rem;
    }

    .race-desc-box p {
        font-size: 0.8rem;
        line-height: 1.45;
    }

    .bottom-area {
        flex-direction: column;
        gap: 10px;
        margin-top: 0.8rem;
    }

    .play-box {
        order: -1;
    }

    .play-btn-large {
        font-size: 1.15rem;
        padding: 16px;
        letter-spacing: 1px;
    }

    .stat-box {
        padding: 0.8rem 1rem;
    }

    .stat-box h3 {
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
    }

    .stat-box p {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* ── index.ejs inline style override: kaydırma açık ── */
    html,
    html body {
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    /* ── Login/Register modalları ── */
    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
    }

    .modal {
        padding: 1.4rem;
        margin-top: 24px;
        max-height: calc(100dvh - 48px);
    }

    .modal-header {
        margin-bottom: 1.2rem;
    }

    .input-group {
        margin-bottom: 1rem;
    }

    .input-group input,
    .input-group select {
        padding: 12px 14px;
    }

    /* ── Footer ── */
    footer {
        position: static !important;
        padding: 0.8rem 10px !important;
    }

    footer>div:first-child {
        flex-wrap: wrap !important;
        gap: 6px 10px !important;
        font-size: 0.68rem !important;
        line-height: 1.6;
    }

    /* ── HABERLER (announcements) ── */
    .anns-body {
        padding-top: 72px;
        background-attachment: scroll;
    }

    .anns-container {
        padding: 0 12px 24px;
    }

    .anns-header {
        margin-bottom: 20px;
    }

    .anns-title {
        font-size: 1.6rem;
    }

    .anns-subtitle {
        font-size: 0.85rem;
    }

    .anns-filters {
        gap: 8px;
        margin-bottom: 16px;
        flex-wrap: wrap;
    }

    .anns-filter-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .ann-list-card {
        padding: 14px;
        gap: 8px;
    }

    .ann-list-title {
        font-size: 1.05rem;
    }

    .ann-list-preview {
        font-size: 0.82rem;
    }

    .ann-list-date {
        font-size: 0.68rem;
    }

    .ann-list-footer {
        padding-top: 8px;
    }

    /* ── TAKVİM (calendar) ── */
    .cal-body {
        padding-top: 72px;
        background-attachment: scroll;
    }

    .cal-container {
        padding: 0 12px 24px;
    }

    .cal-header {
        margin-bottom: 20px;
    }

    .cal-title {
        font-size: 1.6rem;
    }

    .cal-subtitle {
        font-size: 0.85rem;
    }

    .calendar-table {
        min-width: 760px;
    }

    .calendar-table th {
        padding: 10px 12px;
        font-size: 0.7rem;
    }

    .calendar-table td {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    .server-name-txt {
        font-size: 0.9rem;
    }

    .btn-action {
        padding: 8px 12px;
        font-size: 0.7rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    #server-info-modal>div {
        width: 100% !important;
        max-width: calc(100vw - 20px) !important;
        max-height: calc(100dvh - 30px);
        overflow-y: auto;
    }

}

.calendar-table th {
    padding: 10px 12px;
    font-size: 0.7rem;
}

.calendar-table td {
    padding: 10px 12px;
    font-size: 0.78rem;
}

.server-name-txt {
    font-size: 0.9rem;
}

.btn-action {
    padding: 8px 12px;
    font-size: 0.7rem;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

#server-info-modal>div {
    width: 100% !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 30px);
    overflow-y: auto;
}

/* ==========================================================================
   MODAL MOBILE OVERRIDES
   ========================================================================== */
.view-mode-mobile .modal,
.view-mode-mobile .zone-modal,
.view-mode-mobile .reports-modal,
.view-mode-mobile #statistics-modal,
.view-mode-mobile #alliance-modal,
.view-mode-mobile #messages-modal,
.view-mode-mobile #profile-modal,
.view-mode-mobile #quests-modal,
.view-mode-mobile #gold-shop-modal,
.view-mode-mobile #settings-modal,
.view-mode-mobile #inventory-modal,
.view-mode-mobile #trade-modal,
.view-mode-mobile #notifications-modal {
    width: 100vw !important;
    height: auto !important;
    max-width: 100% !important;
    position: fixed !important;
    top: 44px !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    transform: none !important;
    z-index: 15000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Modal gizli olduğunda display: flex özelliğini ezen kural */
.view-mode-mobile .modal.hidden,
.view-mode-mobile .zone-modal.hidden,
.view-mode-mobile .reports-modal.hidden,
.view-mode-mobile #statistics-modal.hidden,
.view-mode-mobile #alliance-modal.hidden,
.view-mode-mobile #messages-modal.hidden,
.view-mode-mobile #profile-modal.hidden,
.view-mode-mobile #quests-modal.hidden,
.view-mode-mobile #gold-shop-modal.hidden,
.view-mode-mobile #settings-modal.hidden,
.view-mode-mobile #inventory-modal.hidden,
.view-mode-mobile #trade-modal.hidden,
.view-mode-mobile #notifications-modal.hidden {
    display: none !important;
}

.view-mode-mobile .modal-card,
.view-mode-mobile .neft-premium-card,
.view-mode-mobile .zm-fullscreen-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
    transform: none !important;
    width: 96% !important;
    max-width: 100% !important;
    max-height: 98% !important;
    border-width: 2px !important;
    border-radius: 6px !important;
    padding: 12px 24px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.view-mode-mobile .modal-header {
    padding: 10px 12px !important;
    height: auto !important;
    min-height: 44px !important;
}

.view-mode-mobile .modal-header h2,
.view-mode-mobile .neft-premium-title {
    font-size: 1.1rem !important;
    padding: 0 10px !important;
}

.view-mode-mobile .modal-tabs,
.view-mode-mobile .neft-premium-tabs {
    gap: 4px !important;
    padding: 4px 4px 0 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
    border-bottom-width: 1px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Sekmelerin altındaki çirkin scrollbar'ı gizle ama kaydırılabilir kalsın */
.view-mode-mobile .modal-tabs::-webkit-scrollbar,
.view-mode-mobile .neft-premium-tabs::-webkit-scrollbar,
.view-mode-mobile .zm-interior-tabs::-webkit-scrollbar {
    display: none !important;
}

.view-mode-mobile .modal-tab-btn,
.view-mode-mobile .neft-premium-tab-btn,
.view-mode-mobile .vv-sub-tab {
    min-width: 0 !important;
    flex: 0 0 auto !important;
    padding: 6px 12px !important;
    font-size: 0.65rem !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
}

.view-mode-mobile .modal-tab-content,
.view-mode-mobile .neft-premium-content,
.view-mode-mobile .vv-subtab-content {
    padding: 10px 5px !important;
    margin: 0 !important;
}

.view-mode-mobile .modal-close,
.view-mode-mobile .neft-premium-close,
.view-mode-mobile .zm-close-huge,
.view-mode-mobile .zm-close-btn,
.view-mode-mobile .zm-close,
.view-mode-mobile .soldiers-panel-close,
.view-mode-mobile .player-note-close,
.view-mode-mobile .tdm-close-btn,
.view-mode-mobile .admin-mobile-close {
    top: 12px !important;
    right: 12px !important;
    width: 15px !important;
    height: 15px !important;
    padding: 0 !important;
    background-color: transparent !important;
    border-radius: 0 !important;
}

/* ─── Hero Modal Mobile Simplification ─── */
.view-mode-mobile .hero-body-content {
    flex-direction: column !important;
    overflow-y: auto !important;
    padding: 5px !important;
}

.view-mode-mobile .hero-left-panel {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 2px solid rgba(139, 115, 85, 0.3) !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 5px !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
}

.view-mode-mobile .hero-portrait-frame {
    width: 80px !important;
    height: 106px !important;
    margin-bottom: 0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5) !important;
}

.view-mode-mobile .hero-status-bars {
    width: calc(100% - 100px) !important; /* Portrait + gap = 90px */
    gap: 5px !important;
}

.view-mode-mobile .hero-right-panel {
    width: 100% !important;
    padding: 0 !important;
    overflow-y: visible !important;
}

.view-mode-mobile .hero-available-pts-box {
    width: 100% !important;
    margin-top: 5px !important;
}

.view-mode-mobile .hero-revive-cost-box,
.view-mode-mobile .hero-revive-countdown-box {
    width: 100% !important;
    margin-top: 5px !important;
}

.view-mode-mobile .hero-production-section,
.view-mode-mobile .hero-attributes-section,
.view-mode-mobile .hero-reset-section {
    padding: 10px 5px !important;
}

.view-mode-mobile .hero-resource-grid {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
}

.view-mode-mobile .hero-res-card {
    flex: 0 0 auto !important;
    min-width: 30% !important;
}

.view-mode-mobile .hero-res-val-pill {
    padding: 0 8px 0 16px !important;
    font-size: 0.7rem !important;
}

.view-mode-mobile .hero-attr-row-classic {
    padding: 4px !important;
    flex-wrap: nowrap !important;
}

.view-mode-mobile .hero-attr-name-classic {
    font-size: 0.6rem !important;
    gap: 4px !important;
}

.view-mode-mobile .hero-attr-val-box {
    width: 32px !important;
    font-size: 0.7rem !important;
}

.view-mode-mobile .hero-attr-bonus {
    min-width: 40px !important;
    font-size: 0.7rem !important;
}

.view-mode-mobile .hero-attr-btn {
    width: 22px !important;
    height: 22px !important;
}

.view-mode-mobile .hero-attr-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}

.view-mode-mobile .hero-hide-toggle-label {
    max-width: none !important;
    font-size: 0.7rem !important;
}

/* ─── Gold Shop Modal Mobile Simplification ─── */
.view-mode-mobile .gs-gold-packages {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

.view-mode-mobile .gs-gold-pkg {
    height: auto !important;
    padding: 15px 10px !important;
    gap: 10px !important;
}

.view-mode-mobile .gs-boost-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

.view-mode-mobile .gs-adv-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
}

.view-mode-mobile .gs-adv-right {
    flex-direction: row !important;
    justify-content: space-between !important;
    border-top: 1px solid rgba(139, 95, 40, 0.2) !important;
    padding-top: 10px !important;
}

.view-mode-mobile .gs-adv-btn {
    width: 60% !important;
}

.view-mode-mobile #gs-tab-earn-gold table {
    font-size: 0.65rem !important;
}

/* ─── Messages Modal Mobile Simplification ─── */
.view-mode-mobile .messages-list {
    padding: 0 5px !important;
}

.view-mode-mobile .messages-table {
    table-layout: fixed !important;
    width: 100% !important;
}

.view-mode-mobile .messages-table th,
.view-mode-mobile .messages-table td {
    padding: 6px 2px !important;
    overflow: hidden !important;
}

.view-mode-mobile .messages-table th:nth-child(1),
.view-mode-mobile .messages-table td:nth-child(1),
.view-mode-mobile .messages-table th:nth-child(2),
.view-mode-mobile .messages-table td:nth-child(2) {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
}

.view-mode-mobile .message-checkbox {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
}

.view-mode-mobile .messages-table td:nth-child(2) svg {
    width: 14px !important;
    height: 14px !important;
}

.view-mode-mobile .messages-table th:nth-child(3),
.view-mode-mobile .messages-table td:nth-child(3) {
    width: auto !important;
}

.view-mode-mobile .messages-table td:nth-child(3) div {
    display: block !important;
}

.view-mode-mobile .messages-table td:nth-child(3) a {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.65rem !important;
}

.view-mode-mobile .messages-table th:nth-child(4),
.view-mode-mobile .messages-table td:nth-child(4) {
    width: 55px !important;
    max-width: 55px !important;
    font-size: 0.65rem !important;
}

.view-mode-mobile .messages-table td:nth-child(4) a,
.view-mode-mobile .messages-table td:nth-child(4) span {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.view-mode-mobile .messages-table th:nth-child(5),
.view-mode-mobile .messages-table td:nth-child(5) {
    width: 85px !important;
    max-width: 85px !important;
    font-size: 0.6rem !important;
    white-space: nowrap !important;
}

/* ─── Reports Modal Mobile Simplification ─── */
.view-mode-mobile .reports-list {
    padding: 0 5px !important;
}

.view-mode-mobile .reports-table {
    table-layout: fixed !important;
    width: 100% !important;
}

.view-mode-mobile .reports-table th,
.view-mode-mobile .reports-table td {
    padding: 6px 2px !important;
    overflow: hidden !important;
}

/* col-check, col-env, col-icon */
.view-mode-mobile .reports-table th:nth-child(1),
.view-mode-mobile .reports-table td:nth-child(1),
.view-mode-mobile .reports-table th:nth-child(2),
.view-mode-mobile .reports-table td:nth-child(2),
.view-mode-mobile .reports-table th:nth-child(3),
.view-mode-mobile .reports-table td:nth-child(3) {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
}

.view-mode-mobile .reports-table td:nth-child(2) svg,
.view-mode-mobile .reports-table td:nth-child(3) img,
.view-mode-mobile .sword-icon {
    width: 14px !important;
    height: 14px !important;
}

/* col-subject */
.view-mode-mobile .reports-table th:nth-child(4),
.view-mode-mobile .reports-table td:nth-child(4) {
    width: auto !important;
}

.view-mode-mobile .reports-table td:nth-child(4) div,
.view-mode-mobile .reports-table td:nth-child(4) a {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.65rem !important;
}

/* col-date */
.view-mode-mobile .reports-table th:nth-child(5),
.view-mode-mobile .reports-table td:nth-child(5) {
    width: 85px !important;
    max-width: 85px !important;
    font-size: 0.6rem !important;
    white-space: nowrap !important;
}

/* Trade Details Mobile */
.view-mode-mobile .trade-bottom,
.view-mode-mobile .trade-parties,
.view-mode-mobile .trade-info {
    flex-direction: column !important;
    gap: 10px !important;
}

.view-mode-mobile .trade-party,
.view-mode-mobile .trade-resources {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Attack / Defense Tables Mobile */
.view-mode-mobile .attack-table,
.view-mode-mobile .defense-table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    font-size: 0.6rem !important;
}

.view-mode-mobile .attack-table th,
.view-mode-mobile .attack-table td,
.view-mode-mobile .defense-table th,
.view-mode-mobile .defense-table td {
    padding: 4px !important;
}

/* ─── Statistics Modal Mobile Simplification ─── */
.view-mode-mobile .stats-table {
    display: table !important;
    width: 100% !important;
    table-layout: auto !important;
    font-size: 0.65rem !important;
    margin-bottom: 5px !important;
    white-space: normal !important;
}

.view-mode-mobile .stats-table th,
.view-mode-mobile .stats-table td {
    padding: 6px 2px !important;
    word-break: break-word !important;
    text-align: center !important;
}

.view-mode-mobile .stats-table th:nth-child(3),
.view-mode-mobile .stats-table td:nth-child(3),
.view-mode-mobile .stats-table th:nth-child(4),
.view-mode-mobile .stats-table td:nth-child(4) {
    text-align: left !important;
}

.view-mode-mobile .stats-tribe-col,
.view-mode-mobile .stats-table td.stats-tribe-cell {
    width: 20px !important;
    padding: 2px !important;
}

.view-mode-mobile .stats-table th:first-child,
.view-mode-mobile .stats-table td:first-child {
    width: 25px !important;
}

.view-mode-mobile .stats-top10-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.view-mode-mobile .stats-search-bar {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px 5px !important;
    align-items: stretch !important;
}

.view-mode-mobile .search-input-group {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.view-mode-mobile .search-field {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 2px !important;
    width: auto !important;
}

.view-mode-mobile .search-field label {
    font-size: 0.65rem !important;
}

.view-mode-mobile .search-separator {
    display: none !important;
}

.view-mode-mobile .search-input {
    width: 45px !important;
    padding: 4px !important;
    font-size: 0.65rem !important;
}

.view-mode-mobile .search-field:nth-child(3) .search-input {
    width: 70px !important;
}

.view-mode-mobile .search-btn {
    width: auto !important;
    padding: 4px 8px !important;
    margin-top: 0 !important;
    font-size: 0.65rem !important;
    flex-shrink: 0 !important;
}

.view-mode-mobile .stats-pagination {
    width: 100% !important;
    justify-content: center !important;
    margin-top: 2px !important;
}

/* ─── Profile Modal Mobile Simplification ─── */
.view-mode-mobile .pm-grid,
.view-mode-mobile .pm-medals-section,
.view-mode-mobile .pm-form-grid,
.view-mode-mobile .pm-editor-split,
.view-mode-mobile .alliance-card div[style*="grid-template-columns: 1fr 1fr"],
.view-mode-mobile .alliance-card div[style*="grid-template-columns:1fr 1fr"],
.view-mode-mobile .stats-card div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.view-mode-mobile .pm-editor-split {
    height: auto !important;
}

.view-mode-mobile .pm-textarea {
    height: 100px !important;
}

.view-mode-mobile .pm-edit-input {
    width: 120px !important; /* Smaller on mobile so it fits */
}

.view-mode-mobile .pm-save-row {
    justify-content: center !important;
}

.view-mode-mobile .pm-village-scroll table colgroup col:nth-child(1) { width: 40% !important; }
.view-mode-mobile .pm-village-scroll table colgroup col:nth-child(2) { width: 25% !important; }
.view-mode-mobile .pm-village-scroll table colgroup col:nth-child(3) { width: 15% !important; }
.view-mode-mobile .pm-village-scroll table colgroup col:nth-child(4) { width: 20% !important; }

/* ─── Settings Modal Mobile Simplification ─── */
.view-mode-mobile .stats-table input[id^="sitter"] {
    width: 60px !important; /* Shrink sitter inputs to fit mobile table */
    font-size: 9px !important;
}

.view-mode-mobile .stats-table th[style*="text-align: center;"] div[style*="font-size: 10px;"] {
    font-size: 8px !important; /* Shrink 'Temsilci 1' labels */
}

/* Make sure the vacation icon and text shrinks properly */
.view-mode-mobile div[style*="font-size: 3rem;"] {
    font-size: 2rem !important;
}

/* ─── Alliance Modal Mobile Simplification ─── */
.view-mode-mobile .ally-top10-grid,
.view-mode-mobile .ally-profile-top,
.view-mode-mobile .ally-perm-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.view-mode-mobile .ally-members-table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    width: 100% !important;
}

.view-mode-mobile .ally-sub-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px !important;
}

.view-mode-mobile .ally-sub-tabs::-webkit-scrollbar {
    display: none !important;
}

.view-mode-mobile .tree-stats {
    flex-direction: column !important;
    align-items: center !important;
    gap: 5px !important;
}

.view-mode-mobile .alliance-tree-container {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 15px !important;
}

.view-mode-mobile .tree-branch {
    flex: 0 0 calc(50% - 15px) !important; /* 2x2 grid */
    margin-bottom: 10px !important;
}

/* ─── Building Interiors (zm-fullscreen-card) Mobile Simplification ─── */
/* Flatten side-by-side grids */
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: 1fr 1fr"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:1fr 1fr"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: 1fr 1fr 1fr"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:1fr 1fr 1fr"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: repeat(2, 1fr)"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:repeat(2, 1fr)"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: repeat(3, 1fr)"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
}

/* Make troop selection grids 2-column instead of 4-column */
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: repeat(4,"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

/* Stack the incoming/outgoing table headers */
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: 1fr auto 1fr"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:1fr auto 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: center !important;
    gap: 6px !important;
}

/* Force wide inline tables (like Farm List and Overview tables) to maintain width, allowing horizontal scroll */
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns: 30px minmax(100px,2fr)"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:30px minmax(100px,2fr)"],
.view-mode-mobile .zm-fullscreen-card div[style*="grid-template-columns:30px minmax(100px, 2fr)"] {
    min-width: 540px !important;
    font-size: 0.7rem !important;
}

/* Allow scrolling for the lists that wrap the wide tables */
.view-mode-mobile .zm-fullscreen-card div[style*="max-height:280px;overflow-y:auto;"] {
    overflow-x: auto !important;
}

/* Make the overall tab content scrollable horizontally if tables overflow */
.view-mode-mobile .zm-tab-content {
    overflow-x: auto !important;
}

/* ─── ABC Layout (Bina İçi Header) Mobile Overrides ─── */
/* The fixed 120px height causes overlap when text wraps on mobile */
.view-mode-mobile .zm-abc-layout {
    height: auto !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

.view-mode-mobile .zm-abc-left {
    min-width: 240px !important;
    gap: 8px !important;
}

.view-mode-mobile .zm-abc-stats {
    flex-wrap: nowrap !important;
    gap: 2px !important;
}
.view-mode-mobile .zm-abc-stats > div {
    min-width: 0 !important;
    padding: 0 2px !important;
}

/* ─── Yeni Mesaj (Compose) & Detail Mobile ─── */
.view-mode-mobile .compose-container {
    padding: 10px 5px !important;
}

.view-mode-mobile .compose-header-row {
    flex-direction: column !important;
    gap: 6px !important;
}

.view-mode-mobile .compose-recipient-group,
.view-mode-mobile .compose-input {
    width: 100% !important;
    box-sizing: border-box !important;
}

.view-mode-mobile .compose-toolbar {
    flex-wrap: wrap !important;
    padding: 6px !important;
    gap: 6px !important;
}

.view-mode-mobile .detail-meta {
    padding: 10px 5px !important;
    font-size: 0.75rem !important;
}

.view-mode-mobile .detail-body {
    padding: 10px 5px !important;
}

.view-mode-mobile .detail-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.view-mode-mobile .msg-action-btn,
.view-mode-mobile .msg-back-btn {
    flex: 1 1 auto !important;
    text-align: center !important;
    padding: 8px 10px !important;
    font-size: 0.65rem !important;
}


.view-mode-mobile .pag-btn,
.view-mode-mobile .modal-action-btn,
.view-mode-mobile .reports-action-btn {
    padding: 6px 10px !important;
    font-size: 0.65rem !important;
}

/* ==========================================================================
   REPORTS MODAL MOBILE OVERRIDES
   ========================================================================== */
.view-mode-mobile .reports-toolbar {
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    gap: 4px !important;
    padding: 6px 4px !important;
}

.view-mode-mobile .reports-filters {
    flex: 0 0 auto !important;
    width: auto !important;
}

.view-mode-mobile .reports-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    width: auto !important;
    flex: 1 1 auto !important;
}

.view-mode-mobile .reports-action-btn {
    flex: 1 1 0 !important;
    text-align: center !important;
    padding: 4px 2px !important;
    font-size: 0.5rem !important;
    letter-spacing: 0 !important;
    white-space: normal !important;
    line-height: 1.1 !important;
}

.view-mode-mobile .reports-filter-select {
    width: auto !important;
    max-width: 70px !important;
    padding: 4px !important;
    font-size: 0.55rem !important;
}

.view-mode-mobile .detail-action-btn {
    padding: 5px 8px !important;
    font-size: 0.65rem !important;
}

/* ==========================================================================
   STATISTICS MODAL MOBILE OVERRIDES
   ========================================================================== */

/* Alt kısımdaki arama barını küçültme */
.view-mode-mobile .stats-search-bar {
    padding: 6px 10px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
}

.view-mode-mobile .search-input {
    width: 60px !important;
    padding: 4px 6px !important;
    font-size: 0.65rem !important;
}

.view-mode-mobile .search-input[placeholder="Ara..."] {
    width: 100px !important;
}

.view-mode-mobile .search-btn {
    padding: 4px 10px !important;
    font-size: 0.65rem !important;
}

/* Genel Sekmesi İçi Düzenleme (Responsive) */
.view-mode-mobile .ranking-flex-container {
    flex-direction: column !important;
    gap: 15px !important;
    padding: 10px !important;
}

.view-mode-mobile .ranking-left-panel {
    border-right: none !important;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.2) !important;
    padding-right: 0 !important;
    padding-bottom: 15px !important;
}

.view-mode-mobile .ranking-right-panel {
    padding-left: 0 !important;
}

.view-mode-mobile .rank-dual-container {
    display: flex !important;
    justify-content: space-around !important;
    width: 100% !important;
}

/* Oyun Sonu taşmasını engelle & Görselleri küçült */
.view-mode-mobile .progress-stones {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
    padding: 10px !important;
    gap: 8px !important;
    justify-content: center !important;
    align-items: flex-start !important;
    min-height: 110px !important;
    flex-shrink: 0 !important;
    margin-bottom: 15px !important;
}

.view-mode-mobile .stone-item {
    flex: 0 0 auto !important;
    width: 52px !important;
    gap: 2px !important;
}

.view-mode-mobile .stone-circle,
.view-mode-mobile .stone-circle img {
    width: 44px !important;
    height: 44px !important;
}

.view-mode-mobile .stone-icon {
    width: 44px !important;
    height: 44px !important;
    background-size: 600% 200% !important;
}

.view-mode-mobile .stone-label {
    font-size: 0.52rem !important;
    white-space: normal !important;
    line-height: 1.1 !important;
    word-break: break-word !important;
}

.view-mode-mobile .stone-value {
    font-size: 0.6rem !important;
    white-space: normal !important;
    line-height: 1.1 !important;
}

.view-mode-mobile .stone-date {
    font-size: 0.55rem !important;
}

/* ==========================================================================
   ZONE / BİNA İÇİ / KAYNAK MODALLARI — MOBİL SIĞDIRMA + TEMİZ (sekme gibi)
   Bu üç modal da .zm-fullscreen-card kullanır. Masaüstünde sabit 1010x760;
   mobilde üst kaynak barı (44px) ile alt navbar (88px) arasına sığdırıp
   içeriği modal İÇİNDE kaydırıyoruz. Kaydırma çubukları gizli (sekme hissi).
   ========================================================================== */

/* Modal kapsayıcısı: barlar arasını TAM doldur (height:auto taşmasını engelle) */
.view-mode-mobile #zone-modal,
.view-mode-mobile #building-interior-modal,
.view-mode-mobile #resources-modal {
    height: auto !important;
    align-items: stretch !important;
    overflow: hidden !important;
}

/* Kart: kapsayıcıyı doldur, içerik dikey akışta */
.view-mode-mobile #zone-modal .zm-fullscreen-card,
.view-mode-mobile #building-interior-modal .zm-fullscreen-card,
.view-mode-mobile #resources-modal .zm-fullscreen-card {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 10px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* ZONE MODAL: tek sütun scroll — grid + sekmeler + inşa listesi/yükseltme
   hepsi doğal yükseklikte alt alta; SADECE zm-main-flex-v kayar. Böylece
   küçük ekranda da aşağı kaydırıp inşa edilebilirlere/yükseltmeye ulaşılır. */
.view-mode-mobile #zone-modal .zm-main-flex-v {
    display: block !important;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* Grid ve detay bölümleri: doğal yükseklik, iç-scroll YOK, sıkışmasın */
.view-mode-mobile #zone-modal .zm-slots-section,
.view-mode-mobile #zone-modal .zm-detail-section,
.view-mode-mobile #zone-modal .zm-detail-content {
    flex: none !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
}

/* BİNA İÇİ / KAYNAK: bunlar sekmeli, iç-scroll kalsın ama çubuk gizli */
.view-mode-mobile #building-interior-modal .bi-body,
.view-mode-mobile #building-interior-modal .bi-content,
.view-mode-mobile #building-interior-modal .zm-interior-content,
.view-mode-mobile #resources-modal .zm-main-flex-v {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin-right: 0 !important;
    padding-right: 6px !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.view-mode-mobile #zone-modal .zm-main-flex-v::-webkit-scrollbar,
.view-mode-mobile #zone-modal .zm-detail-section::-webkit-scrollbar,
.view-mode-mobile #zone-modal .zm-detail-content::-webkit-scrollbar,
.view-mode-mobile #building-interior-modal .bi-body::-webkit-scrollbar,
.view-mode-mobile #building-interior-modal .bi-content::-webkit-scrollbar,
.view-mode-mobile #building-interior-modal .zm-interior-content::-webkit-scrollbar,
.view-mode-mobile #resources-modal .zm-main-flex-v::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* CATCH-ALL: bu üç modaldaki HERHANGİ bir alt elementin kaydırma çubuğunu gizle
   (yatay/dikey fark etmez — iç içe wrapper'lardaki çubuklar da yakalanır).
   İçerik yine parmakla/dokunarak kaydırılabilir, sadece çubuk görünmez. */
.view-mode-mobile #zone-modal *,
.view-mode-mobile #building-interior-modal *,
.view-mode-mobile #resources-modal * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.view-mode-mobile #zone-modal *::-webkit-scrollbar,
.view-mode-mobile #building-interior-modal *::-webkit-scrollbar,
.view-mode-mobile #resources-modal *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ==========================================================================
   KALAN KÜÇÜK BOŞLUKLAR — MOBİL GÜVENLİK GUARD'LARI
   ========================================================================== */

/* 1) SweetAlert popupları (birim bilgisi, onay kutuları vb.)
   Masaüstünde min-width:320px/max-width:400px; küçük telefonlarda taşmasın. */
.view-mode-mobile .swal2-popup.neftaria-premium-alert,
.view-mode-mobile .swal2-popup {
    min-width: 0 !important;
    max-width: 94vw !important;
    width: auto !important;
    box-sizing: border-box !important;
}

.view-mode-mobile .swal2-container {
    padding: 8px !important;
}

/* 2) Anında Tamamla modalı — inline neft-frame kart, max-width yoktu */
.view-mode-mobile #instant-complete-modal {
    padding: 10px !important;
    box-sizing: border-box !important;
}

.view-mode-mobile #instant-complete-modal .neft-frame {
    width: 100% !important;
    max-width: 94vw !important;
    box-sizing: border-box !important;
    max-height: calc(100dvh - 160px) !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
}

.view-mode-mobile #instant-complete-modal .neft-frame::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* 3) Zafer (kupa) modalı — ortalanmış popup, kart taşmasın */
.view-mode-mobile .victory-modal {
    padding: 12px !important;
    box-sizing: border-box !important;
}

.view-mode-mobile .victory-modal .vm-content,
.view-mode-mobile .victory-modal .neft-premium-card {
    width: 100% !important;
    max-width: 94vw !important;
    max-height: calc(100dvh - 120px) !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
}

.view-mode-mobile .victory-modal .vm-content::-webkit-scrollbar,
.view-mode-mobile .victory-modal .neft-premium-card::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* ==========================================================================
   GENEL BAKIŞ (Köy Görüntüle / ViewVillage) MODALI — MOBİL
   Kısayollar → "Genel Bakış" bu modalı açar. Masaüstünde 1920x1080 absolute
   (scale-container ile ölçeklenir); mobilde transform yok → ekran dışına
   taşıyordu. Barlar arasına sabitleyip kartı içeride kaydırıyoruz.
   ========================================================================== */
.view-mode-mobile .viewvillage-modal {
    position: fixed !important;
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    padding: 8px !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    pointer-events: auto !important;
    z-index: 20000 !important;
}

.view-mode-mobile .viewvillage-modal > .viewvillage-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* İçerik alanı modal içinde kayar */
.view-mode-mobile .viewvillage-modal .viewvillage-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Alt sekmeler (Askerler/Köydeki/Talimhane/Şifahane/Eğitim) yatay kaydırılabilir —
   sığmayınca "Eğitim" vb. kesilmesin. Inline margin de mobilde kısılır. */
.view-mode-mobile .viewvillage-modal .vv-sub-tabs {
    margin: 10px 6px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 4px !important;
}

/* Geniş genel-bakış / asker tabloları: yatay kaydırılabilir (Büyük Kışla/Ahır
   gibi yeni sütunlar eklenince otomatik kayma aktif olur), dikey sınır kalksın */
.view-mode-mobile .viewvillage-modal .vv-table-container,
.view-mode-mobile .viewvillage-modal .vv-subtab-content {
    max-height: none !important;
    padding: 10px !important;
    overflow-x: auto !important;
}

/* Bu modaldaki tüm kaydırma çubukları gizli (sekme hissi) */
.view-mode-mobile .viewvillage-modal *,
.view-mode-mobile .viewvillage-modal {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.view-mode-mobile .viewvillage-modal *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ==========================================================================
   BBCODE BİÇİMLENDİRME POPUP'I (mesaj yazarken) — MOBİL
   4 sütunlu grid dar ekranda taşabiliyordu; genişliği sınırla.
   ========================================================================== */
.view-mode-mobile .bbcode-selector-popup {
    left: 0 !important;
    right: 0 !important;
    max-width: calc(100vw - 24px) !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    grid-template-columns: repeat(4, 1fr) !important;
}

/* ==========================================================================
   AYARLAR + İSTATİSTİK MODALLARI — MOBİL DİKEY KAYDIRMA
   Kart max-height:98% kullanıyordu ama kapsayıcı height:auto olunca yüzde
   max-height 'none'a düşüyor → kart sınırsız büyüyor, içerik aşağı KAYMIYOR.
   Çözüm: kartı viewport (dvh) ile sınırla, içerik alanını flex+scroll yap.
   ========================================================================== */
.view-mode-mobile #settings-modal .neft-premium-card,
.view-mode-mobile #statistics-modal .neft-premium-card,
.view-mode-mobile .statistics-modal .neft-premium-card {
    /* SABİT yükseklik — sekme değişince boyut değişmesin, içerik hep kaydırmayla uzasın */
    height: calc(100dvh - 44px - 88px - 12px) !important;
    max-height: calc(100dvh - 44px - 88px - 12px) !important;
    min-height: calc(100dvh - 44px - 88px - 12px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* Başlık ve sekmeler sabit kalsın, sıkışmasın (içerik onların altında kayar) */
.view-mode-mobile #settings-modal .neft-premium-header,
.view-mode-mobile #settings-modal .neft-premium-tabs,
.view-mode-mobile #statistics-modal .neft-premium-header,
.view-mode-mobile #statistics-modal .neft-premium-tabs,
.view-mode-mobile .statistics-modal .neft-premium-header,
.view-mode-mobile .statistics-modal .neft-premium-tabs {
    flex: 0 0 auto !important;
}

.view-mode-mobile #settings-modal .neft-premium-content,
.view-mode-mobile #statistics-modal .neft-premium-content,
.view-mode-mobile .statistics-modal .neft-premium-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.view-mode-mobile #settings-modal .neft-premium-content::-webkit-scrollbar,
.view-mode-mobile #statistics-modal .neft-premium-content::-webkit-scrollbar,
.view-mode-mobile .statistics-modal .neft-premium-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
/* ==========================================================================
   LANDING GİRİŞ / KAYIT MODALLARI — MOBİL GÖRÜNÜM TİKLİYKEN
   "Mobil görünümü kullan" tiklenince <html>'e view-mode-mobile ekleniyor ve
   OYUN modal kuralları (.view-mode-mobile .modal / .modal-header) bu landing
   modallarını da yakalayıp bozuyordu (başlık sola kayıyordu). ID ile hedefleyip
   (yüksek specificity) main.css'teki normal düzene geri döndürüyoruz.
   ========================================================================== */
.view-mode-mobile #loginModal.modal-overlay,
.view-mode-mobile #registerModal.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 14px !important;
    box-sizing: border-box !important;
    z-index: 10000 !important;
    transform: none !important;
}

.view-mode-mobile #loginModal > .modal,
.view-mode-mobile #registerModal > .modal {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 450px !important;
    height: auto !important;
    max-height: calc(100dvh - 40px) !important;
    transform: none !important;
    display: block !important;
    padding: 2rem !important;
    border-radius: 12px !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

.view-mode-mobile #loginModal .modal-header,
.view-mode-mobile #registerModal .modal-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1.5rem !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
}
