:root {
    --bg: #0b0f14;
    --bg-2: #0e131a;
    --card: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.12);
    --text: #e8eefc;
    --muted: #a6b0c0;
    --accent: #60e8ff;
    --accent-2: #8c7bff;
    --accent-3: #3ad1b7;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 16px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: radial-gradient(1200px 800px at 20% 10%, #0f1722 0, transparent 60%),
        radial-gradient(900px 700px at 85% 20%, #0e2027 0, transparent 55%),
        linear-gradient(180deg, var(--bg) 0, var(--bg-2) 100%);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans",
        "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.45;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 24px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0, var(--accent-2) 100%);
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #081318;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow);
    user-select: none;
}

h1 {
    font-size: clamp(22px, 3vw, 28px);
    margin: 0 0 2px;
    letter-spacing: 0.2px;
}

h2 {
    font-size: clamp(18px, 2.2vw, 20px);
    margin: 0 0 12px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

/* Grid and cards */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px;
}

.card {
    grid-column: span 12;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent), var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(16px, 2.6vw, 20px);
    position: relative;
    overflow: hidden;
    backdrop-filter: saturate(140%) blur(14px);
    transform: translateZ(0);
    animation: floatIn 500ms ease both;
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(96, 232, 255, 0.15), transparent 22% 78%, rgba(140, 123, 255, 0.12)),
        radial-gradient(600px 120px at 50% -60px, rgba(255, 255, 255, 0.18), transparent 70%);
    mix-blend-mode: screen;
}

/* Responsive spans */
@media (min-width: 820px) {
    .card:nth-child(1) {
        grid-column: span 7;
    }
    .card:nth-child(2) {
        grid-column: span 5;
    }
}

/* Groups and segmented controls */
.group {
    margin-bottom: 12px;
}

.group-title {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.seg {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.seg.compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option {
    display: block;
    cursor: pointer;
    user-select: none;
}

.option input {
    display: none;
}

.option .option-box {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 160ms ease, transform 140ms ease, background 160ms ease, box-shadow 160ms ease;
}

.option .option-title {
    font-weight: 700;
}

.option .option-sub {
    color: var(--muted);
    font-size: 12px;
}

.option input:checked + .option-box {
    border-color: rgba(96, 232, 255, 0.65);
    background: linear-gradient(180deg, rgba(96, 232, 255, 0.08), rgba(140, 123, 255, 0.06)), rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 22px rgba(96, 232, 255, 0.14), 0 2px 8px rgba(140, 123, 255, 0.12);
}

.chip {
    display: inline-grid;
    cursor: pointer;
    user-select: none;
}

.chip input {
    display: none;
}

.chip span {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
    font-weight: 700;
    font-size: 13px;
}

.chip input:checked + span {
    border-color: rgba(96, 232, 255, 0.65);
    background: linear-gradient(180deg, rgba(96, 232, 255, 0.08), rgba(140, 123, 255, 0.06)), rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 16px rgba(96, 232, 255, 0.12), 0 2px 6px rgba(140, 123, 255, 0.1);
}

/* Form */
.form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

label {
    font-size: 13px;
    color: var(--muted);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: center;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    outline: none;
    box-shadow: inset 0 0 0 9999px rgba(8, 12, 16, 0.2);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 140ms ease;
}

input::placeholder {
    color: #7f8998;
}

input:focus {
    border-color: rgba(96, 232, 255, 0.65);
    box-shadow: 0 0 0 6px rgba(96, 232, 255, 0.12);
    transform: translateY(-1px);
}

/* Results */
.result {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.result .summary {
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: rgba(255, 255, 255, 0.03);
    animation: popIn 320ms ease both;
}

.result .breakdown {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    font-size: 14px;
}

.kv .k {
    color: var(--muted);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #081318;
    background: linear-gradient(135deg, var(--accent-3), var(--accent));
    box-shadow: 0 6px 14px rgba(58, 209, 183, 0.25);
}

.list {
    margin: 0;
    padding-left: 16px;
    display: grid;
    gap: 6px;
}

.list li {
    line-height: 1.35;
}

hr.sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 6px 0;
}

/* Table */
.table-wrap {
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 420px;
}

.table th,
.table td {
    text-align: left;
    padding: 10px 12px;
    font-size: 14px;
}

.table thead th {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    position: sticky;
    top: 0;
    backdrop-filter: blur(6px);
}

.table tbody tr {
    border-top: 1px solid var(--border);
    transition: background 160ms ease;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Footer */
.footer {
    opacity: 0.85;
}

/* Decorations */
.decor.orb {
    position: fixed;
    filter: blur(50px) saturate(130%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.4;
}

.orb-1 {
    width: 450px;
    height: 450px;
    left: -120px;
    top: -120px;
    background: radial-gradient(circle at 30% 30%, rgba(96, 232, 255, 0.55), transparent 60%);
}

.orb-2 {
    width: 520px;
    height: 520px;
    right: -180px;
    bottom: -180px;
    background: radial-gradient(circle at 70% 70%, rgba(140, 123, 255, 0.55), transparent 60%);
}

.grid-lines {
    inset: 0;
    position: fixed;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at 50% 20%, #000 35%, transparent 70%);
    opacity: 0.4;
    pointer-events: none;
    z-index: -2;
}

/* Animations */
@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
