@font-face {
    font-family: "Fraunces";
    src: url("../fonts/fraunces-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #10241c;
    --desk: #08110e;
    --panel: #17342a;
    --plate: #1c4034;
    --plate-press: #275948;
    --cream: #f4ecd9;
    --cream-dim: #c5d2c9;
    --brass: #e2b15a;
    --brass-deep: #a8742d;
    --danger: #e7a08d;
    --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
    --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--desk);
    color: var(--cream);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--sans);
    -webkit-text-size-adjust: 100%;
}

::selection {
    background: rgba(226, 177, 90, 0.35);
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.phone {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, 28rem);
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    background:
        radial-gradient(120% 55% at 50% -10%, rgba(226, 177, 90, 0.18), transparent 52%),
        linear-gradient(180deg, #1a4336 0%, var(--ink) 42%, #0c1b16 100%);
    color: var(--cream);
}

@media (min-width: 520px) {
    body {
        background:
            radial-gradient(ellipse at top, #163028 0%, var(--desk) 58%);
    }

    .phone {
        box-shadow:
            0 0 0 1px rgba(244, 236, 217, 0.08),
            0 24px 70px rgba(0, 0, 0, 0.45);
    }
}

.topbar {
    display: grid;
    grid-template-columns: 3rem 1fr 3rem;
    align-items: center;
    flex: none;
    padding: calc(0.35rem + env(safe-area-inset-top)) 0.75rem 0.2rem;
}

.topbar-spacer {
    width: 3rem;
}

.brand {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cream-dim);
}

.icon-button {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cream);
}

.icon-button:active {
    background: rgba(244, 236, 217, 0.08);
}

.icon {
    width: 1.45rem;
    height: 1.45rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.stage-loading {
    align-items: center;
    justify-content: center;
    color: var(--cream-dim);
}

.score-block {
    flex: none;
    padding: 0.85rem 1.35rem 1.15rem;
}

.score-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brass);
}

.score {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(4.2rem, 22vw, 5.6rem);
    font-weight: 500;
    line-height: 0.88;
    letter-spacing: -0.045em;
    font-variant-numeric: tabular-nums;
}

.score-pop {
    animation: score-pop 220ms ease;
}

@keyframes score-pop {
    from {
        transform: translateY(8px);
        opacity: 0.35;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.actions {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.35rem 1rem calc(1rem + env(safe-area-inset-bottom));
}

.point-button {
    flex: 1;
    min-height: 4.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0 1.15rem;
    border: 1px solid rgba(226, 177, 90, 0.32);
    border-radius: 1.15rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 42%),
        var(--plate);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 10px 22px rgba(0, 0, 0, 0.18);
    text-align: left;
    transition: transform 80ms ease, background-color 80ms ease;
}

.point-button:active {
    transform: translateY(1px) scale(0.985);
    background: var(--plate-press);
}

.point-name {
    min-width: 0;
    overflow: hidden;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.point-value {
    flex: none;
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 500;
    color: var(--brass);
    font-variant-numeric: tabular-nums;
}

.overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 8, 0.62);
    animation: fade-in 160ms ease;
}

.drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(22rem, 88%);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding:
        calc(0.85rem + env(safe-area-inset-top))
        1rem
        calc(1rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    background: #143028;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.35);
    animation: slide-in 180ms ease;
}

.drawer:focus {
    outline: none;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.hint {
    margin: 0;
    color: var(--cream-dim);
    font-size: 0.95rem;
    line-height: 1.4;
}

.button-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid rgba(244, 236, 217, 0.08);
    border-radius: 1rem;
    background: rgba(7, 18, 14, 0.38);
}

.button-card h3 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brass);
}

.fields {
    display: grid;
    gap: 0.7rem;
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field span {
    font-size: 0.82rem;
    color: var(--cream-dim);
}

.field input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(244, 236, 217, 0.16);
    border-radius: 0.75rem;
    background: #0d211a;
    font-size: 1rem;
}

.reset {
    margin-top: auto;
    min-height: 3rem;
    border: 1px solid rgba(231, 160, 141, 0.5);
    border-radius: 999px;
    background: transparent;
    color: var(--danger);
    font-weight: 600;
}

.reset.is-armed {
    border-color: transparent;
    background: #e07a5f;
    color: #2a100c;
}

.missing {
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
    text-align: center;
}

.missing h1 {
    margin: 0;
    max-width: 12ch;
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 500;
    line-height: 1.05;
}

.missing a {
    color: var(--brass);
    font-weight: 600;
}

.icon-button:focus-visible,
.point-button:focus-visible,
.reset:focus-visible,
.field input:focus-visible,
.missing a:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in {
    from { transform: translateX(-105%); }
    to { transform: none; }
}

@media (max-width: 360px) {
    .brand {
        font-size: 0.7rem;
        letter-spacing: 0.08em;
    }

    .point-name {
        font-size: 1.15rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .score-pop,
    .drawer,
    .backdrop,
    .point-button {
        animation: none;
        transition: none;
    }
}

#blazor-error-ui {
    color-scheme: dark;
    background: #3a2418;
    color: var(--cream);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #6e2b22;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(244, 236, 217, 0.18);
    stroke-width: 0.55rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--brass);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-family: var(--sans);
    font-weight: 600;
    color: var(--cream);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
