:root, [data-theme="obsidian"] {
    --bg-app: #09090b;
    --bg-card: #121215;
    --bg-elevated: #18181c;
    --border-subtle: rgba(255,255,255,0.06);
    --border-focus: rgba(255,255,255,0.14);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --accent: #10b981;
    --pitch-bg: #0c1f17;
    --pitch-stripe: #0e241b;
    --pitch-line: rgba(16, 185, 129, 0.22);
    --radius-card: 16px;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

[data-theme="spatial"] {
    --bg-app: radial-gradient(circle at 20% 20%, #172554 0%, #090d16 55%, #05070b 100%);
    --bg-card: rgba(22, 30, 49, 0.62);
    --bg-elevated: rgba(30, 41, 59, 0.7);
    --border-subtle: rgba(255,255,255,0.1);
    --border-focus: rgba(255,255,255,0.25);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --pitch-bg: rgba(12, 31, 23, 0.6);
    --pitch-stripe: rgba(14, 36, 27, 0.6);
    --pitch-line: rgba(56, 189, 248, 0.22);
    --radius-card: 16px;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbars */
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--highlight); }

.fm-body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    padding: 12px 16px;
    gap: 12px;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bento-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
[data-theme="spatial"] .bento-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Navbar */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; height: 48px; min-height: 48px;
    border-radius: 14px;
}
.logo { font-size: 15px; font-weight: 800; color: var(--accent); display: flex; align-items: center; gap: 0.5rem; }

.theme-switcher { display: flex; gap: 6px; background: rgba(0,0,0,0.3); padding: 4px; border-radius: 8px; border: 1px solid var(--border-subtle); }
.theme-btn {
    background: transparent; border: none; color: var(--text-secondary); padding: 4px 10px;
    border-radius: 6px; font-size: 11px; cursor: pointer; transition: 0.2s; font-weight: 600;
}
.theme-btn:hover { color: var(--text-primary); }
.theme-btn.active { background: var(--bg-elevated); color: var(--accent); border: 1px solid var(--border-focus); }

.nav-tabs { display: flex; gap: 5px; height: 100%; align-items: center;}
.nav-tab { background: transparent; border: none; color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: 0.2s; font-weight: 500; font-family: 'Plus Jakarta Sans', sans-serif; }
.nav-tab.active { background: var(--bg-elevated); color: var(--text-primary); border-bottom: 2px solid var(--accent); border-radius: 6px 6px 0 0; }
.nav-tab.disabled { opacity: 0.4; cursor: not-allowed; }

/* Dashboard Layout */
.dashboard-grid {
    height: calc(100vh - 84px);
    overflow: hidden;
    display: grid;
    grid-template-columns: 53% 1fr;
    gap: 14px;
}

.tactics-zone {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 14px;
    height: 100%;
}

/* Flat / Matte Panels */
.left-panel, .squad-zone, .modal-content, .middle-panel {
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 1. Left Panel (Instructions) */
.left-panel { overflow: hidden; height: 100%; }
.panel-tabs { display: flex; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); padding: 4px; gap: 4px; }
.panel-tab { flex: 1; padding: 6px 0; background: transparent; border: none; border-radius: 6px; color: var(--text-secondary); cursor: pointer; font-size: 11px; font-weight: 500; transition: 0.2s; font-family: 'Plus Jakarta Sans', sans-serif;}
.panel-tab.active { color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border-subtle); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.panel-content { display: none; flex: 1; padding: 12px; overflow: hidden; flex-direction: column; gap: 12px; height: 100%; }
.panel-content.active { display: flex; }

.compact-inst { display: flex; flex-direction: column; gap: 12px; height: 100%; overflow-y: auto; }
.inst-box { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.inst-box h5 { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px; }

.inst-item { display: flex; flex-direction: column; gap: 6px; }
.inst-label { display: flex; justify-content: space-between; font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.inst-val { color: var(--accent); font-weight: 600; }

.seg-control { display: flex; background: var(--bg-elevated); padding: 3px; border-radius: 8px; gap: 3px; border: 1px solid var(--border-subtle); }
.seg-pill { flex: 1; background: transparent; border: none; border-radius: 6px; color: var(--text-secondary); padding: 6px 4px; font-size: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Plus Jakarta Sans', sans-serif;}
.seg-pill:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.seg-pill.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.3); border: 1px solid var(--border-focus); }

.threat-box { margin-top: auto; }
.threat-input { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-primary); padding: 8px 12px; border-radius: 8px; font-size: 12px; width: 100%; font-family: 'Plus Jakarta Sans', sans-serif; }
.threat-input:focus { outline: none; border-color: var(--accent); }
.tactic-row label { font-size: 11px; color: var(--text-muted); cursor: pointer; }
.tactic-row select {
    appearance: none; -webkit-appearance: none;
    background: transparent;
    color: var(--text-light); font-size: 11px; text-align: right; font-weight: bold; cursor: pointer; outline: none; border: none; font-family: 'Inter', sans-serif;
}
.tactic-row select option { background: #0f172a; color: white; }

.threat-box { border-left-color: var(--danger); border-left: 3px solid var(--danger); padding-bottom: 6px; }
.threat-input { 
    appearance: none; width: calc(100% - 20px); margin: 6px 10px; background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); 
    color: white; font-size: 11px; padding: 6px; border-radius: 4px; outline: none; font-family: 'Inter', sans-serif;
}
.threat-input:focus { border-color: var(--danger); }

/* Analysis */
.radar-wrap { display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,0.2); border-radius: 4px; padding: 0.5rem; height: 180px; border: 1px solid var(--border-color); }
.ai-box { background: rgba(0,0,0,0.2); border-left: 3px solid var(--highlight); padding: 0.8rem; border-radius: 4px; font-size: 11px; color: #cbd5e1; line-height: 1.4; display: flex; flex-direction: column; gap: 0.5rem; border: 1px solid var(--border-color); }

/* 2. Middle Panel (Pitch) */
.middle-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.fm-top-bar {
    display: flex; align-items: center; justify-content: space-between; background: var(--panel-bg); padding: 0.5rem; border-radius: 8px; border: 1px solid var(--border-color); gap: 0.5rem; margin-bottom: 0.8rem;
}
.plans-group { display: flex; gap: 4px; }
.plan-btn { background: rgba(0,0,0,0.2); color: var(--text-muted); border: 1px solid var(--border-color); padding: 6px 12px; font-weight: bold; cursor: pointer; border-radius: 4px; font-size: 11px; transition: 0.1s;}
.plan-btn.active { background: var(--highlight); color: #000; border-color: var(--highlight); }
.select-group { display: flex; gap: 0.4rem; }
.select-group .pill-select select { background: rgba(0,0,0,0.2) url('data:image/svg+xml;utf8,<svg fill="%2394a3b8" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 8px center; border: 1px solid var(--border-color); padding: 6px 24px 6px 8px; color: var(--text-light); border-radius: 4px; appearance: none; outline: none;}
.draw-group { display: flex; align-items: center; gap: 6px; }
.toolbar-btn { background: rgba(0,0,0,0.2); color: white; border: 1px solid var(--border-color); padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; transition: 0.1s;}
.toolbar-btn.active { background: var(--danger); border-color: var(--danger); }
.draw-group input[type="color"] { width: 26px; height: 26px; padding: 0; border: none; background: transparent; border-radius: 4px; cursor: pointer; }
.am-badge { white-space: nowrap; flex-shrink: 0; z-index: 10; background: rgba(251, 197, 49, 0.1); color: var(--highlight); border: 1px solid var(--highlight); padding: 4px 8px; border-radius: 4px; font-size: 11px; cursor: help; }

/* Pitch Container Setup */
.pitch-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 0;
    height: 100%;
    overflow: hidden;
}
/* Modern Mat Pitch */
.pitch {
    flex: 1;
    height: 100%;
    width: auto;
    margin: 0 auto;
    position: relative;
}
.modern-pitch {
    max-height: calc(100vh - 165px);
    aspect-ratio: 0.74;
    border-radius: 14px;
    border: 1.5px solid var(--pitch-line);
    background: var(--pitch-bg);
    background-image: repeating-linear-gradient(0deg, var(--pitch-stripe), var(--pitch-stripe) 40px, transparent 40px, transparent 80px);
}
#draw-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; }
#draw-canvas.drawing-active { pointer-events: auto; cursor: crosshair; }
.pitch-lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; --pitch-lines: rgba(255,255,255,0.22); }
.pitch-lines .center-line { position: absolute; top: 50%; left: 0; width: 100%; height: 1.5px; background: var(--pitch-lines); transform: translateY(-50%); }
.pitch-lines .center-circle { position: absolute; top: 50%; left: 50%; width: 25%; aspect-ratio: 1; border: 1.5px solid var(--pitch-lines); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-lines .center-circle::after { content: ''; position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; background: var(--pitch-lines); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-lines .penalty-box { position: absolute; width: 50%; height: 15%; border: 1.5px solid var(--pitch-lines); left: 25%; }
.pitch-lines .penalty-box.top { top: 0; border-top: none; }
.pitch-lines .penalty-box.bottom { bottom: 0; border-bottom: none; }
.pitch-lines .goal-box { position: absolute; width: 20%; height: 5%; border: 1.5px solid var(--pitch-lines); left: 40%; }
.pitch-lines .goal-box.top { top: 0; border-top: none; }
.pitch-lines .goal-box.bottom { bottom: 0; border-bottom: none; }
.pitch-lines .corner-arc { position: absolute; width: 30px; height: 30px; border: 1.5px solid var(--pitch-lines); border-radius: 50%; }
.pitch-lines .corner-arc.tl { top: -15px; left: -15px; clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%); }
.pitch-lines .corner-arc.tr { top: -15px; right: -15px; clip-path: polygon(0 50%, 50% 50%, 50% 100%, 0 100%); }
.pitch-lines .corner-arc.bl { bottom: -15px; left: -15px; clip-path: polygon(50% 0, 100% 0, 100% 50%, 50% 50%); }
.pitch-lines .corner-arc.br { bottom: -15px; right: -15px; clip-path: polygon(0 0, 50% 0, 50% 50%, 0 50%); }

/* Flat Pitch Cards */
.pitch-slot { 
    position: absolute; width: 64px; height: 74px; transform: translate(-50%, -50%); 
    background: transparent; z-index: 5; transition: 0.1s; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pitch-slot.drag-over { background-color: rgba(255,255,255, 0.05); border-radius: 8px; }

.node-empty {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.22);
    display: flex; justify-content: center; align-items: center;
    font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-secondary);
    transition: 0.2s;
}
.pitch-slot:hover .node-empty { border-color: rgba(255,255,255,0.5); color: var(--text-primary); }

.node-filled { 
    width: 42px; height: 42px; border-radius: 50%; background: #18181c;
    display: flex; justify-content: center; align-items: center; position: relative;
    border: 2px solid; transition: 0.2s;
}
.suit-green { border-color: var(--accent); } .suit-yellow { border-color: var(--warning); } .suit-red { border-color: var(--danger); }

.node-number { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; color: var(--text-primary); }

.node-ovr { position: absolute; top: -4px; right: -6px; background: #121215; border: 1px solid var(--border-subtle); border-radius: 4px; padding: 1px 3px; font-size: 9px; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.node-cap { position: absolute; bottom: -2px; left: -4px; background: var(--accent); color: #000; border-radius: 50%; width: 14px; height: 14px; display: flex; justify-content: center; align-items: center; font-size: 9px; font-weight: 800; }

.node-actions { position: absolute; inset: 0; background: rgba(0,0,0,0.6); border-radius: 50%; display: flex; justify-content: space-evenly; align-items: center; opacity: 0; transition: 0.2s; }
.node-filled:hover .node-actions { opacity: 1; }
.node-actions i { color: var(--text-primary); font-size: 12px; cursor: pointer; padding: 4px; }
.node-actions i:hover { color: var(--accent); transform: scale(1.1); }
.remove-btn:hover { color: var(--danger) !important; }

.node-label { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 2px 8px; display: flex; flex-direction: column; align-items: center; margin-top: 4px; z-index: 6;}
.n-name { font-size: 10px; font-weight: 700; color: var(--text-primary); white-space: nowrap; max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
.n-role { font-size: 8px; font-weight: 500; color: var(--accent); white-space: nowrap; text-transform: uppercase; }


/* 3. RIGHT PANEL (Squad Data Grid) */
.squad-zone { padding: 0.8rem; overflow: hidden; margin: 10px 10px 10px 0; }
.squad-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 0.6rem; }
.squad-header h4 { font-size: 1.1rem; color: white; font-family: 'Chakra Petch', sans-serif;}
.s-actions { display: flex; align-items: center; gap: 6px; }

.toggle-switch { position: relative; display: inline-block; width: 34px; height: 20px; margin-right: 6px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: #94a3b8; transition: .1s; border-radius: 50%; }
input:checked + .slider { background-color: rgba(59, 130, 246, 0.5); border: 1px solid var(--highlight); }
input:checked + .slider:before { transform: translateX(14px); background-color: white; }

.sm-btn { background: #1e293b; color: white; border: 1px solid rgba(255,255,255,0.1); padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; transition: 0.1s;}
.sm-btn:hover { background: var(--highlight); border-color: var(--highlight); }
.sm-btn-danger { color: var(--danger); border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.1); }
.sm-btn-danger:hover { background: var(--danger); color: white; }

/* SQUAD TABLE (Fixed Columns) */
.squad-table { display: flex; flex-direction: column; flex: 1; overflow-x: auto; overflow-y: hidden; }
.st-header, .squad-row {
    display: grid;
    grid-template-columns: 25px 45px minmax(110px, 1fr) 35px 65px 85px repeat(6, 30px) 35px 30px;
    gap: 4px; padding: 6px 4px;
}
.st-header {
    background: #0f172a; border-radius: 4px; border-bottom: 2px solid var(--highlight);
    font-size: 10px; font-weight: bold; color: #94a3b8; text-transform: uppercase;
    align-items: center;
}
.st-header .sortable { transition: color 0.1s; user-select: none; cursor: pointer; }
.st-header .sortable:hover { color: white; }
.st-header .active-sort { color: var(--highlight); }
.st-header .r-cell, .st-header .r-phys { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-header .r-name { text-align: left; }

.st-body {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding-right: 4px;
}
.squad-row {
    background: #1e293b; border-radius: 4px; border: 1px solid rgba(255,255,255,0.02);
    align-items: center; font-size: 11px; cursor: pointer; user-select: none; transition: 0.1s;
}
.squad-row:hover { background: #334155; }
.squad-row.on-pitch { background: rgba(16, 185, 129, 0.1); border-left-color: var(--success) !important; }
.squad-row.absent { opacity: 0.5; }
.squad-row.selected-row { background: rgba(251, 197, 49, 0.15); border: 1px solid var(--highlight); }
.squad-row.dragging { opacity: 0.5; }

.r-cell { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.r-pos { display: flex; justify-content: center; align-items: center; }
.r-name { text-align: left; font-weight: bold; color: var(--text-primary); display: flex; justify-content: space-between; align-items: center; font-family: 'Plus Jakarta Sans', sans-serif; }
.r-icons { font-size: 10px; display: flex; gap: 2px; cursor: help; font-family: 'Plus Jakarta Sans', sans-serif;}
.r-ovr { font-weight: 700; font-size: 13px; font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums;}
.r-phys { font-size: 10px; color: var(--text-muted); text-align: center; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }
.r-edit { color: var(--text-muted); cursor: pointer; font-size: 12px; }
.r-edit:hover { color: var(--text-primary); }

/* FM Stat Badges & Pos Badges */
.stat-badge {
    font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums;
    font-weight: 700; font-size: 12px;
    display: inline-block; width: 100%; text-align: center; background: transparent;
}
.stat-excel { color: var(--accent); }
.stat-good { color: var(--text-primary); }
.stat-avg { color: var(--text-muted); }

.pos-badge {
    padding: 3px 6px; border-radius: 6px; font-size: 10px; font-weight: 700;
    display: inline-block; white-space: nowrap; text-transform: uppercase; font-family: 'JetBrains Mono', monospace;
}
.pos-att { background: rgba(239,68,68,0.14); color: #f87171; border: 1px solid rgba(239,68,68,0.28); }
.pos-mid { background: rgba(16,185,129,0.14); color: #34d399; border: 1px solid rgba(16,185,129,0.28); }
.pos-def { background: rgba(59,130,246,0.14); color: #60a5fa; border: 1px solid rgba(59,130,246,0.28); }
.pos-gk { background: rgba(245,158,11,0.14); color: #fbbf24; border: 1px solid rgba(245,158,11,0.28); }

.pos-badge-sec {
    background: transparent; border: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 9px; padding: 2px 4px; border-radius: 4px;
    white-space: nowrap; font-family: 'JetBrains Mono', monospace;
}

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; justify-content: center; align-items: center; }
.modal.show { display: flex; }
.modal-content { width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; padding: 20px; background: #121215; border-radius: 16px; border: 1px solid var(--border-subtle); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.close-modal { position: absolute; top: 1.2rem; right: 1.2rem; font-size: 1.2rem; cursor: pointer; color: var(--text-secondary); transition: 0.2s; }
.close-modal:hover { color: var(--text-primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin-bottom: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 11px; color: var(--text-secondary); }
.form-group input, .form-group select {
    appearance: none; -webkit-appearance: none; background: #18181c; border: 1px solid var(--border-subtle);
    color: var(--text-primary); border-radius: 8px; padding: 0.6rem; font-size: 12px; outline: none; font-family: 'Plus Jakarta Sans', sans-serif; transition: 0.2s;
}
.form-group select { background: #18181c url('data:image/svg+xml;utf8,<svg fill="%23a1a1aa" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 8px center; background-size: 16px; padding-right: 30px; }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.sec-pos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; background: #18181c; padding: 0.8rem; border-radius: 8px; border: 1px solid var(--border-subtle); }
.sec-pos-grid label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 1rem; }
.btn-success { background: var(--success); color: #000; padding: 0.6rem 1.2rem; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif; transition: 0.2s;}
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); padding: 0.6rem 1.2rem; border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 8px; cursor: pointer; font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif; transition: 0.2s;}
.btn-success:hover { background: #059669; }
.btn-danger:hover { background: var(--danger); color: white; }
.hidden { display: none !important; }

/* --- PHASE 3: MATCH CENTER --- */
.match-center-zone {
    height: calc(100vh - 84px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mc-top-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.mc-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}
.mc-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-elevated);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--text-secondary);
}
.mc-stat-data {
    display: flex;
    flex-direction: column;
}
.mc-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.mc-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.mc-body-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 14px;
    flex: 1;
    overflow: hidden;
}
.mc-left-panel, .mc-right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
}
.mc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.mc-header h4 {
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
}
.mc-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mc-match-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}
.mc-match-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-focus);
}
.mc-match-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.mc-match-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.type-tournament { color: #facc15; }
.type-friendly { color: #38bdf8; }
.type-training { color: #10b981; }

.mc-match-date {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}
.mc-match-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mc-match-opp {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}
.mc-match-score {
    font-size: 18px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 8px;
    border-radius: 6px;
}
.score-win { background: rgba(16,185,129,0.15); color: #10b981; }
.score-loss { background: rgba(239,68,68,0.15); color: #ef4444; }
.score-draw { background: rgba(245,158,11,0.15); color: #f59e0b; }

.mc-match-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.mc-match-mvp {
    color: #facc15;
    font-weight: 700;
}
.mc-match-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: 0.2s;
}
.mc-match-item:hover .mc-match-delete { opacity: 1; }

.mc-stats-table {
    margin: 0;
}
.mc-stats-table .st-header, .mc-stats-table .squad-row {
    grid-template-columns: 35px 65px minmax(120px, 1fr) 40px 40px 50px 40px 75px 40px;
}

.form-fire { color: #ef4444; font-size: 12px; }
.form-ice { color: #38bdf8; font-size: 12px; }


/* Modernized Top Bar Selectors and Plans */
.plans-group {
    display: flex;
    background: #18181c;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}
.plan-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'JetBrains Mono', monospace;
}
.plan-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}
.plan-btn.active {
    background: #10b981;
    color: #09090b;
    font-weight: 700;
}

.modern-select {
    background: #18181c;
    color: #f4f4f5;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 6px 28px 6px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    outline: none;
    transition: 0.2s;
}
.modern-select:focus {
    border-color: #10b981;
}
.modern-select:hover {
    background: #202026;
}
.select-group {
    display: flex;
    gap: 8px;
    align-items: center;
}
.modern-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23f4f4f5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* Responsive Mobile & Tablet */
@media (max-width: 900px) {
    body, .fm-body {
        overflow-y: auto !important;
        height: auto !important;
    }
    .dashboard-grid {
        height: auto !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .tactics-zone {
        height: auto !important;
        display: contents !important;
    }
    .middle-panel { 
        order: 1; 
        height: 60vh !important; 
        min-height: 450px !important; 
        margin-bottom: 14px; 
    }
    .squad-pool-panel { 
        order: 2; 
        height: auto !important; 
        min-height: 400px !important; 
        margin-bottom: 14px; 
    }
    .left-panel { 
        order: 3; 
        height: auto !important; 
        min-height: 300px !important; 
    }
    
    .match-center-zone {
        height: auto !important;
        overflow: visible !important;
    }
    .mc-top-bar {
        grid-template-columns: 1fr 1fr !important;
    }
    .mc-main-area {
        display: flex !important;
        flex-direction: column !important;
    }
    .mc-stats-table-wrapper, .squad-table-container {
        overflow-x: auto !important;
    }
    .mc-stats-table {
        min-width: 700px;
    }
    .squad-table {
        min-width: 600px;
    }
    .fm-top-bar {
        flex-wrap: wrap;
        height: auto;
    }
}


/* Horizontal Pitch Mode */
.pitch.horizontal-mode {
    width: 100%;
    max-width: 680px;
    height: auto;
    aspect-ratio: 1.58 / 1;
}
.pitch.horizontal-mode .pitch-lines .center-line {
    left: 50%; top: 0; bottom: 0; width: 1.5px; height: 100%; transform: translateX(-50%);
}
.pitch.horizontal-mode .pitch-lines .penalty-box.top {
    left: 0; top: 22%; bottom: 22%; width: 16%; height: auto; border: 1.5px solid var(--pitch-lines); border-left: none;
}
.pitch.horizontal-mode .pitch-lines .penalty-box.bottom {
    right: 0; left: auto; top: 22%; bottom: 22%; width: 16%; height: auto; border: 1.5px solid var(--pitch-lines); border-right: none;
}
.pitch.horizontal-mode .pitch-lines .goal-box.top {
    left: 0; top: 36%; bottom: 36%; width: 5%; height: auto; border: 1.5px solid var(--pitch-lines); border-left: none;
}
.pitch.horizontal-mode .pitch-lines .goal-box.bottom {
    right: 0; left: auto; top: 36%; bottom: 36%; width: 5%; height: auto; border: 1.5px solid var(--pitch-lines); border-right: none;
}

@media (max-width: 768px) {
    .squad-table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
        display: flex;
        flex-direction: column;
    }
    .squad-pool-panel {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
    }
}

/* MOBIL SEKME KILIDI & TASTMA KORUMASI */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

#tactics-workspace.hidden, #match-center-workspace.hidden, .hidden {
    display: none !important;
}

@media (max-width: 768px) and (orientation: portrait) {
    /* Header and Tabs */
    .app-header h1 {
        font-size: 13px !important;
    }
    .nav-tabs .nav-tab {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    /* Layout Order & Sizing */
    .tactics-zone { display: contents !important; }
    .middle-panel {
        order: 1 !important;
        width: 100% !important;
    }
    .right-panel {
        order: 2 !important;
        width: 100% !important;
    }
    .left-panel {
        order: 3 !important;
        width: 100% !important;
    }

    /* Pitch sizing for portrait */
    .pitch-container {
        width: 100% !important;
        display: flex;
        justify-content: center;
    }
    .pitch.modern-pitch {
        width: 100% !important;
        max-height: 62vh !important;
        aspect-ratio: 0.74 !important;
        margin: 0 auto !important;
        height: auto !important;
    }

    /* Tables Overflow Lock */
    .squad-table, .mc-stats-table, .squad-zone, .mc-right-panel {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        justify-content: flex-start !important;
    }

    /* Match Center Cards */
    .mc-top-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .mc-stat-card {
        padding: 10px !important;
    }
    .mc-stat-data .label {
        font-size: 11px !important;
    }
    .mc-stat-data .value {
        font-size: 14px !important;
    }
}


@media (max-width: 950px) and (orientation: landscape) {
    html, body, .fm-body {
        height: auto !important;
        overflow-y: auto !important;
        padding: 6px !important;
    }
    
    .pitch.horizontal-mode {
        height: calc(100vh - 85px) !important;
        max-height: 310px !important;
        width: auto !important;
        aspect-ratio: 1.6 / 1 !important;
        margin: 0 auto !important;
    }

    .pitch.horizontal-mode .pitch-slot {
        transform: translate(-50%, -50%) scale(0.85) !important;
    }
    
    /* Ensure the top bar is compact */
    .fm-top-bar {
        height: 36px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }
    .fm-top-bar button, .fm-top-bar select {
        padding: 4px 8px !important;
        font-size: 11px !important;
    }
}

.hidden, [hidden], .view-hidden { display: none !important; }


@media (max-width: 768px) and (orientation: portrait) {
    /* Pitch Fix for GK Cutoff */
    .pitch.modern-pitch {
        width: 100% !important;
        max-width: 340px !important;
        height: auto !important;
        aspect-ratio: 0.72 !important;
        margin: 0 auto !important;
        position: relative !important;
    }
    
    /* Table Fix for NO / MEV Cutoff */
    .squad-zone, .right-panel, .squad-table-container, .mc-right-panel {
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
        overflow-x: auto !important;
        padding-left: 0 !important;
    }
}

/* Kesin Gizleme Kurali */
.hidden, [hidden], .view-hidden { display: none !important; }


.hidden { display: none !important; }


@media (max-width: 950px) {
    .pitch-slot, .tac-node, .empty-node {
        transform: translate(-50%, -50%) scale(0.82) !important;
    }
    #pitch {
        margin-bottom: 18px !important;
    }
}

/* ========================================================= */
/* FIX 1: Dikey Mobilde SNT ve GK Kesilmesini Önle */
/* ========================================================= */
@media (max-width: 768px) and (orientation: portrait) {
    .middle-panel, .pitch-container, .pitch-stage, .pitch-card {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        padding: 12px 0 28px 0 !important;
    }
    #pitch, .pitch.modern-pitch {
        width: 92% !important;
        max-width: 340px !important;
        height: auto !important;
        max-height: none !important;
        aspect-ratio: 0.68 / 1 !important;
        margin: 14px auto 24px auto !important;
        overflow: visible !important;
    }
}

/* ========================================================= */
/* FIX 2: Kadro Tablosu Kaydırma ve Sabit İsim Sütunu */
/* ========================================================= */
.right-panel, .squad-zone, .right-bento {
    overflow-x: hidden !important;
    width: 100% !important;
}
.squad-table {
    overflow-x: auto !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch !important;
}


/* ========================================================= */
/* FIX 3: Maç Merkezi Mobil Taşması ve Kariyer Tablosu Sol Kesilmesi */
/* ========================================================= */
@media (max-width: 1024px) {
    #match-center-workspace, .mc-main-area, .match-workspace, .match-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
}
.mc-right-panel, .mc-stats-table, .mc-stats-table-wrapper {
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    overflow-x: auto !important;
}

/* ========================================================= */
/* FIX 5: Yatay Mobilde (Landscape) Sıralama */
/* ========================================================= */
@media (max-width: 950px) and (orientation: landscape) {
    .tactics-zone, .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
    }
    .middle-panel, .pitch-card { 
        order: 1 !important; 
    }
    .right-panel, .squad-zone, .right-bento { 
        order: 2 !important; 
    }
    .left-panel { 
        order: 3 !important; 
    }
}

/* GÜVENLİK: Kesin Gizleme Kuralı En Altta Kalmalı */
.hidden, [hidden], .view-hidden { display: none !important; }


/* ========================================================================= */
/* FIX 3 & 4: Mobil Kapsamli Tablo Tasmasi Onlemleri */
/* ========================================================================= */
@media (max-width: 1024px) {
    /* TAKTIK TAHTASI: Sag Kart ve Tablo */
    .right-panel, .squad-zone, .right-bento, .squad-pool-panel {
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    
    .squad-table, .st-body, #squad-table-body {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
    }

    /* MAC MERKEZI: Ana Kapsayici */
    #match-center-workspace, .mc-main-area, .match-workspace, .match-grid {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100vw !important;
        gap: 16px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* MAC MERKEZI: Sağ Kart (Kariyer Tablosu Kartı) */
    .mc-right-panel, .mc-stats-card, .mc-stats-zone {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    /* MAC MERKEZI: Kariyer Tablosu İç Sarmalayıcı */
    .mc-stats-table, .mc-stats-table-wrapper {
        width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
        -webkit-overflow-scrolling: touch !important;
    }
}


@media (max-width: 1024px) {
    /* Maç Merkezi: Maç Geçmişi ve Kariyer Tablosunu Alt Alta İndir */
    .mc-body-grid {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        height: auto !important;
        overflow: visible !important;
        gap: 14px !important;
    }
    .mc-left-panel, .mc-right-panel, .right-panel, .squad-zone {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        margin: 0 !important;
    }
    /* Tabloların İç Kaydırma (Horizontal Scroll) Garantisi */
    .squad-table, .mc-stats-table {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        min-width: 0 !important;
    }
    .squad-table .st-header, .squad-table .st-body {
        min-width: 660px !important;
    }
    .mc-stats-table .st-header, .mc-stats-table .st-body {
        min-width: 540px !important;
    }
    .st-body {
        overflow-x: visible !important;
    }
}

/* GÜVENLİK: Kesin Gizleme Kuralı En Altta Kalmalı */
.hidden, [hidden], .view-hidden { display: none !important; }


/* ========================================================================= */
/* KONSEPT 2 V2: EXECUTIVE BENTO & APPLE FROSTED GLASS TEMA PAKETI           */
/* ========================================================================= */
:root, [data-theme="obsidian"] {
    --bg-app: #080c0a !important;
    --bg-card: rgba(24, 32, 28, 0.68) !important;
    --bg-elevated: rgba(14, 19, 17, 0.65) !important;
    --border-subtle: rgba(255, 255, 255, 0.07) !important;
    --border-focus: rgba(245, 176, 65, 0.38) !important;
    --text-primary: #f8fafc !important;
    --text-secondary: #a3b1aa !important;
    --text-muted: #5e6d65 !important;
    --accent: #f5b041 !important;
    --highlight: #f5b041 !important;
    --emerald-pro: #10b981;
}

.fm-body {
    background-color: #080c0a !important;
    background-image: 
        radial-gradient(ellipse 75% 50% at 50% -15%, rgba(26, 66, 48, 0.42), transparent 70%),
        radial-gradient(circle at 85% 90%, rgba(245, 176, 65, 0.05), transparent 45%),
        radial-gradient(circle at 10% 85%, rgba(16, 42, 31, 0.35), transparent 55%) !important;
}

.bento-card, .modal-content {
    background: rgba(24, 32, 28, 0.68) !important;
    backdrop-filter: blur(30px) saturate(130%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(130%) !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.7), inset 0 1px 0 0 rgba(255, 255, 255, 0.08) !important;
}

/* Executive Navbar & KPI Strip */
.navbar { height: 56px !important; min-height: 56px !important; padding: 0 20px !important; }
.brand-emblem {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #f5b041, #d68910);
    color: #080c0a; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800; box-shadow: 0 4px 14px rgba(245, 176, 65, 0.25);
}
.brand-text h1 { font-size: 13px; font-weight: 800; letter-spacing: 0.3px; color: #f8fafc; margin: 0; line-height: 1.2; }
.brand-text span { font-size: 9px; font-weight: 600; color: #a3b1aa; letter-spacing: 0.6px; text-transform: uppercase; display: block; }

.kpi-strip {
    display: flex; align-items: center; gap: 10px;
    background: rgba(14, 19, 17, 0.65); padding: 5px 14px; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.kpi-item { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.kpi-item:not(:last-child) { border-right: 1px solid rgba(255, 255, 255, 0.07); padding-right: 12px; }
.kpi-label { color: #a3b1aa; font-weight: 500; }
.kpi-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #f5b041; }
.kpi-val.green { color: #10b981; }

.nav-tabs { background: rgba(14, 19, 17, 0.65); padding: 4px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.07); height: auto !important; }
.nav-tab { border-radius: 8px !important; padding: 6px 14px !important; font-weight: 600 !important; border: none !important; }
.nav-tab.active { background: #f5b041 !important; color: #080c0a !important; font-weight: 700 !important; box-shadow: 0 2px 10px rgba(245, 176, 65, 0.25); }

/* Sol Panel Widget Kutuları */
.inst-box {
    background: rgba(14, 19, 17, 0.62); border-radius: 14px; padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.seg-pill.active { background: #f5b041 !important; color: #080c0a !important; font-weight: 700 !important; border-color: #f5b041 !important; }
.plan-btn.active { background: rgba(245, 176, 65, 0.15) !important; color: #f5b041 !important; border: 1px solid rgba(245, 176, 65, 0.4) !important; }

/* Saha & SVG Taktik Bağlantı Hatları */
.modern-pitch {
    border-radius: 18px !important;
    background: 
        radial-gradient(circle at 50% 50%, rgba(22, 53, 39, 0.55) 0%, rgba(9, 20, 15, 0.95) 100%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0px, rgba(255,255,255,0.016) 36px, transparent 36px, transparent 72px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.13) !important;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.75), 0 12px 30px rgba(0,0,0,0.5) !important;
}
.tactical-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* Squircle Bento Oyuncu Rozetleri */
.node-filled {
    width: 42px !important; height: 42px !important; border-radius: 13px !important;
    background: linear-gradient(155deg, rgba(38, 52, 45, 0.94), rgba(15, 22, 19, 0.98)) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}
.node-filled.suit-green { border-color: #10b981 !important; }
.node-filled.suit-yellow { border-color: #f5b041 !important; }
.node-ovr {
    background: #080c0a !important; color: #f5b041 !important;
    border: 1px solid rgba(245, 176, 65, 0.4) !important; border-radius: 5px !important;
}
.node-cap {
    background: #f5b041 !important; color: #080c0a !important;
    border-radius: 4px !important; width: auto !important; height: auto !important; padding: 1px 4px !important;
}
.node-label {
    background: rgba(10, 15, 13, 0.88) !important; backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important; border-radius: 7px !important;
}
.n-role { color: #f5b041 !important; }

/* Kadro Veri Matrisi & Mikro Barlar */
.st-header { background: rgba(0, 0, 0, 0.35) !important; border-radius: 10px !important; border: 1px solid rgba(255, 255, 255, 0.07) !important; }
.squad-row {
    background: rgba(14, 19, 17, 0.62) !important; border-radius: 11px !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important; transition: all 0.16s ease !important;
}
.squad-row:hover {
    background: rgba(38, 50, 44, 0.75) !important; border-color: rgba(255, 255, 255, 0.14) !important; transform: translateX(2px);
}
.squad-row.on-pitch {
    border-left: 3px solid #f5b041 !important;
    background: linear-gradient(90deg, rgba(245, 176, 65, 0.08) 0%, rgba(14, 19, 17, 0.65) 45%) !important;
}
.r-ovr {
    color: #f5b041 !important; background: rgba(245, 176, 65, 0.1);
    padding: 2px 0; border-radius: 5px;
}

/* Kurumsal Mikro Etiketler */
.m-tag { font-family: 'JetBrains Mono', monospace; font-size: 8px; font-weight: 800; padding: 1px 4px; border-radius: 3px; }
.m-tag.cap { background: #f5b041; color: #080c0a; }
.m-tag.vcap { background: rgba(255,255,255,0.14); color: #f8fafc; }
.m-tag.star { background: rgba(245, 176, 65, 0.14); color: #f5b041; border: 1px solid rgba(245, 176, 65, 0.38); }
.m-tag.xi { background: rgba(16, 185, 129, 0.14); color: #10b981; }
.m-tag.rot, .m-tag.bak { background: rgba(255,255,255,0.05); color: #a3b1aa; }

/* İnovatif Mikro İstatistik Barları */
.c-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.stat-bar { width: 20px; height: 2px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.stat-fill { height: 100%; border-radius: 2px; }
.stat-excel { color: #f8fafc !important; } .stat-excel .stat-fill { background: #f5b041; }
.stat-good { color: #a3b1aa !important; } .stat-good .stat-fill { background: #10b981; }
.stat-avg { color: #5e6d65 !important; } .stat-avg .stat-fill { background: #5e6d65; }

/* LED Durum Noktası */
.led-status { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.led-yes { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.led-unsure { background: #f5b041; box-shadow: 0 0 0 3px rgba(245, 176, 65, 0.15); }
.led-no { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

@media (max-width: 900px) {
    .kpi-strip { display: none !important; }
}

/* ========================================================================= */
/* KESİN SEKME GİZLEME KİLİDİ VE ESNEK PENCERE SCROLL ÇÖZÜMÜ                 */
/* ========================================================================= */
#tactics-workspace.hidden,
#match-center-workspace.hidden,
.match-center-zone.hidden,
.dashboard-grid.hidden,
.hidden {
    display: none !important;
}

/* Pencere küçüldüğünde (1280px altı veya dikeyde 820px altı) sayfa scroll kilidini aç */
@media (max-width: 1280px), (max-height: 820px) {
    html, body, .fm-body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    .dashboard-grid:not(.hidden) {
        height: auto !important;
        min-height: calc(100vh - 84px) !important;
        overflow: visible !important;
    }
    .match-center-zone:not(.hidden) {
        height: auto !important;
        overflow: visible !important;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
    }
    #match-center-workspace:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* ========================================================================= */
/* MAÇ MERKEZİ OYUNCU TABLOSU GÖRÜNÜRLÜK YAMASI & PRO ANALİZ PANELİ STİLLERİ */
/* ========================================================================= */
#tab-analysis {
    overflow-y: auto !important;
    padding-right: 6px !important;
}
.radar-wrap {
    min-height: 165px !important;
    flex-shrink: 0 !important;
    background: rgba(14, 19, 17, 0.65) !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
}
#ai-advice {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 4px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}
.an-section {
    background: rgba(14, 19, 17, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.an-title {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #f5b041;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.an-bar-row {
    display: grid;
    grid-template-columns: 62px 1fr 26px;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}
.an-bar-lbl { color: #a3b1aa; font-weight: 600; font-size: 9px; }
.an-bar-track { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.an-bar-fill { height: 100%; border-radius: 99px; }
.fill-att { background: #f87171; }
.fill-mid { background: #f5b041; }
.fill-def { background: #10b981; }
.an-bar-val { font-family: 'JetBrains Mono', monospace; color: #f8fafc; text-align: right; font-size: 11px; }

.an-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.an-kpi-box {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.an-kpi-box span { font-size: 8px; color: #a3b1aa; font-weight: 700; }
.an-kpi-box strong { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #f8fafc; }

.an-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #a3b1aa;
}
.an-list-item strong { color: #f8fafc; font-weight: 600; }

.an-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 10px;
    line-height: 1.35;
    padding: 6px 8px;
    border-radius: 8px;
}
.note-ok { background: rgba(16, 185, 129, 0.1); color: #d1fae5; border: 1px solid rgba(16, 185, 129, 0.25); }
.note-ok i { color: #10b981; margin-top: 2px; }
.note-warn { background: rgba(245, 176, 65, 0.12); color: #fef3c7; border: 1px solid rgba(245, 176, 65, 0.3); }
.note-warn i { color: #f5b041; margin-top: 2px; }

/* Maç Merkezi Sağ Panel ve Oyuncu Tablosu Görünürlük Garantisi */
.mc-body-grid {
    min-height: 520px !important;
}
.mc-right-panel {
    display: flex !important;
    flex-direction: column !important;
    min-height: 450px !important;
    overflow: visible !important;
}
.mc-stats-table {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 380px !important;
    width: 100% !important;
    overflow-x: auto !important;
}
#mc-player-stats {
    flex: 1 !important;
    min-height: 320px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
}

/* ========================================================================= */
/* YENİ MAÇ MERKEZİ RAPOR EKRANI & GÖRSEL SAHA KURUCU (MATCH BUILDER)        */
/* ========================================================================= */
.mc-match-item.active-match {
    border-left: 3px solid #f5b041 !important;
    background: linear-gradient(90deg, rgba(245, 176, 65, 0.14) 0%, rgba(14, 19, 17, 0.75) 100%) !important;
    border-color: rgba(245, 176, 65, 0.35) !important;
}

#mc-report-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow-y: auto !important;
}

.mr-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(14, 19, 17, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 18px;
    flex-wrap: wrap;
    gap: 12px;
}
.mr-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 800;
    color: #f5b041;
    letter-spacing: 0.8px;
}
.mr-banner-left h3 { font-size: 16px; font-weight: 800; color: #f8fafc; margin: 2px 0; }
.mr-date { font-size: 11px; color: #a3b1aa; }

.mr-score-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 18px;
    border-radius: 12px;
    border: 1px solid rgba(245, 176, 65, 0.3);
}
.mr-team-tag { font-size: 10px; font-weight: 800; color: #a3b1aa; letter-spacing: 0.5px; }
.mr-score-num { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 800; color: #f5b041; }

.mr-kpi-group { display: flex; gap: 12px; }
.mr-kpi {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 7px 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mr-kpi span { font-size: 9px; color: #a3b1aa; font-weight: 700; }
.mr-kpi strong { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #f5b041; }

.mr-notes {
    background: rgba(245, 176, 65, 0.08);
    border-left: 3px solid #f5b041;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mr-notes i { color: #f5b041; }

.mr-pitches-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 410px;
}
.mr-pitch-card, .mr-player-breakdown {
    background: rgba(14, 19, 17, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mr-pitch-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #a3b1aa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 6px;
}
.mr-report-pitch {
    width: 100% !important;
    max-width: 340px !important;
    margin: auto !important;
    aspect-ratio: 0.74 !important;
}

.mr-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: 390px;
}
.mr-perf-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 9px;
    font-size: 11px;
}
.mr-perf-row.mvp-row {
    border-left: 3px solid #f5b041;
    background: rgba(245, 176, 65, 0.08);
}
.mr-rating-bar-wrap {
    width: 70px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}
.mr-rating-bar { height: 100%; background: linear-gradient(90deg, #10b981, #f5b041); border-radius: 99px; }
.mr-rating-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #f5b041;
    min-width: 28px;
    text-align: right;
}

/* GÖRSEL MAÇ KURUCU (MATCH BUILDER MODAL) */
.mb-top-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}
.mb-workspace {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 14px;
    flex: 1;
    min-height: 420px;
    overflow: hidden;
}
.mb-pool-box {
    background: rgba(14, 19, 17, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}
.mb-box-head {
    font-size: 10px;
    font-weight: 800;
    color: #f5b041;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 6px;
}
.mb-pool-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 4px;
}
.mb-pool-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    cursor: grab;
    transition: 0.15s;
}
.mb-pool-item:hover { background: rgba(255, 255, 255, 0.08); }
.mb-pool-item.mb-assigned { opacity: 0.45; }
.mb-pool-item.mb-selected { border-color: #f5b041; background: rgba(245, 176, 65, 0.15); }

.mb-pitches-area {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: stretch;
    overflow-x: auto;
}
.mb-pitch-col {
    flex: 1;
    max-width: 380px;
    background: rgba(14, 19, 17, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mb-pitch-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mb-mini-pitch {
    width: 100% !important;
    max-width: 310px !important;
    margin: auto !important;
    aspect-ratio: 0.74 !important;
}
.mb-rating-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #f5b041;
}
.mb-rating-input {
    width: 36px;
    background: #080c0a;
    color: #f5b041;
    border: 1px solid rgba(245, 176, 65, 0.45);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    padding: 1px 2px;
}

@media (max-width: 960px) {
    .mr-pitches-grid, .mb-workspace, .mb-top-controls {
        grid-template-columns: 1fr !important;
    }
    .mb-pitches-area {
        flex-direction: column !important;
        align-items: center !important;
    }
}


/* ========================================================================= */
/* MAÇ MERKEZİ & MAÇ KURUCU SAHA KOORDİNAT KİLİDİ VE INPUT DÜZELTMESİ        */
/* ========================================================================= */

/* 1. KRİTİK DÜZELTME: Sahalara position: relative vererek oyuncuların saha dışına taşmasını engelle */
.executive-pitch,
.mr-report-pitch,
.mb-mini-pitch,
#mr-pitch-view-a,
#mr-pitch-view-b,
#mb-pitch-a,
#mb-pitch-b {
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 330px !important;
    height: auto !important;
    aspect-ratio: 0.74 / 1 !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
    background: 
        radial-gradient(circle at 50% 50%, rgba(22, 53, 39, 0.55) 0%, rgba(9, 20, 15, 0.96) 100%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0px, rgba(255,255,255,0.016) 34px, transparent 34px, transparent 68px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.75), 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

/* 2. Saha içi çizgilerin (orta çizgi, orta yuvarlak, ceza sahası) sadece kendi sahasında kalmasını sağla */
.executive-pitch .pl-mid {
    position: absolute !important;
    top: 50% !important;
    left: 0 !important;
    width: 100% !important;
    height: 1px !important;
    background: rgba(255, 255, 255, 0.14) !important;
}
.executive-pitch .pl-circle {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 24% !important;
    aspect-ratio: 1 / 1 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 50% !important;
    transform: translate(-50%, -50%) !important;
}
.executive-pitch .pl-box-top {
    position: absolute !important;
    top: 0 !important;
    left: 25% !important;
    width: 50% !important;
    height: 15% !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-top: none !important;
}
.executive-pitch .pl-box-bot {
    position: absolute !important;
    bottom: 0 !important;
    left: 25% !important;
    width: 50% !important;
    height: 15% !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-bottom: none !important;
}

/* 3. Küçük sahalardaki oyuncu düğümlerini saha boyutuna göre zarifçe ölçekle */
.mr-report-pitch .pitch-slot,
.mb-mini-pitch .pitch-slot {
    transform: translate(-50%, -50%) scale(0.86) !important;
    z-index: 5 !important;
}

/* 4. Puan (?/10) input kutusunda 7,5 sayısının kesilmesini önle ve okları kaldır */
.mb-rating-input {
    width: 44px !important;
    height: 20px !important;
    background: #080c0a !important;
    color: #f5b041 !important;
    border: 1px solid rgba(245, 176, 65, 0.5) !important;
    border-radius: 5px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-align: center !important;
    padding: 0 2px !important;
    -moz-appearance: textfield !important;
}
.mb-rating-input::-webkit-outer-spin-button,
.mb-rating-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* 5. Modal üstündeki beyaz kalan aksiyon butonlarını ve select kutularını koyu altın temaya bağla */
.btn-exec,
#mb-import-plan-btn,
#mb-auto-split-btn {
    padding: 7px 13px !important;
    border-radius: 9px !important;
    border: 1px solid rgba(245, 176, 65, 0.4) !important;
    background: rgba(245, 176, 65, 0.14) !important;
    color: #f5b041 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: 0.15s ease !important;
}
.btn-exec:hover,
#mb-import-plan-btn:hover,
#mb-auto-split-btn:hover {
    background: #f5b041 !important;
    color: #080c0a !important;
}

.hud-select,
#mb-form-a,
#mb-form-b {
    background: #121815 !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 7px !important;
    padding: 4px 10px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    outline: none !important;
    cursor: pointer !important;
}

/* 6. Modal içindeki çalışma alanının dikey taşmasını önle */
#modal-match-log .modal-content {
    overflow-y: auto !important;
}
.mb-workspace {
    min-height: 440px !important;
    align-items: stretch !important;
}
.mb-pitch-col {
    justify-content: flex-start !important;
}


/* ========================================================================= */
/* UI/UX PRO MAX - GÖRSEL HİZALAMA & FROSTED GLASS KUSURSUZLAŞTIRMA          */
/* ========================================================================= */

/* 1 & 2. Saha Koordinat Kilidi ve Mini Saha Ölçeklendirmesi */
.executive-pitch,
.mr-report-pitch,
.mb-mini-pitch,
#mr-pitch-view-a,
#mr-pitch-view-b,
#mb-pitch-a,
#mb-pitch-b {
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 325px !important;
    height: auto !important;
    aspect-ratio: 0.74 / 1 !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
    background: 
        radial-gradient(circle at 50% 50%, rgba(22, 53, 39, 0.55) 0%, rgba(9, 20, 15, 0.96) 100%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0px, rgba(255,255,255,0.016) 34px, transparent 34px, transparent 68px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.75), 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

.executive-pitch .pl-mid {
    position: absolute !important;
    top: 50% !important;
    left: 0 !important;
    width: 100% !important;
    height: 1px !important;
    background: rgba(255, 255, 255, 0.14) !important;
}
.executive-pitch .pl-circle {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 24% !important;
    aspect-ratio: 1 / 1 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 50% !important;
    transform: translate(-50%, -50%) !important;
}
.executive-pitch .pl-box-top {
    position: absolute !important;
    top: 0 !important;
    left: 25% !important;
    width: 50% !important;
    height: 15% !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-top: none !important;
}
.executive-pitch .pl-box-bot {
    position: absolute !important;
    bottom: 0 !important;
    left: 25% !important;
    width: 50% !important;
    height: 15% !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-bottom: none !important;
}

.mr-report-pitch .pitch-slot,
.mb-mini-pitch .pitch-slot {
    transform: translate(-50%, -50%) scale(0.85) !important;
    z-index: 5 !important;
}

/* 3. Puan Input Kutusunun Kesilmesini Engelle ve Okları Kaldır */
.mb-rating-input {
    width: 44px !important;
    height: 20px !important;
    background: #080c0a !important;
    color: #f5b041 !important;
    border: 1px solid rgba(245, 176, 65, 0.5) !important;
    border-radius: 5px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-align: center !important;
    padding: 0 3px !important;
    -moz-appearance: textfield !important;
    font-variant-numeric: tabular-nums !important;
}
.mb-rating-input::-webkit-outer-spin-button,
.mb-rating-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* 4. Modal Buton ve Select Kutularını Altın Temaya Bağla */
.btn-exec,
#mb-import-plan-btn,
#mb-auto-split-btn {
    background: rgba(245, 176, 65, 0.14) !important;
    color: #f5b041 !important;
    border: 1px solid rgba(245, 176, 65, 0.4) !important;
    border-radius: 9px !important;
    padding: 7px 13px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: 0.15s ease !important;
}
.btn-exec:hover,
#mb-import-plan-btn:hover,
#mb-auto-split-btn:hover {
    background: #f5b041 !important;
    color: #080c0a !important;
}

.hud-select,
#mb-form-a,
#mb-form-b {
    background: #121815 !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 7px !important;
    padding: 4px 10px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    outline: none !important;
    cursor: pointer !important;
}

/* 5. Bento Kart Derinlik ve Üst Işık Kırılması, Tabular Nums */
.bento-card,
.mr-pitch-card,
.mr-player-breakdown,
.mb-pool-box,
.mb-pitch-col,
.modal-content.bento-card {
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.mr-score-num,
.c-num,
.node-number,
.mb-rating-input,
.mb-rating-wrap,
.mr-rating-badge,
.mc-value {
    font-variant-numeric: tabular-nums !important;
}


/* ========================================================================= */
/* BULUT SENKRONİZASYON, YÖNETİCİ KİLİDİ VE PNG İNDİRME DÜZELTMELERİ         */
/* ========================================================================= */

.pitch-lines { z-index: 1 !important; }
.tactical-links { z-index: 2 !important; }
.pitch-slot { z-index: 10 !important; }
.node-filled { z-index: 11 !important; }
.node-label { z-index: 12 !important; padding: 3px 9px !important; }
.n-name {
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.25 !important;
}

/* İzleyici modunda düzenleme ve silme butonlarını gizle, inceleme serbest kalsın */
body.readonly-mode #btn-new-match,
body.readonly-mode #open-add-modal-btn,
body.readonly-mode .mc-match-delete,
body.readonly-mode .node-actions,
body.readonly-mode #clear-pitch-btn,
body.readonly-mode #auto-pick-btn,
body.readonly-mode #delete-player-btn,
body.readonly-mode #player-form button[type="submit"] {
    display: none !important;
}


/* ========================================================================= */
/* AMBIENT FROSTED GLASS & SPOTLIGHT UI SYSTEM                               */
/* ========================================================================= */

:root {
    --bg: #060d09 !important;
    --glass: rgba(255, 255, 255, 0.045);
    --glass-2: rgba(255, 255, 255, 0.075);
    --glass-3: rgba(255, 255, 255, 0.11);
    --stroke: rgba(255, 255, 255, 0.085);
    --stroke-2: rgba(255, 255, 255, 0.16);
    --ink: #F2F1F7;
    --muted: #A3A0B5;
    --dim: #6E6B82;
    --indigo: #eab308 !important;
    --indigo-2: #f5b041 !important;
    --orange: #10b981 !important;
    --accent: #f5b041 !important;
    --ok: #34D399;
    --warn: #FBBF24;
    --bad: #F87171;
    --ok-bg: rgba(52, 211, 153, 0.13);
    --warn-bg: rgba(251, 191, 36, 0.13);
    --bad-bg: rgba(248, 113, 113, 0.14);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --display: "Sora", system-ui, sans-serif;
    --body: "Plus Jakarta Sans", system-ui, sans-serif;
    --r: 20px;
}

body.fm-body {
    background-color: var(--bg) !important;
    color: var(--ink) !important;
    font-family: var(--body) !important;
}

h1, h2, h3, h4, h5, h6, .brand-text h1, .mc-label, .mc-value {
    font-family: var(--display) !important;
}

.mr-score-num, .c-num, .node-number, .mb-rating-input, .mb-rating-wrap, .mr-rating-badge, .mc-value {
    font-variant-numeric: tabular-nums !important;
}

/* --- AMBIENT ORBS --- */
.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.ambient i {
    position: absolute;
    filter: blur(90px);
    opacity: 0.55;
    border-radius: 50%;
}
.ambient .o1 {
    width: 520px; height: 520px;
    top: -100px; right: -100px;
    background: radial-gradient(circle, rgba(245, 176, 65, 0.35) 0%, rgba(245, 176, 65, 0) 70%);
    animation: drift 22s infinite alternate var(--ease);
}
.ambient .o2 {
    width: 560px; height: 560px;
    top: 30%; left: -150px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.32) 0%, rgba(16, 185, 129, 0) 70%);
    animation: drift 28s infinite alternate-reverse var(--ease);
}
.ambient .o3 {
    width: 420px; height: 420px;
    bottom: -50px; right: 20%;
    background: radial-gradient(circle, rgba(20, 83, 45, 0.45) 0%, rgba(20, 83, 45, 0) 70%);
    opacity: 0.28;
}

@keyframes drift {
    to { transform: translate(-60px, 50px) scale(1.12); }
}

/* --- SPOTLIGHT GLASS CARDS --- */
.bento-card, .glass, .mr-pitch-card, .mc-stat-card, .mb-pool-box, .mb-pitch-col, .mr-player-breakdown, .modal-content {
    background: linear-gradient(180deg, var(--glass-2), var(--glass)) !important;
    border: 1px solid var(--stroke) !important;
    border-radius: var(--r) !important;
    backdrop-filter: blur(22px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(150%) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 20px 50px -30px rgba(0, 0, 0, 0.8) !important;
    position: relative;
    isolation: isolate;
    transition: transform 0.6s var(--ease), border-color 0.6s var(--ease) !important;
    z-index: 1; /* relative to ambient */
}

/* Interaktif Kart Hover Efekti */
.mc-stat-card:hover, .mr-pitch-card:hover, .mr-player-breakdown:hover, .mc-match-row:hover {
    transform: translateY(-3px) !important;
    border-color: var(--stroke-2) !important;
}

/* Fare Takibi Işık Halesi */
.bento-card::before, .glass::before, .mr-pitch-card::before, .mc-stat-card::before, .mb-pool-box::before, .mb-pitch-col::before, .mr-player-breakdown::before {
    content: ""; 
    position: absolute; 
    inset: 0; 
    border-radius: inherit; 
    pointer-events: none; 
    z-index: -1; 
    opacity: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(245, 176, 65, 0.14), transparent 45%) !important;
    transition: opacity 0.5s var(--ease) !important;
}
.bento-card:hover::before, .glass:hover::before, .mr-pitch-card:hover::before, .mc-stat-card:hover::before, .mb-pool-box:hover::before, .mb-pitch-col:hover::before, .mr-player-breakdown:hover::before { 
    opacity: 1 !important; 
}

/* --- Kayan Seçim (Sliding Pill Indicator) Stilleri --- */
.nav-tab.active, .panel-tab.active, .plan-btn.active, .btn-exec {
    background: linear-gradient(160deg, #f5b041, #d97706) !important;
    color: #060d09 !important;
    font-weight: 700 !important;
    border-color: transparent !important;
    box-shadow: 0 8px 24px -6px rgba(245, 176, 65, 0.45) !important;
    transition: transform 0.6s var(--ease), background 0.6s var(--ease), box-shadow 0.6s var(--ease) !important;
}
.nav-tab.active:active, .panel-tab.active:active, .plan-btn.active:active, .btn-exec:active {
    transform: scale(0.96) !important;
}

/* --- Kademeli Animasyonlar (Rise & Slide-in) --- */
.rise { 
    animation: rise 0.9s var(--ease) both !important; 
    animation-delay: calc(var(--k, 0) * 70ms) !important; 
}
@keyframes rise { 
    from { transform: translateY(14px) scale(0.99); opacity: 0.5; } 
}

.modal-content {
    animation: slidein 0.6s var(--ease) both !important;
}
@keyframes slidein { 
    from { transform: translateX(60px); opacity: 0.3; } 
}

/* --- Parlayan Rozetler ve Neon Çipler --- */
.led-dot {
    display: inline-block;
    width: 7px; height: 7px; 
    border-radius: 50%; 
    background: var(--ok); 
    box-shadow: 0 0 10px var(--ok);
    margin-right: 6px;
}
.led-warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.led-bad { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

.neon-chip {
    display: inline-block;
    width: 10px; height: 34px; 
    border-radius: 6px; 
    background: var(--c, var(--indigo)); 
    box-shadow: 0 0 14px -2px var(--c, var(--indigo));
    vertical-align: middle;
}
/* --- CUSTOM ALERTS & TOASTS --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.custom-toast {
    background: #060d09;
    color: #f5b041;
    border: 1px solid rgba(245, 176, 65, 0.2);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s var(--ease), opacity 0.3s;
    pointer-events: auto;
}
.custom-toast.show { transform: translateX(0); }
.custom-toast.success { color: #10b981; border-color: rgba(16, 185, 129, 0.2); }
.custom-toast.error { color: #f87171; border-color: rgba(248, 113, 113, 0.2); }

#custom-dialog-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
    z-index: 9999998; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#custom-dialog-overlay.show { opacity: 1; pointer-events: auto; }
#custom-dialog {
    background: #08110c; border: 1px solid rgba(245, 176, 65, 0.2);
    border-radius: 12px; padding: 24px; width: 90%; max-width: 400px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    transform: translateY(20px) scale(0.95); transition: transform 0.2s var(--ease);
}
#custom-dialog-overlay.show #custom-dialog { transform: translateY(0) scale(1); }
#custom-dialog h3 { margin: 0 0 12px 0; font-size: 18px; color: #f5b041; }
#custom-dialog p { margin: 0 0 20px 0; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
#custom-dialog input {
    width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
    color: #fff; font-size: 16px; margin-bottom: 20px; outline: none;
}
#custom-dialog input:focus { border-color: #f5b041; }
#custom-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
#custom-dialog-actions button {
    padding: 8px 16px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
#custom-dialog-cancel { background: rgba(255,255,255,0.1); color: #fff; }
#custom-dialog-cancel:hover { background: rgba(255,255,255,0.15); }
#custom-dialog-confirm { background: #f5b041; color: #060d09; }
#custom-dialog-confirm:hover { filter: brightness(1.1); }
