:root {
    --blue: #0e76bc;
    --orange: #f7941e;
    --bg: #0b0f12;
    --card: #151821;
    --text: #e8ebf1;
    --muted: #9fb3c8;
    --ring: rgba(14, 118, 188, .35);
    --panel: #0f1320;
}

body {
    color: var(--text);
    background: linear-gradient(180deg, #0b0d12, #0f1320);
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.hero {
    background: radial-gradient(600px 300px at 10% -10%, rgba(14, 118, 188, .25), transparent 60%),
        radial-gradient(500px 260px at 90% -20%, rgba(247, 148, 30, .18), transparent 60%);
    border: 1px solid rgba(255, 255, 255, .06);
    background-color: rgba(255, 255, 255, .02);
    border-radius: 18px;
    padding: 1.2rem 1.4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

.hero h1 {
    margin: .1rem 0 .25rem;
    font-size: 1.65rem;
}

.hero p {
    margin: 0;
    color: var(--muted);
}

.tool-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width:900px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.row {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin: .6rem 0;
}

.row.grid2 {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: .75rem;
}

.row label {
    min-width: 120px;
    color: #d7e2ee;
    font-weight: 600;
}

.row input[type="text"],
.row input[type="number"],
.row select {
    width: 100%;
    padding: .65rem .7rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: #0c101a;
    color: #e8ebf1;
    outline: none;
}

.row input:focus,
.row select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 4px rgba(14, 118, 188, .15);
}

.btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .16);
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    padding: .65rem .9rem;
    font-weight: 700;
    cursor: pointer;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn.outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, .28);
}

.ratings {
    margin-top: .6rem;
}

.ratings-head,
.ratings-row {
    display: grid;
    grid-template-columns: 110px 1fr 130px 110px;
    gap: .5rem;
    align-items: center;
}

.ratings-head {
    color: #c9d6e6;
    font-weight: 700;
    font-size: .9rem;
    margin: .4rem 0 .3rem;
}

.ratings-row {
    margin: .25rem 0;
}

.ratings .cell input {
    width: 100%;
    padding: .55rem .6rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: #0c101a;
    color: #e8ebf1;
}

.hint {
    margin: .35rem 0 0;
    color: var(--muted);
    font-size: .85rem;
}

.pct-col {
    text-align: right;
}

.summary-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin: .9rem 0 .2rem;
    color: #dfe7f5;
}

.chart-panel {
    position: relative;
    min-height: 520px;
    overflow: hidden;
    /* ensure canvas cannot spill past the panel */
    border-radius: 12px;
    /* rounded dark panel + clip */
}

.chart-panel canvas {
    display: block;
    width: 100%;
    height: 520px;
    /* keep a fixed preview height */
    background: #fff;
    border-radius: 12px;
    /* keep rounded white corners visible */
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .6rem;
}

.legend .leg {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #0c101a;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 999px;
    padding: .25rem .5rem;
    color: #e8ebf1;
    font-size: .85rem;
}

.legend .leg em {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.export-actions {
    display: flex;
    gap: .5rem;
    justify-self: end;
}

/* --- Toggle group --- */
.toggles {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: .4rem 0 .2rem;
}

.toggles label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .6rem;
    border: 1px solid rgba(255, 255, 255, .12);
    background: #0c101a;
    border-radius: 999px;
    color: #e8ebf1;
    font-size: .9rem;
    user-select: none;
}

/* Custom checkbox */
.toggles input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .28);
    border-radius: 6px;
    display: inline-block;
    position: relative;
    background: transparent;
    outline: none;
    cursor: pointer;
}

.toggles input[type="checkbox"]:checked {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(14, 118, 188, .18);
    background: linear-gradient(180deg, rgba(14, 118, 188, .95), rgba(14, 118, 188, .8));
}

.toggles input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    inset: 2px;
    background: #fff;
    border-radius: 3px;
    /* tiny check glyph */
    clip-path: polygon(14% 54%, 28% 68%, 66% 30%, 76% 40%, 28% 88%, 4% 64%);
}

.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1rem;
    align-items: center;
    margin-top: .25rem;
}

.options-row label {
    min-width: unset;
    font-weight: 600;
    color: #d7e2ee;
}

.options-row select {
    width: auto;
    min-width: 110px;
    padding: .5rem .6rem;
    background: #0c101a;
    color: #e8ebf1;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
}

.options-row .ck {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.options-row input[type="checkbox"] {
    transform: translateY(1px);
}