:root { --gold: #d4af37; --bg: #1a1a1a; --card: #2d2d2d; --panel: #333; --text: #ffffff; --green: #44ff44; --red: #ff4444; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 10px; overflow-x: hidden; }

/* DASHBOARD SPLIT LAYOUT */
.top-dashboard { display: flex; gap: 15px; margin-bottom: 10px; align-items: stretch; }
.left-col { flex: 1; display: flex; flex-direction: column; }
.right-col { flex: 1.2; display: flex; flex-direction: column; } /* 1.2 gives summary slightly more room */
.right-col .section-card { flex-grow: 1; margin-bottom: 0; }
.left-col .section-card { margin-bottom: 0; }

.section-card { background: var(--panel); border-radius: 8px; border: 1px solid #444; margin-bottom: 10px; overflow: hidden; }
.section-header { padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: rgba(255,255,255,0.05); }
.section-header h2 { margin: 0; font-size: 0.85em; text-transform: uppercase; color: var(--gold); letter-spacing: 1px; display: flex; align-items: center; gap: 10px;}
.section-content { padding: 15px; display: block; }
.collapsed .section-content { display: none; }

.top-utility-wrap { display: flex; flex-direction: column; flex: 1; min-width: 30%; gap: 4px; }
.top-utility-label { font-size: 0.7em; color: #aaa; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; padding-left: 2px;}
.top-utility { padding: 10px; background: #222; color: var(--gold); border: 1px solid #444; border-radius: 6px; font-weight: bold; font-size: 0.9em; width: 100%; transition: all 0.2s;}
.top-utility:disabled { opacity: 0.4; cursor: not-allowed; color: #777; border-color: #333; background: #1a1a1a; }
.champ-select-wrap { margin-bottom: 10px; }
.champ-select { text-align: center; font-size: 1.05em; padding: 12px; }

.setting-row { margin-bottom: 15px; }
.setting-label { display: flex; justify-content: space-between; font-size: 0.8em; margin-bottom: 5px; font-weight: bold; }
input[type="range"] { width: 100%; accent-color: var(--gold); cursor: pointer; }

.toggle-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.gh-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; background: #222; padding: 10px; border-radius: 6px; font-size: 0.85em; cursor: pointer; flex: 1; border: 1px solid #444; min-width: 45%;}
.gh-toggle input { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer;}

.rng-btn { width: 100%; padding: 12px; background: linear-gradient(180deg, #d4af37, #9a7b1b); color: #000; font-weight: 900; font-size: 1.1em; border: none; border-radius: 6px; cursor: pointer; text-transform: uppercase; box-shadow: 0 4px 6px rgba(0,0,0,0.4); transition: transform 0.1s; }
.rng-btn:active { transform: scale(0.98); }
.reset-btn { background: linear-gradient(180deg, #cc3333, #881111); color: white; }

.glyph-row { display: flex; flex-direction: column; gap: 8px; padding-top: 5px; border-top: 1px solid #444; }
.glyph-row label { font-size: 0.8em; font-weight: bold; color: #ccc; display: flex; flex-direction: column; gap: 4px; margin-top: 10px;}
.glyph-row select { padding: 6px; background: #111; color: var(--gold); border: 1px solid #555; border-radius: 4px; font-weight: bold; }

/* SETS CSS */
.set-category { margin-bottom: 15px; }
.set-cat-header { font-size: 0.75em; text-transform: uppercase; color: #888; margin-bottom: 8px; font-weight: bold; border-bottom: 1px solid #444; padding-bottom: 4px;}
.set-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; empty-cells: hide;}
.set-row { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.4); padding: 6px 10px; border-radius: 4px; font-size: 0.85em; }
.set-name { font-weight: bold; color: var(--gold); }
.set-controls { display: flex; align-items: center; gap: 8px; }
.btn-set { background: #444; border: none; color: white; width: 22px; height: 22px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.btn-set:disabled { opacity: 0.2; cursor: not-allowed; }
.btn-del { background: var(--red); color: white; border: none; width: 22px; height: 22px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.set-select { width: 100%; padding: 6px; background: #111; color: white; border: 1px solid #555; border-radius: 4px; font-weight: bold;}
.set-select option:disabled { color: #555; font-style: italic; }

/* MASTERY CSS */
.mastery-container { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; font-size: 0.8em; width: 100%; }
.tree-col { padding: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); width: 100%; transition: all 0.2s; }
.tree-col.disabled { opacity: 0.2; filter: grayscale(1); pointer-events: none; }
.offense-bg { background: linear-gradient(180deg, #3d0000, #1a0000); }
.defense-bg { background: linear-gradient(180deg, #002d00, #001a00); }
.support-bg { background: linear-gradient(180deg, #002d5a, #001a33); }
.tree-name { font-weight: 900; margin-bottom: 8px; display: block; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 4px; color: #fff;}
.mastery-item { display: flex; align-items: flex-start; gap: 5px; margin-bottom: 8px; cursor: pointer; width: 100%; }
.mastery-item.locked { opacity: 0.3; pointer-events: none; }
.mastery-item input { margin-top: 2px; accent-color: var(--gold); width: 14px; height: 14px; cursor: pointer;}
.m-info { display: flex; flex-direction: column; width: 100%; line-height: 1.2;}
.m-title { font-weight: bold; color: #eee; }
.m-stat { color: var(--gold); font-size: 0.9em; }

/* GRID CSS */
.gear-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px;}
.gear-card { background: #262626; border-radius: 8px; border: 1px solid #444; position: relative; cursor: pointer; min-height: 120px; transition: transform 0.1s; display: flex; flex-direction: column; overflow: hidden;}
.gear-card.expanded { grid-column: span 3; cursor: default; }

.card-header { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: center; font-size: 0.7em; font-weight: bold; color: #888; display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 2;}
.rank-toggle { display: flex; background: #111; border-radius: 4px; overflow: hidden; border: 1px solid #444; z-index: 2;}
.btn-rank { background: transparent; color: #888; border: none; padding: 3px 8px; font-size: 0.9em; cursor: pointer; font-weight: bold; }
.btn-rank.active { background: var(--gold); color: black; }

.primary-display { padding: 8px 5px 5px 5px; text-align: center; color: var(--gold); font-weight: bold; font-size: 0.9em; position: relative; z-index: 2;}
.primary-select { background: #111; color: var(--gold); border: 1px solid #555; border-radius: 4px; padding: 2px; font-weight: bold; font-size: 0.9em; width: 90%; text-align: center; margin-bottom: 4px;}
.primary-val { font-size: 1.1em; display: block; }

.limits-bar { display: none; background: #111; color: #aaa; font-size: 0.65em; text-align: center; padding: 4px; border-bottom: 1px solid #333; z-index: 2;}
.expanded .limits-bar { display: flex; justify-content: space-around; }

.sub-stat-list { padding: 6px; font-size: 0.72em; flex-grow: 1; position: relative; z-index: 2;}

.sub-row { display: flex; margin-bottom: 6px; background: rgba(0,0,0,0.4); border-radius: 4px; }

.gear-card:not(.expanded) .sub-row { flex-direction: column; align-items: center; justify-content: center; padding: 4px 2px; gap: 2px; }
.gear-card:not(.expanded) .stat-toggle input { display: none; }
.gear-card:not(.expanded) .sub-val { text-align: center; font-size: 0.8em; letter-spacing: -0.5px; }
.gear-card:not(.expanded) .sub-label { font-size: 0.9em; letter-spacing: -0.2px; }

.gear-card.expanded .sub-row { flex-direction: row; justify-content: space-between; align-items: center; padding: 4px 8px; }
.gear-card.expanded .sub-val { text-align: right; flex-grow: 1; padding-right: 10px; }

.m-info-grid { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex-shrink: 1; }
.stat-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 0.95em; }
.stat-toggle input { margin: 0; width: 12px; height: 12px; accent-color: var(--gold); flex-shrink: 0;}
.stat-toggle input:disabled { opacity: 0.3; cursor: not-allowed;}

.sub-label { color: #ccc; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-val { font-weight: bold; white-space: nowrap; font-size: 0.95em; }

.stepper { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.btn-step { background: #444; border: none; color: white; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.btn-step:disabled { opacity: 0.2; cursor: not-allowed; }
.hit-count { min-width: 15px; text-align: center; font-weight: bold; }

.hit-mythic { color: #ff4444 !important; }
.hit-leggo { color: var(--gold) !important; }
.hit-epic { color: #b388ff !important; }
.hit-default { color: #ffffff !important; }

.glow-mythic { color: #ff4444; text-shadow: 0 0 8px rgba(255, 68, 68, 0.7); }
.glow-leggo { color: var(--gold); text-shadow: 0 0 8px rgba(212, 175, 55, 0.7); }
.glow-epic { color: #b388ff; text-shadow: 0 0 8px rgba(179, 136, 255, 0.7); }

.roll-ind { font-size: 0.9em; margin-left: 2px; font-family: monospace; font-weight: 900;}
.glyph-val { color: var(--green); margin-left: 3px; font-weight: bold; }

/* ADVANCED SUMMARY CSS */
.summary-wrapper { padding: 15px; background: rgba(0,0,0,0.3); border-radius: 6px;}
.summary-grid { display: grid; grid-template-columns: 1fr auto 90px 60px; row-gap: 8px; align-items: center; font-size: 0.9em; max-width: 550px; margin: 0 auto; }
.sum-ranges { text-align: right; font-family: monospace; font-size: 1.05em; color: #aaa; letter-spacing: -0.5px;}
.sum-label { text-align: right; color: var(--gold); font-weight: bold; padding: 0 10px; min-width: 80px; }
.sum-final { text-align: left; color: var(--green); font-size: 1.15em; font-weight: 900; font-family: monospace; letter-spacing: -0.5px;}
.sum-goal { text-align: center; }
.sum-goal input { width: 100%; max-width: 55px; background: #111; color: var(--gold); border: 1px solid #555; border-radius: 4px; text-align: center; font-size: 0.95em; font-weight: bold; padding: 3px; font-family: monospace;}
.sum-goal input:disabled { color: #888; border-color: #333; background: #222; opacity: 1; -webkit-text-fill-color: #888;}

.col-header { color: #888; font-size: 0.7em; text-transform: uppercase; font-weight: bold; letter-spacing: 0.5px;}
.ehp-row { color: #00ffff !important; }

.override-btn { background:#444; color:white; border:none; padding:4px 8px; border-radius:4px; font-weight:bold; font-size:0.75em; cursor:pointer; text-transform:uppercase; letter-spacing:0.5px; transition:all 0.2s; }
.override-btn.active { background:var(--gold); color:#000; box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);}

@media (max-width: 600px) { 
    /* Force mobile to stack vertically instead of side-by-side */
    .top-dashboard { flex-direction: column; gap: 0; margin-bottom: 0; }
    .left-col .section-card { margin-bottom: 10px; }
    .right-col .section-card { margin-bottom: 10px; }

    /* Keep the rest of your original mobile tweaks */
    .gear-grid { gap: 5px; } 
    .mastery-container { grid-template-columns: 1fr; gap: 15px;} 
    .primary-display { font-size: 0.8em; }
    .summary-grid { max-width: 100%; grid-template-columns: 1fr auto 75px 50px; gap: 4px; }
    .sum-ranges { font-size: 0.85em; letter-spacing: -0.8px;}
    .sum-label { font-size: 0.9em; padding: 0 4px; min-width: auto;}
    .sum-final { font-size: 0.95em; }
    .sum-goal input { font-size: 0.85em; padding: 2px; }
}