:root {
    --bg-top: #070b18;
    --bg-bottom: #030409;
    --card-bg: rgba(10, 16, 34, 0.84);
    --card-border: rgba(132, 169, 255, 0.24);
    --text-main: #f7f9ff;
    --text-muted: #a7b8df;
    --accent: #7aa7ff;
    --accent-strong: #9ec4ff;
    --success-bg: rgba(24, 68, 43, 0.5);
    --success-border: rgba(125, 247, 187, 0.4);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    position: relative;
    overflow: hidden;
    color: var(--text-main);
    text-align: center;
    font-family: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.01em;
    background:
        radial-gradient(120% 120% at 20% -10%, #192a59 0%, rgba(25, 42, 89, 0) 45%),
        radial-gradient(120% 120% at 90% 10%, #0b2742 0%, rgba(11, 39, 66, 0) 50%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

#canvas {
    position: fixed;
    pointer-events: none;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.42;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 2.2vw, 2rem);
}

.puzzle-card {
    width: min(58rem, 100%);
    border: 0.0625rem solid var(--card-border);
    border-radius: 1.25rem;
    background: linear-gradient(180deg, rgba(17, 28, 55, 0.88) 0%, var(--card-bg) 100%);
    box-shadow:
        0 1.25rem 3.75rem rgba(1, 4, 12, 0.72),
        0 0 0.125rem rgba(255, 255, 255, 0.25) inset;
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
    padding: clamp(1.25rem, 2.5vw, 2.25rem) clamp(1rem, 3vw, 2.5rem);
}

.card-header {
    margin-bottom: 1.25rem;
}

.eyebrow {
    margin: 0;
    color: var(--accent-strong);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
}

.title {
    margin: 0.55rem 0 0;
    font-size: clamp(1.6rem, 3.6vw, 2.35rem);
    line-height: 1.12;
    letter-spacing: -0.01em;
}

.subtitle {
    margin: 0.55rem auto 0;
    width: min(38rem, 100%);
    color: var(--text-muted);
    font-size: clamp(0.92rem, 1.85vw, 1.03rem);
}

.banner-text {
    color: var(--text-main);
    font-size: clamp(1.18rem, 2.9vw, 1.75rem);
    font-weight: 650;
    min-height: 2.1rem;
    margin-top: 1rem;
    transition: opacity 2s ease-in-out;
}

.transition-fade {
    transition: opacity 2s ease-in-out;
}

.equation-preview {
    margin: 0.5rem auto 0.8rem;
}

.preview-table {
    margin: 0 auto;
}

.fλc-text {
    opacity: 1;
    font-size: clamp(1rem, 2.4vw, 1.3rem);
    margin: 0;
}

.equation-table {
    margin: 0 auto;
}

.equation-symbol h2 {
    margin: 0;
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.left-of-equals {
    padding-top: 2rem;
}

.tbl {
    margin: 0 auto;
}

.frequency-input-container,
.lambda-input-container {
    color: var(--text-main);
}

.line-below {
    border-bottom: 0.125rem solid rgba(255, 255, 255, 0.78);
    padding-bottom: 0.2rem;
}

#shapes-container td {
    padding-bottom: 0.2rem;
}

.speed-of-light-shape {
    color: var(--accent-strong);
    font-size: 1.1rem;
    font-weight: 700;
}

.speed-of-light-comma {
    color: var(--text-muted);
    padding: 0 0.2rem;
}

.input-text {
    color: var(--text-main);
}

.units {
    opacity: 0;
    color: var(--text-muted);
    transition: opacity 2s ease-in-out;
    margin-left: 0.35rem;
}

.digit-input {
    height: 2.35rem;
    color: var(--text-main);
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    border: 0.0625rem solid rgba(128, 152, 214, 0.66);
    border-radius: 0.5rem;
    background: rgba(6, 12, 28, 0.8);
    box-shadow: inset 0 0 0.4rem rgba(0, 0, 0, 0.45);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.digit-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow:
        0 0 0 0.14rem rgba(122, 167, 255, 0.3),
        inset 0 0 0.4rem rgba(0, 0, 0, 0.45);
    transform: translateY(-0.0625rem);
}

.digit-limit-2 {
    width: 2.9rem;
}

.digit-limit-3 {
    width: 3.6rem;
}

.success-container {
    display: none;
    margin: 1.35rem auto 0;
    width: min(34rem, 100%);
    padding: 0.85rem 0.95rem;
    border-radius: 0.8rem;
    border: 0.0625rem solid var(--success-border);
    background: var(--success-bg);
}

.success-text {
    margin: 0.2rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.success-title {
    font-weight: 700;
}

#success-message {
    display: none;
    color: #ddffe9;
    font-weight: 600;
}

a {
    color: #d0e2ff;
    text-underline-offset: 0.16em;
}

a:hover {
    color: #ffffff;
}

@media (max-width: 52rem) {
    .puzzle-card {
        padding: 1.1rem 0.95rem 1.25rem;
    }

    .banner-text {
        min-height: 2.6rem;
    }

    .equation-symbol h2 {
        font-size: 1.26rem;
    }

    .left-of-equals {
        padding-top: 1.5rem;
    }
}

@media (max-width: 36rem) {
    body {
        overflow-y: auto;
    }

    .container {
        padding: 0.85rem;
    }

    .title {
        font-size: 1.48rem;
    }

    .subtitle {
        font-size: 0.88rem;
    }

    .banner-text {
        font-size: 1.05rem;
    }

    .digit-input {
        height: 2.15rem;
        font-size: 0.95rem;
    }

    .digit-limit-2 {
        width: 2.55rem;
    }

    .digit-limit-3 {
        width: 3.15rem;
    }
}