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

body {
    background: #101010;
    color: #f5f5f5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
}

#sidebar {
    width: 350px;
    min-width: 350px;
    background: #181818;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 20;
    padding-bottom: 20px;
}

#sidebar::-webkit-scrollbar { width: 4px; background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

#sidebar h1 {
    font-size: 1rem;
    color: #f5f5f5;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 24px 20px 4px;
}

#sidebar .subtitle {
    font-size: 0.75rem;
    color: #8a8a8a;
    padding: 0 20px 20px;
}

.panel {
    padding: 12px 20px;
    margin-bottom: 4px;
}

.panel-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #8a8a8a;
    margin-bottom: 12px;
}

/* ── New Tail-style Sliders ── */

.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
}

.control-row label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8a8a8a;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: 5.2rem; /* Expanded to fit "Sensitivity" */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.slider-wrapper {
    flex: 1;
    position: relative;
    height: 2.2rem;
    display: flex;
    align-items: center;
}

.slider-bg {
    position: absolute;
    inset: 0;
    background: #101010;
    border-radius: 9999px;
    overflow: hidden;
    pointer-events: none;
}

.slider-dots {
    position: absolute;
    inset: 0;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.15;
}

.dot {
    width: 3px;
    height: 3px;
    background: #f5f5f5;
    border-radius: 50%;
}

.slider-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: #333333;
    border-radius: 9999px;
    transition: width 100ms ease-out;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 12px;
}

.slider-grip {
    width: 2px;
    height: 35%;
    background: #666666;
    border-radius: 9999px;
}

.slider-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.slider-reset {
    background: none;
    border: none;
    color: #444;
    font-size: 1rem;
    line-height: 1;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s ease, background 0.15s ease;
}

.slider-reset:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

.slider-val-box {
    background: #262626;
    height: 2.2rem;
    width: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.slider-val-box span {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f5f5f5;
}

/* Speed multiplier buttons */
.speed-mults {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.speed-mult-btn {
    background: #262626;
    border: none;
    color: #8a8a8a;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
    white-space: nowrap;
}

.speed-mult-btn:hover { background: #333333; color: #f5f5f5; }
.speed-mult-btn.active { background: #d0d0d0; color: #1a1a1a; }

/* Live speed readout */
.speed-live {
    font-size: 0.68rem;
    font-weight: 700;
    color: #5a5a5a;
    flex-shrink: 0;
    min-width: 2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    transition: color 0.15s ease;
}

/* ── Standard buttons ── */
button.action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    margin-bottom: 4px;
    border: none;
    border-radius: 8px;
    background: #262626;
    color: #f5f5f5;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

button.action:hover {
    background: #333333;
    color: #f5f5f5;
}

button.action.active {
    background: #d0d0d0;
    color: #1a1a1a;
}

button.action.mutant-active {
    background: #3a1a1a;
    color: #ff6b6b;
}

.icon-btn {
    padding: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.btn-grid .icon-btn {
    height: 48px;
}

.btn-row {
    display: flex;
    gap: 8px;
}

.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-row button.action,
.btn-grid button.action {
    flex: 1;
    margin: 0;
}

button.action.action-danger:hover {
    background: #3a1a1a;
    color: #ff6b6b;
}

.stats {
    font-size: 0.75rem;
    color: #8a8a8a;
    line-height: 1.8;
    background: #262626;
    padding: 12px;
    border-radius: 12px;
}

.stats span {
    color: #f5f5f5;
    font-weight: 500;
    float: right;
}

/* ── Legend ── */
.legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
    padding-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: #a0a0a0;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Mutation panel ── */
.mutation-panel {
    background: #2a1a1e;
    border: none;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
}

.mutation-panel .mut-title {
    font-size: 0.75rem;
    color: #ff6b6b;
    font-weight: 600;
    margin-bottom: 6px;
}

.mutation-panel .mut-desc {
    font-size: 0.7rem;
    color: #a07070;
    line-height: 1.6;
}

.mutation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

button.mutation-btn {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: #262626;
    color: #c09090;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

button.mutation-btn:hover { background: #333333; }
button.mutation-btn.active { background: #3a1a1a; color: #ff6b6b; }
button.mutation-btn .gene { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: 600; }

#mutSHIP1dC.active { background: #0a2220; color: #00bbb4; }
#locSHIP1.active { background: #1a2a14; color: #8bc34a; }
#locPIP3.active { background: #200f20; color: #dc50dc; }
#locPIP2.active { background: #2a2010; color: #ffb74d; }

/* ── Canvas area ── */
#canvas-wrap {
    flex: 1;
    position: relative;
    background: #101010;
    overflow: hidden;
}

canvas { display: block; cursor: crosshair; }

#overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 0.75rem;
    color: #555555;
    font-weight: 500;
    pointer-events: none;
}

#mode-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #f5f5f5;
    background: rgba(24, 24, 24, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 8px;
    pointer-events: none;
}

/* ── Stats widget ── */
#stats-widget {
    position: absolute;
    top: 58px;
    right: 20px;
    background: rgba(20, 20, 20, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    z-index: 10;
}

#stats-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: none;
    padding: 8px 16px;
    cursor: pointer;
    transition: color 0.15s ease;
    white-space: nowrap;
}

#stats-toggle:hover { color: #f5f5f5; }

#stats-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#stats-body {
    display: none;
    padding: 4px 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

#stats-body.open { display: block; }

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6a6a6a;
    padding: 3px 0;
}

.stat-row span {
    color: #e0e0e0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#mutation-indicator {
    position: absolute;
    top: 60px;
    right: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #ff6b6b;
    background: #2a1a1e;
    padding: 8px 16px;
    border-radius: 8px;
    pointer-events: none;
    display: none;
}

/* ── Tooltips ── */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #181818;
    color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}




