/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Styles */
.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: scale(0.95) translateY(-10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .modal-container {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(96, 165, 250, 0.2);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.modal-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex: 1;
    line-height: 1.3;
}

.modal-close-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    color: var(--text-primary);
    transform: scale(1.1);
}

.modal-close-btn:active {
    transform: scale(0.95);
}

.modal-content {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-content p {
    margin-bottom: 12px;
}

.modal-content p:last-child {
    margin-bottom: 0;
}

.modal-content em {
    color: inherit;
    font-style: italic;
}
:root {
    /* Light Theme (default) - Blue Hue from Logo */
    --bg-primary: #e3f2fd;
    --bg-secondary: #bbdefb;
    --bg-card: #f5f9fc;
    --bg-card-hover: #e3f2fd;
    --accent-green: #2B5F93;
    --accent-green-dim: rgba(43, 95, 147, 0.15);
    --accent-red: #d32f2f;
    --accent-red-dim: rgba(211, 47, 47, 0.15);
    --accent-blue: #2B5F93;
    --accent-amber: #f57c00;
    --text-primary: #1E4976;
    --text-secondary: #2B5F93;
    --text-muted: #5A9BD5;
    --border-color: rgba(43, 95, 147, 0.25);
    --border-color-hover: rgba(43, 95, 147, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    /* Military/Tactical Dark Theme - Blue Accent */
    --bg-primary: #0a0f14;
    --bg-secondary: #111a22;
    --bg-card: #1a2a36;
    --bg-card-hover: #1f2f3f;
    --accent-green: #60a5fa;
    --accent-green-dim: rgba(96, 165, 250, 0.15);
    --accent-red: #f87171;
    --accent-red-dim: rgba(248, 113, 113, 0.15);
    --accent-blue: #60a5fa;
    --accent-amber: #fbbf24;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(96, 165, 250, 0.2);
    --border-color-hover: rgba(96, 165, 250, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

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

/* Font Size Options - applies to all elements with !important */
:root {
    --font-size-small: 14px;
    --font-size-medium: 16px;
    --font-size-large: 18px;
    --font-size-xlarge: 20px;
    --font-size-xxlarge: 24px;
}

html {
    font-size: 16px;
}

html[data-font-size="small"] * {
    font-size: var(--font-size-small) !important;
}

html[data-font-size="medium"] * {
    font-size: var(--font-size-medium) !important;
}

html[data-font-size="large"] * {
    font-size: var(--font-size-large) !important;
}

html[data-font-size="xlarge"] * {
    font-size: var(--font-size-xlarge) !important;
}

html[data-font-size="xxlarge"] * {
    font-size: var(--font-size-xxlarge) !important;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Container - Mobile First */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 8px;
}

/* Header - Mobile First */
.header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    flex: 0 0 auto;
}

.settings-menu-wrapper {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
}

.settings-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.settings-btn:active {
    transform: scale(0.98);
}

.settings-icon {
    font-size: 18px;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 260px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
}

.settings-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Theme Toggle */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.theme-toggle-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.theme-toggle {
    position: relative;
    width: 56px;
    height: 28px;
    background: var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.theme-toggle.active {
    background: var(--accent-blue);
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: var(--bg-card);
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.active .theme-toggle-slider {
    transform: translateX(28px);
}

/* Font Size Toggle */
.font-size-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-color);
    width: 100%;
}

.font-size-btn {
    flex: 1;
    padding: 8px 6px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.font-size-btn:hover {
    background: var(--bg-card-hover);
}

.font-size-btn.active {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Controls Bar */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group.stacked {
    padding: 0 20px;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-label-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.control-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Control Input Wrapper */
.control-input-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Info Button */
.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    padding: 0;
    background: var(--accent-blue);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.info-btn:hover {
    background: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.info-btn:active {
    transform: scale(0.95);
}

/* Stat label wrapper with info button */
.stat-label-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
}

.stat-info-btn {
    margin-top: 2px;
    flex-shrink: 0;
}

.control-input {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    width: 60px;
    text-align: center;
}

.control-input:focus {
    outline: none;
    border-color: var(--accent-green);
}

.control-select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

/* Engine Toggle */
.engine-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-color);
    width: 100%;
}

.engine-toggle-btn {
    flex: 1;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.engine-toggle-btn:hover {
    color: var(--text-primary);
}

.engine-toggle-btn.active {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Main Grid - Mobile First (stacked) */
.main-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 10px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Left Column - Weapon Selection */
.weapon-section {
    flex: 0 0 auto;
    padding-left: 8px;
}

.weapon-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-display {
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.stat-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-green);
}

.weapon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 100%;
    text-align: center;
}

.weapon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.weapon-btn.active {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.weapon-btn.active .weapon-effectiveness {
    color: rgba(255, 255, 255, 0.9);
}

.weapon-label {
    text-align: center;
}

.weapon-effectiveness {
    font-family: 'Space Mono', monospace;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

/* Combined Card Layout */
.combined-card {
    margin-bottom: 8px;
    padding: 10px;
}

.combined-content {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.weapon-section {
    flex: 1;
}

/* Gauge Section */
.gauge-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

.gauge-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
}

.gauge-svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--accent-red);
    stroke-width: 20;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 20;
    stroke-linecap: butt;
    transition: stroke-dashoffset 0.8s ease-out;
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 3px));
    text-align: center;
}

.gauge-center img {
    width: 135px;
    height: 135px;
    object-fit: contain;
}

/* Gauge percentage labels with pointers */
.gauge-pointer-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 4px;
    padding: 0 10px;
}

.gauge-pointer {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.gauge-pointer-left {
    align-items: flex-start;
}

.gauge-pointer-right {
    align-items: flex-end;
}

.gauge-pointer-value {
    font-family: 'Space Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
}

.gauge-pointer-label {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
    margin-top: 2px;
}

.gauge-pointer-left .gauge-pointer-value {
    color: var(--accent-green);
}

.gauge-pointer-right .gauge-pointer-value {
    color: var(--accent-red);
}

/* Right Column - Histogram */
.histogram-section {
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    min-height: 200px;
    overflow: visible;
    padding-bottom: 4px;
}

/* ========== LANDSCAPE PHONE (max-height: 500px) ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .combined-content {
        flex-direction: row;
        gap: 6px;
    }

    .weapon-btn {
        padding: 4px 6px;
        gap: 5px;
        font-size: 10px;
    }

    .weapon-effectiveness {
        font-size: 9px;
    }

    .stat-display {
        padding: 6px;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 18px;
    }

    .weapon-section {
        min-width: 110px;
    }

    .gauge-section {
        padding: 0;
        margin: -6px -6px -6px 0;
    }

    .gauge-container {
        padding: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .gauge-wrapper {
        width: 100%;
        max-width: 195px;
        height: auto;
        aspect-ratio: 1;
    }

    .gauge-center img {
        width: 128px;
        height: 128px;
    }

    .gauge-pointer-container {
        margin-top: -2px;
    }

    .chart-container {
        min-height: 150px;
    }
}

/* ========== SIDE-BY-SIDE LAYOUT (min-width: 350px) ========== */
@media (min-width: 350px) {
    .container {
        padding: 12px;
    }

    .controls-bar {
        gap: 16px;
    }

    .combined-content {
        flex-direction: row;
        gap: 12px;
    }

    .gauge-wrapper {
        width: 200px;
        height: 200px;
    }

    .gauge-center img {
        width: 125px;
        height: 125px;
    }

    .chart-container {
        min-height: 220px;
    }
}

/* ========== PHONE LAYOUT (max-width: 450px) ========== */
@media (max-width: 450px) {
    .container {
        padding: 5px;
    }

    .controls-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .controls-bar .control-group:nth-child(1),
    .controls-bar .control-group:nth-child(2) {
        flex: 1;
        min-width: 100px;
    }

    .controls-bar .control-group:nth-child(3) {
        margin-left: auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .controls-bar .control-group:nth-child(3) .engine-toggle {
        flex: 1;
        margin-left: 0;
    }

    .controls-bar .control-group:nth-child(3) .help-btn {
        flex-shrink: 0;
        margin-left: 8px;
    }
    .header {
        margin-bottom: 5px;
        padding-bottom: 6px;
    }

    .logo img {
        height: 57px !important;
    }

    .settings-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .settings-icon {
        font-size: 16px;
    }

    .settings-dropdown {
        min-width: 240px;
        padding: 12px;
    }

    .main-grid {
        gap: 3px;
    }

    .card {
        padding: 8px;
    }

    .controls-bar {
        padding: 8px;
        gap: 10px;
        margin-bottom: 3px;
    }

    .control-group:nth-child(2) {
        padding: 0 10px;
    }

    .control-group:nth-child(3) {
        margin-left: auto;
    }

    .control-label {
        font-size: 10px;
    }

    .control-input {
        padding: 5px 8px;
        font-size: 11px;
        width: 55px;
    }

    .control-select {
        padding: 5px 8px;
        font-size: 11px;
    }

    .engine-toggle-btn {
        font-size: 9px;
        padding: 5px 8px;
    }

    .card-header {
        margin-bottom: 6px;
        padding-bottom: 6px;
    }

    .card-title {
        font-size: 10px;
        white-space: nowrap;
    }

    .stat-display {
        padding: 8px;
        margin-bottom: 8px;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-value {
        font-size: 20px;
    }

    .weapon-btn {
        padding: 5px 8px;
        gap: 6px;
        font-size: 11px;
    }

    .weapon-effectiveness {
        font-size: 9px;
    }

    .combined-card {
        padding: 4px;
        margin-bottom: 0;
    }

    .combined-content {
        flex-direction: row;
        gap: 4px;
    }

    .weapon-section {
        flex: 0 0 auto;
        min-width: 165px;
        max-width: 165px;
    }

    .stat-display {
        padding: 3px;
        margin-bottom: 4px;
        overflow: hidden;
    }

    .stat-label-wrapper {
        gap: 0;
        margin-bottom: 0;
    }

    .stat-label {
        font-size: 8px;
        margin-bottom: 0;
    }

    .stat-value {
        font-size: 16px;
    }

    .weapon-btn {
        padding: 4px 6px;
        gap: 4px;
        font-size: 10px;
    }

    .weapon-effectiveness {
        font-size: 8px;
    }

    .gauge-section {
        flex: 1;
        padding: 0;
        margin: -4px -4px -4px 0;
    }

    .gauge-container {
        padding: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .gauge-wrapper {
        width: 100%;
        max-width: 230px;
        height: auto;
        aspect-ratio: 1;
    }

    .gauge-center img {
        width: 143px;
        height: 143px;
    }

    .gauge-pointer-value {
        font-size: 11px;
    }

    .gauge-pointer-label {
        font-size: 7px;
    }

    .gauge-pointer-container {
        margin-top: -2px;
        padding: 0 4px;
    }

    .chart-container {
        min-height: 140px;
        padding-bottom: 12px;
    }
}

/* ========== COMPRESSED LAYOUT FOR BROWSER CHROME (max-height: 740px) ========== */
@media (max-width: 450px) and (max-height: 740px) {
    .container {
        padding: 5px;
    }

    .header {
        margin-bottom: 5px;
        padding-bottom: 5px;
    }

    .card {
        padding: 7px;
    }

    .combined-card {
        padding: 4px;
        margin-bottom: 0;
    }

    .combined-content {
        gap: 4px;
    }

    .controls-bar {
        padding: 7px;
        margin-bottom: 8px;
    }

    .control-group:nth-child(3) {
        margin-left: auto;
    }

    .stat-display {
        padding: 6px;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 18px;
    }

    .weapon-btn {
        padding: 4px 6px;
        gap: 5px;
        font-size: 10px;
    }

    .weapon-effectiveness {
        font-size: 9px;
    }

    .weapon-section {
        min-width: 160px;
        max-width: 160px;
    }

    .gauge-section {
        padding: 0;
        margin: -4px -4px -4px 0;
    }

    .gauge-container {
        padding: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .gauge-wrapper {
        width: 100%;
        max-width: 215px;
        height: auto;
        aspect-ratio: 1;
    }

    .gauge-center img {
        width: 134px;
        height: 134px;
    }

    .gauge-pointer-value {
        font-size: 10px;
    }

    .gauge-pointer-container {
        margin-top: -2px;
    }

    .chart-container {
        min-height: 160px;
    }
}

/* ========== VERY COMPRESSED LAYOUT (max-height: 650px) ========== */
@media (max-width: 450px) and (max-height: 650px) {
    .container {
        padding: 4px;
    }

    .header {
        margin-bottom: 4px;
        padding-bottom: 4px;
    }

    .card {
        padding: 6px;
    }

    .combined-card {
        padding: 3px;
        margin-bottom: 0;
    }

    .combined-content {
        gap: 3px;
    }

    .controls-bar {
        padding: 6px;
        margin-bottom: 6px;
    }

    .control-group:nth-child(3) {
        margin-left: auto;
    }

    .stat-display {
        padding: 5px;
        margin-bottom: 5px;
    }

    .stat-value {
        font-size: 16px;
    }

    .weapon-btn {
        padding: 3px 5px;
        gap: 4px;
        font-size: 10px;
    }

    .weapon-effectiveness {
        font-size: 8px;
    }

    .weapon-section {
        min-width: 155px;
        max-width: 155px;
    }

    .gauge-section {
        padding: 0;
        margin: -3px -3px -3px 0;
    }

    .gauge-container {
        padding: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .gauge-wrapper {
        width: 100%;
        max-width: 195px;
        height: auto;
        aspect-ratio: 1;
    }

    .gauge-center img {
        width: 122px;
        height: 122px;
    }

    .gauge-pointer-value {
        font-size: 9px;
    }

    .gauge-pointer-label {
        font-size: 6px;
    }

    .gauge-pointer-container {
        margin-top: -2px;
    }

    .chart-container {
        min-height: 140px;
    }
}

/* ========== DESKTOP STYLES (min-width: 768px) ========== */
@media (min-width: 768px) {
    .container {
        padding: 16px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .logo img {
        height: 60px !important;
    }

    .controls-bar {
        padding: 14px;
        gap: 24px;
        margin-bottom: 16px;
    }

    .control-label {
        font-size: 12px;
    }

    .control-input {
        padding: 8px 12px;
        font-size: 14px;
        width: 80px;
    }

    .control-select {
        padding: 8px 12px;
        font-size: 14px;
    }

    .engine-toggle-btn {
        font-size: 11px;
        padding: 6px 12px;
    }

    .main-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .card {
        padding: 14px;
    }

    .combined-card {
        padding: 10px;
    }

    .combined-content {
        gap: 10px;
    }

    .card-header {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .card-title {
        font-size: 13px;
    }

    .stat-display {
        padding: 16px;
        margin-bottom: 16px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 32px;
    }

    .weapon-btn {
        padding: 12px 16px;
        gap: 12px;
        font-size: 15px;
    }

    .weapon-effectiveness {
        font-size: 13px;
    }

    .gauge-wrapper {
        width: 250px;
        height: 250px;
    }

    .gauge-center img {
        width: 155px;
        height: 155px;
    }

    .gauge-pointer-value {
        font-size: 14px;
    }

    .chart-container {
        min-height: 280px;
    }
}

/* ========== LARGE DESKTOP (min-width: 1024px) ========== */
@media (min-width: 1024px) {
    .container {
        padding: 20px;
    }

    .main-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .combined-card {
        padding: 10px;
    }

    .gauge-wrapper {
        width: 280px;
        height: 280px;
    }

    .gauge-center img {
        width: 175px;
        height: 175px;
    }

    .gauge-pointer-value {
        font-size: 16px;
    }

    .chart-container {
        min-height: 320px;
    }
}

/* ========== 700px BREAKPOINT ========== */
@media (max-width: 700px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        margin-bottom: 8px;
    }

    .chart-container {
        min-height: 200px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

  
/* Help Button */
.help-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    transform: scale(1.02);
}

.control-group .help-btn {
    margin-left: 8px;
}

/* ========== VIEW TOGGLE (Histogram / Combat Effectiveness) ========== */
.view-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-color);
    width: 100%;
    margin-bottom: 10px;
}

.view-toggle-btn {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Effectiveness Table */
.effectiveness-table-container {
    display: none;
    flex: 1;
    min-height: 200px;
}

.effectiveness-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.effectiveness-table th {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.effectiveness-table th:first-child {
    text-align: left;
}

.effectiveness-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.effectiveness-table td:first-child {
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.effectiveness-table tbody tr:last-child td {
    border-bottom: none;
}

.effectiveness-table tbody tr:hover {
    background: var(--bg-secondary);
}

@media (max-width: 450px) {
    .view-toggle-btn {
        font-size: 9px;
        padding: 5px 6px;
    }

    .effectiveness-table-container {
        min-height: 140px;
    }

    .effectiveness-table th,
    .effectiveness-table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .effectiveness-table td:first-child {
        font-size: 11px;
    }
}
