:root {
    /* Material-ish tonal roles, seeded from the cribbage-green brand color. Light theme. */
    --md-primary: #1b4332;
    --md-on-primary: #ffffff;
    --md-primary-container: #c3ecd2;
    --md-on-primary-container: #04210f;

    --md-secondary: #7c5a35;
    --md-on-secondary: #ffffff;
    --md-secondary-container: #f6ddb9;
    --md-on-secondary-container: #2b1900;

    --md-background: #f5f7fa;
    --md-surface: #fbfaf6;
    --md-surface-variant: #e6e2d9;
    --md-on-surface: #1b1c18;
    --md-on-surface-variant: #47483f;
    --md-outline: #787770;
    --md-outline-variant: #e0e4ea;

    --md-error: #b3261e;
    --md-on-error: #ffffff;

    --md-radius: 1.1rem;
    --md-radius-sm: 0.65rem;
    --md-elevation-1: 0 2px 10px rgba(0, 0, 0, 0.07);
}

/* This app always renders a bright, light UI -- surfaces stay light and readable regardless
   of OS dark-mode preference, rather than switching to a dark scheme. */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--md-on-surface);
    min-height: 100vh;
}

body {
    background-color: var(--md-background);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--md-primary);
}

.content {
    /* Extra top clearance keeps page content (page-header icons etc.) clear of the
       floating home button in MainLayout, which has no top bar to reserve the space. */
    padding-top: calc(env(safe-area-inset-top) + 3.5rem);
    padding-bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
    /* Every page's content sits in one centered column -- individual pages/components may
       constrain themselves further (narrower max-width + margin: 0 auto), but this is the
       one place that keeps the app centered on wide viewports instead of hugging the left edge. */
    max-width: 46rem;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: var(--md-error);
}

/* Shared flat-design animation utilities used by the trainer pages/components. */
@keyframes ct-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ct-fade-in {
    animation: ct-fade-in 0.2s ease-out;
}

/* Shared flat/Material button. Use with one modifier: --filled, --tonal, --outlined, --text. */
.ct-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ct-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ct-btn--filled {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.ct-btn--filled:hover:not(:disabled) {
    background: color-mix(in srgb, var(--md-primary) 88%, black);
}

.ct-btn--tonal {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

.ct-btn--tonal:hover:not(:disabled) {
    background: color-mix(in srgb, var(--md-primary-container) 85%, var(--md-primary));
}

.ct-btn--outlined {
    background: transparent;
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
}

.ct-btn--outlined:hover:not(:disabled) {
    background: color-mix(in srgb, var(--md-primary) 8%, transparent);
}

.ct-btn--text {
    background: transparent;
    color: var(--md-primary);
    padding: 0.6rem 0.75rem;
}

.ct-btn--text:hover:not(:disabled) {
    background: color-mix(in srgb, var(--md-primary) 8%, transparent);
}

.ct-btn:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

/* Shared flat surface/card. Semi-transparent so a custom page background shows through. */
.ct-surface {
    background: color-mix(in srgb, var(--md-surface) 94%, transparent);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--md-radius);
    color: var(--md-on-surface);
    box-shadow: var(--md-elevation-1);
}

.ct-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--md-surface-variant);
    color: var(--md-on-surface-variant);
    font-size: 0.85rem;
    font-weight: 600;
}

.ct-chip--accent {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

.ct-chip--warn {
    background: color-mix(in srgb, var(--md-error) 14%, var(--md-surface-variant));
    color: var(--md-error);
}

/* Page-level heading: a colored icon (no badge/box behind it) plus title, used at the top of
   every route. Flat by design -- see .card-fan below for the one exception to "no boxes":
   real playing cards. */
.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--md-outline-variant);
    text-align: left;
}

.page-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--md-primary);
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.page-header p {
    margin: 0.15rem 0 0;
    color: var(--md-on-surface-variant);
    font-size: 0.88rem;
}

/* Flat stat row: icon + value + label, separated from siblings by a bottom divider -- no
   fill, border, or shadow. Each instance can shift its icon hue via --accent-hue so a row of
   stats still reads as varied without resorting to colored boxes. */
.stat-tile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--md-outline-variant);
}

.stat-tile .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--md-primary);
    filter: hue-rotate(var(--accent-hue, 0deg));
}

.stat-tile .stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.stat-tile .value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
}

.stat-tile .label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--md-on-surface-variant);
}

/* Color-coded result/feedback for trainer answer panels -- a colored top rule only, no fill. */
.ct-panel--success {
    border-top: 3px solid var(--md-primary);
}

.ct-panel--warn {
    border-top: 3px solid var(--md-secondary);
}

.ct-panel--danger {
    border-top: 3px solid var(--md-error);
}

/* Fanned-hand overlap + separated cut card, shared by both trainer pages. */
.card-fan {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-top: 0.5rem;
}

.cut-card-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.cut-card-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--md-on-surface-variant);
}

/* Compact in-session scoreboard (points earned / missed / hands so far), shared by both
   trainer pages. Flat -- just three columns divided by hairlines, no card/box. */
.scoreboard {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--md-outline-variant);
    border-bottom: 1px solid var(--md-outline-variant);
}

.scoreboard-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex: 1;
    max-width: 9rem;
    padding: 0.6rem 0.5rem;
}

.scoreboard-item:not(:last-child) {
    border-right: 1px solid var(--md-outline-variant);
}

.scoreboard-value {
    font-size: 1.3rem;
    font-weight: 800;
}

.scoreboard-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--md-on-surface-variant);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEi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I2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Splash screen shown while the WASM app boots, before Blazor takes over #app. A small fanned
   "hand" of cards deals in and idles with a gentle float, with a flat progress bar underneath
   driven by the same --blazor-load-percentage custom property the old circular indicator used. */
.splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: var(--md-background);
}

.splash-cards {
    display: flex;
    align-items: flex-end;
}

.splash-card {
    --i: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3.75rem;
    height: 5.35rem;
    margin-left: -1.1rem;
    border-radius: var(--md-radius-sm);
    background: var(--md-surface);
    border: 1px solid var(--md-outline-variant);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.15;
    color: var(--md-on-surface);
    opacity: 0;
    transform-origin: bottom center;
    animation:
        splash-deal 0.5s ease-out forwards calc(var(--i) * 0.1s),
        splash-float 1.8s ease-in-out infinite calc(0.5s + var(--i) * 0.1s);
}

.splash-card:first-child {
    margin-left: 0;
}

.splash-card span:last-child {
    font-size: 1.5rem;
}

.splash-card.red {
    color: #c0392b;
}

@keyframes splash-deal {
    from {
        opacity: 0;
        transform: translateY(28px) rotate(0deg) scale(0.85);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotate(calc((var(--i) - 1.5) * 9deg)) scale(1);
    }
}

@keyframes splash-float {
    0%, 100% {
        transform: translateY(0) rotate(calc((var(--i) - 1.5) * 9deg));
    }

    50% {
        transform: translateY(-7px) rotate(calc((var(--i) - 1.5) * 9deg));
    }
}

.splash-title {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--md-on-surface);
}

.loading-bar {
    width: 11rem;
    height: 0.3rem;
    border-radius: 999px;
    background: var(--md-surface-variant);
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background: var(--md-primary);
    border-radius: 999px;
    transition: width 0.2s ease-out;
}

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
