:root {
    font-family: "Inter", "Space Grotesk", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: dark;
    --bg: #030712;
    --bg-alt: #050c1f;
    --surface: rgba(9, 13, 28, 0.85);
    --surface-soft: rgba(15, 23, 42, 0.7);
    --border: rgba(148, 163, 184, 0.18);
    --text: #f8fafc;
    --muted: #9ca3af;
    --accent: #60a5fa;
    --accent-strong: #c084fc;
    --accent-soft: rgba(96, 165, 250, 0.2);
    --danger: #f87171;
}

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

body {
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    background: radial-gradient(circle at 10% 20%, rgba(96, 165, 250, 0.18), transparent 45%),
        radial-gradient(circle at 80% 0%, rgba(192, 132, 252, 0.14), transparent 42%),
        var(--bg);
    color: var(--text);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(96, 165, 250, 0.04), rgba(192, 132, 252, 0.04));
    pointer-events: none;
    z-index: -1;
}

a {
    color: inherit;
    text-decoration: none;
}

header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(20px);
    background: rgba(2, 6, 23, 0.75);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.65);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.brand {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
}

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.menu .menu__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.45rem 1.05rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    background: rgba(148, 163, 184, 0.12);
    transition: border 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.menu .menu__link:hover {
    border-color: rgba(96, 165, 250, 0.7);
    color: var(--accent);
    transform: translateY(-1px);
}

.menu__link--active {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #bc82f8;
    font-weight: 600;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3.5rem;
}

.hero {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 36px;
    padding: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.7));
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 40% 20%, rgba(96, 165, 250, 0.25), transparent 45%);
    z-index: 0;
}

.hero h1,
.hero p {
    position: relative;
    z-index: 1;
}

.hero h1 {
    margin: 0 0 0.9rem;
    font-size: clamp(2rem, 5vw, 3.1rem);
    letter-spacing: -0.01em;
}

.hero p {
    margin: 0 auto;
    max-width: 680px;
    color: var(--muted);
    font-size: 1.02rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: clamp(1rem, 1.5vw, 1.75rem);
    margin-top: 2.5rem;
}

.card {
    position: relative;
    border-radius: 28px;
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    isolation: isolate;
    box-shadow: 0 25px 55px rgba(2, 6, 23, 0.45);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(192, 132, 252, 0.15));
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: rgba(96, 165, 250, 0.5);
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--accent);
}

.card p {
    margin: 0;
    color: #d9e3f0;
    line-height: 1.5;
    font-size: 0.98rem;
}

.card__actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.pill {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    flex-wrap: wrap;
    line-height: 1.2;
}

.card__actions .menu__link {
    flex: 1 1 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 0.95rem;
    color: #01080f;
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    box-shadow: 0 10px 30px rgba(96, 165, 250, 0.35);
}

.card__actions .menu__link:hover {
    transform: translateY(-1px);
}

.layout {
    display: grid;
    grid-template-columns: minmax(300px, 340px) 1fr;
    gap: 1.75rem;
    margin-top: 2.5rem;
}

.sidebar,
.visualizer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 1.75rem;
    box-shadow: 0 35px 55px rgba(2, 6, 23, 0.35);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.sidebar h1 {
    margin: 0;
    font-size: 1.8rem;
}

.sidebar p {
    margin: 0;
    color: var(--muted);
}

.panel {
    background: var(--surface-soft);
    border-radius: 20px;
    padding: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.panel h3 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--muted);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 16px;
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #020617;
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-danger {
    background: rgba(244, 114, 182, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.5);
}

.visualizer h2 {
    margin-top: 0;
    font-size: 1.45rem;
}

.bars {
    min-height: 330px;
    border-radius: 24px;
    padding: 1.5rem;
    background: linear-gradient(145deg, rgba(10, 15, 30, 0.95), rgba(8, 13, 28, 0.8));
    border: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    overflow: hidden;
    position: relative;
}

.bars::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 30% 20%, rgba(96, 165, 250, 0.1), transparent 60%);
    mix-blend-mode: screen;
}

.bar {
    flex: 1;
    min-width: 10px;
    max-width: 42px;
    border-radius: 999px 999px 4px 4px;
    background: linear-gradient(180deg, #38bdf8, #2563eb);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #010a16;
    font-size: 0.7rem;
    font-weight: 600;
    padding-bottom: 0.4rem;
    position: relative;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.bar::after {
    content: attr(data-value);
}

.bar--active {
    background: linear-gradient(180deg, #fb923c, #f97316);
    transform: translateY(-8px);
    color: #fff;
}

.status {
    margin-top: 1.2rem;
    padding: 1.1rem 1.3rem;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: var(--surface-soft);
    line-height: 1.5;
    min-height: 76px;
    color: var(--muted);
}

.status strong {
    color: var(--accent);
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0.05em;
    color: #d7def0;
}

.math-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    font-size: 0.9em;
    margin: 0 0.15rem;
}

.math-frac__top {
    border-bottom: 1px solid currentColor;
    padding: 0 0.25rem 0.1rem;
}

.math-frac__bottom {
    padding: 0.1rem 0.25rem 0;
}

.pill sup {
    font-size: 0.65em;
    line-height: 1;
}

.pill .math-frac {
    font-size: 0.85em;
    margin: 0 0.1rem;
}

.pill__tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(96, 165, 250, 1);
}

footer {
    text-align: center;
    padding: 2.5rem 1rem 3.5rem;
    color: var(--muted);
    font-size: 0.92rem;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .bars {
        min-height: 260px;
        padding: 1rem;
    }
}
