:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #111120;
    --bg-tertiary: #1a1a2e;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(108, 99, 255, 0.3);
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555570;
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.2);
    --accent-2: #ff6b9d;
    --accent-3: #00d4aa;
    --accent-4: #f7b731;
    --gradient-1: linear-gradient(135deg, #6c63ff 0%, #a855f7 100%);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', monospace;
    --bar-1: #6c63ff;
    --bar-2: #ff6b9d;
    --bar-3: #00d4aa;
    --bar-4: #f7b731;
    --bar-5: #a855f7;
    --bar-6: #06b6d4;
    --bar-7: #ef4444;
    --bar-8: #10b981
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.05) 0%, transparent 50%), radial-gradient(ellipse at 80% 50%, rgba(255, 107, 157, 0.03) 0%, transparent 50%)
}

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-weight: 500
}

.header-right {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border)
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-hover)
}

.btn-primary {
    background: var(--gradient-1);
    color: #fff;
    border: none
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.72rem
}

.title-section {
    margin-bottom: 20px
}

.matrix-title-input {
    width: 100%;
    font-size: 1.4rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 0;
    font-family: var(--font);
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition)
}

.matrix-title-input:focus {
    outline: none;
    border-bottom-color: var(--accent)
}

.matrix-title-input::placeholder {
    color: var(--text-muted)
}

.matrix-section {
    margin-bottom: 28px
}

.matrix-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary)
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px
}

.matrix-table th,
.matrix-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.8rem
}

.matrix-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-secondary)
}

.matrix-table th:first-child {
    z-index: 3;
    background: var(--bg-tertiary)
}

.matrix-table td:last-child {
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono)
}

.matrix-table tbody tr {
    transition: background var(--transition)
}

.matrix-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02)
}

.matrix-table tfoot td {
    background: var(--bg-tertiary);
    font-weight: 600;
    border-top: 2px solid var(--border)
}

.weight-input,
.score-input,
.option-name-input,
.criterion-name-input {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-align: center;
    transition: border-color var(--transition)
}

.weight-input:focus,
.score-input:focus,
.option-name-input:focus,
.criterion-name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow)
}

.option-name-input,
.criterion-name-input {
    text-align: left;
    font-family: var(--font);
    font-weight: 500
}

.weight-input {
    width: 50px
}

.score-input {
    width: 50px
}

.remove-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 0, 0, 0.08);
    border-radius: 4px;
    color: #ff4757;
    cursor: pointer;
    font-size: 0.6rem;
    transition: all var(--transition);
    vertical-align: middle;
    margin-left: 4px
}

.remove-btn:hover {
    background: rgba(255, 0, 0, 0.18)
}

.matrix-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px
}

.chart-section {
    margin-bottom: 28px
}

.chart-section h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 10px
}

.chart-bar-label {
    width: 120px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.chart-bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    position: relative
}

.chart-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    min-width: 30px
}

.chart-bar-score {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 50px;
    text-align: right;
    flex-shrink: 0
}

.winner-banner {
    margin-top: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(0, 212, 170, 0.1));
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-3)
}

.winner-banner.hidden {
    display: none
}

.sensitivity-section {
    margin-bottom: 28px
}

.sensitivity-section h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 14px
}

.sensitivity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px
}

.sensitivity-label {
    width: 140px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0
}

.sensitivity-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none
}

.sensitivity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-primary)
}

.sensitivity-value {
    width: 30px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    text-align: center
}

@media(max-width:768px) {
    .app {
        padding: 16px 12px
    }

    .header {
        flex-direction: column;
        align-items: flex-start
    }

    .chart-bar-label {
        width: 80px;
        font-size: 0.65rem
    }

    .sensitivity-label {
        width: 100px;
        font-size: 0.65rem
    }
}