:root {
    --navy: #0f2238;
    --navy-2: #16314f;
    --navy-3: #1d3e63;
    --gold: #c9a24b;
    --gold-soft: #e2c87f;
    --gold-dim: #9c7c34;
    --paper: #f6f3ec;
    --paper-2: #fbfaf6;
    --ink: #16202c;
    --ink-soft: #46586a;
    --line: #d9d2c4;
    --line-soft: #e7e1d4;
    --likely: #2f7d5b;
    --likely-bg: #e6f2ec;
    --less: #b8862b;
    --less-bg: #f7efdc;
    --improb: #b14a3b;
    --improb-bg: #f6e3df;
    --shadow: 0 1px 2px rgba(15, 34, 56, 0.06), 0 8px 28px rgba(15, 34, 56, 0.1);
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
}
body {
    font-family: "Spline Sans", -apple-system, system-ui, sans-serif;
    color: var(--ink);
    line-height: 1.5;
    background: radial-gradient(
            1200px 600px at 90% -10%,
            rgba(201, 162, 75, 0.1),
            transparent 60%
        ),
        radial-gradient(
            900px 500px at -5% 110%,
            rgba(29, 62, 99, 0.1),
            transparent 55%
        ),
        var(--paper);
    -webkit-font-smoothing: antialiased;
}
.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 22px 80px;
}

header.app {
    background: linear-gradient(
        135deg,
        var(--navy) 0%,
        var(--navy-2) 60%,
        var(--navy-3) 100%
    );
    color: #f4efe4;
    border-radius: 18px;
    padding: 30px 34px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
header.app::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.5;
    pointer-events: none;
    background: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.025) 0 2px,
        transparent 2px 22px
    );
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}
.mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: none;
    background: linear-gradient(150deg, var(--gold-soft), var(--gold-dim));
    color: var(--navy);
    font-family: "Fraunces", serif;
    font-weight: 700;
    font-size: 21px;
    box-shadow: 0 4px 14px rgba(201, 162, 75, 0.4);
}
.brand small {
    display: block;
    letter-spacing: 0.32em;
    font-size: 10.5px;
    text-transform: uppercase;
    color: var(--gold-soft);
    font-weight: 600;
}
.brand h1 {
    font-family: "Fraunces", serif;
    font-weight: 600;
    font-size: 25px;
    margin: 1px 0 0;
    letter-spacing: -0.01em;
}
.sub {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    color: #bfcad8;
    font-size: 13px;
    max-width: 640px;
}
.meta {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}
.meta .f {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.meta label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-soft);
    font-weight: 600;
}
.meta input {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    border-radius: 9px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 13.5px;
    transition: 0.15s;
}
.meta input::placeholder {
    color: #8ba0b5;
}
.meta input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(201, 162, 75, 0.14);
    box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.18);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    margin-top: 26px;
    align-items: start;
}
.card {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-h {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px 22px;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(15, 34, 56, 0.04), transparent);
}
.chip {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex: none;
    display: grid;
    place-items: center;
    font-family: "Fraunces", serif;
    font-weight: 700;
    color: #fff;
    font-size: 15px;
    background: linear-gradient(150deg, var(--navy-3), var(--navy));
}
.card-h h2 {
    font-family: "Fraunces", serif;
    font-size: 19px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}
.card-h .pts {
    margin-left: auto;
    text-align: right;
}
.card-h .pts b {
    font-family: "Fraunces", serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--navy);
    display: block;
    line-height: 1;
}
.card-h .pts span {
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 600;
}
.card-b {
    padding: 18px 22px 22px;
}
.field {
    margin-bottom: 15px;
}
.field:last-child {
    margin-bottom: 0;
}
.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}
.selwrap {
    position: relative;
}
.selwrap::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--gold-dim);
    border-bottom: 2px solid var(--gold-dim);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 11px 36px 11px 13px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    transition: 0.15s;
    font-weight: 500;
}
select:hover {
    border-color: var(--gold-dim);
}
select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.18);
}
.derived {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
    color: var(--ink-soft);
}
.tag b {
    color: var(--navy);
    font-weight: 600;
}
.comment {
    margin-top: 7px;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 600;
}
.comment::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.c-likely {
    color: var(--likely);
    background: var(--likely-bg);
}
.c-likely::before {
    background: var(--likely);
}
.c-less {
    color: var(--less);
    background: var(--less-bg);
}
.c-less::before {
    background: var(--less);
}
.c-improb {
    color: var(--improb);
    background: var(--improb-bg);
}
.c-improb::before {
    background: var(--improb);
}

.results {
    position: sticky;
    top: 20px;
}
.score-card {
    background: linear-gradient(150deg, var(--navy), var(--navy-2));
    color: #fff;
    border-radius: 16px;
    padding: 26px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.score-card::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(201, 162, 75, 0.22),
        transparent 70%
    );
}
.total-lbl {
    font-size: 10.5px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-soft);
    font-weight: 600;
}
.total {
    font-family: "Fraunces", serif;
    font-size: 60px;
    font-weight: 600;
    line-height: 0.95;
    margin: 4px 0 2px;
    letter-spacing: -0.02em;
}
.total small {
    font-size: 18px;
    color: #aebccb;
    font-weight: 400;
}
.gradeline {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}
.gradeline .g {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    padding: 11px 13px;
}
.gradeline .g span {
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-soft);
    font-weight: 600;
    display: block;
}
.gradeline .g b {
    font-family: "Fraunces", serif;
    font-size: 24px;
    font-weight: 600;
    display: block;
    line-height: 1.1;
    margin-top: 2px;
}

.breakdown {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    margin-top: 18px;
    box-shadow: var(--shadow);
}
.breakdown h3 {
    font-family: "Fraunces", serif;
    font-size: 14px;
    margin: 0 0 4px;
    font-weight: 600;
}
.breakdown .pr {
    font-size: 11px;
    color: var(--ink-soft);
    margin-bottom: 16px;
}
.brow {
    margin-bottom: 14px;
}
.brow:last-child {
    margin-bottom: 0;
}
.brow .top {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    margin-bottom: 5px;
}
.brow .top b {
    color: var(--navy);
    font-weight: 600;
}
.bar {
    height: 9px;
    border-radius: 6px;
    background: #eae3d4;
    overflow: hidden;
}
.bar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-kh i {
    background: linear-gradient(90deg, var(--navy-3), var(--navy));
}
.bar-ps i {
    background: linear-gradient(90deg, var(--gold-soft), var(--gold-dim));
}
.bar-ac i {
    background: linear-gradient(90deg, #5b8aa8, #2f5d7d);
}

/* short profile */
.sp-card {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    margin-top: 18px;
    box-shadow: var(--shadow);
}
.sp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.sp-head h3 {
    font-family: "Fraunces", serif;
    font-size: 14px;
    margin: 0;
    font-weight: 600;
}
.sp-badge {
    font-family: "Fraunces", serif;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(150deg, var(--gold), var(--gold-dim));
    padding: 3px 13px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.sp-desc {
    font-size: 11px;
    color: var(--ink-soft);
    margin: 0 0 12px;
}
.sp-svg {
    width: 100%;
    height: 128px;
    display: block;
}
.sp-legend {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--ink-soft);
    margin-top: 6px;
    letter-spacing: 0.04em;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.btn {
    flex: 1;
    border: none;
    border-radius: 11px;
    padding: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.btn-primary {
    background: var(--gold);
    color: var(--navy);
}
.btn-primary:hover {
    background: var(--gold-soft);
    transform: translateY(-1px);
}
.btn-print {
    background: var(--navy);
    color: #fff;
}
.btn-print:hover {
    background: var(--navy-2);
    transform: translateY(-1px);
}
.btn-reset {
    background: transparent;
    color: var(--ink-soft);
    border: 1.5px solid var(--line);
}
.btn-reset:hover {
    border-color: var(--gold-dim);
    color: var(--navy);
}

.notes-card .card-b textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 13.5px;
    resize: vertical;
    min-height: 70px;
}
.notes-card textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.18);
}

/* saved / comparison */
.saved {
    margin-top: 24px;
}
.saved .card-h .right {
    margin-left: auto;
    display: flex;
    gap: 9px;
    align-items: center;
}
.mini-btn {
    border: 1.5px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--navy);
    transition: 0.15s;
}
.mini-btn:hover {
    border-color: var(--gold-dim);
    background: var(--paper);
}
.mini-btn.gold {
    background: var(--gold);
    border-color: var(--gold-dim);
    color: var(--navy);
}
.mini-btn.gold:hover {
    background: var(--gold-soft);
}
.storage-note {
    font-size: 10.5px;
    color: var(--ink-soft);
    font-weight: 500;
}
.table-scroll {
    overflow-x: auto;
}
table.cmp {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}
table.cmp th,
table.cmp td {
    padding: 11px 13px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}
table.cmp th {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 600;
    background: rgba(15, 34, 56, 0.03);
}
table.cmp td.num,
table.cmp th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.cmp td.title {
    font-weight: 600;
    color: var(--navy);
}
table.cmp tr.row:hover td {
    background: rgba(201, 162, 75, 0.07);
}
.pillp {
    font-family: "Fraunces", serif;
    font-weight: 700;
    font-size: 13px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--navy);
}
.rowact {
    display: flex;
    gap: 6px;
}
.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 7px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink-soft);
    transition: 0.15s;
    display: grid;
    place-items: center;
}
.icon-btn:hover {
    border-color: var(--gold-dim);
    color: var(--navy);
}
.icon-btn.del:hover {
    border-color: var(--improb);
    color: var(--improb);
}
.empty {
    padding: 34px 22px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 13px;
}
.empty b {
    color: var(--navy);
    font-family: "Fraunces", serif;
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 600;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    background: var(--navy);
    color: #fff;
    padding: 12px 22px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: 0.25s;
    z-index: 50;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.disclaimer {
    margin-top: 24px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    box-shadow: var(--shadow);
}
.disclaimer .ic {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 15px;
    font-family: "Fraunces", serif;
}
.disclaimer .txt {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.55;
}
.disclaimer .txt strong {
    display: block;
    color: var(--navy);
    font-family: "Fraunces", serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 3px;
}
footer.app {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
}
footer.app a {
    color: var(--gold-dim);
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 880px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .meta {
        grid-template-columns: repeat(2, 1fr);
    }
    .results {
        position: static;
    }
}
@media print {
    body {
        background: #fff;
    }
    .actions,
    .btn,
    .saved .card-h .right,
    .rowact {
        display: none;
    }
    header.app {
        background: var(--navy) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .card,
    .score-card,
    .breakdown,
    .sp-card {
        box-shadow: none;
        break-inside: avoid;
    }
    .grid {
        grid-template-columns: 1fr 320px;
    }
}
