@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ==========================================================================
   Skanimals design system
   ========================================================================== */
:root {
    /* Surfaces: deep navy from the logo */
    --sc-bg: #051029;
    --sc-bg-rgb: 5, 16, 41;
    --sc-bg-elevated: #0a1a3a;
    --sc-surface: #0e2147;
    --sc-surface-2: #132a57;
    --sc-surface-3: #1b376b;
    --sc-line: rgba(160, 200, 255, 0.09);
    --sc-line-strong: rgba(160, 200, 255, 0.18);

    /* Text */
    --sc-text: #f2f7ff;
    --sc-text-muted: #9db1d8;
    --sc-text-faint: #62779f;

    /* Brand: the logo's mint, with an azure partner */
    --sc-primary: #1ee6b4;
    --sc-primary-rgb: 30, 230, 180;
    --sc-primary-strong: #09d3a4;
    --sc-primary-soft: rgba(30, 230, 180, 0.14);
    --sc-navy: #092350;
    --sc-azure: #3aa8ff;
    --sc-gold: #ffc83d;
    --sc-gold-soft: rgba(255, 200, 61, 0.14);
    --sc-purple: #9d7bff;
    --sc-purple-soft: rgba(157, 123, 255, 0.16);
    --sc-success: #3ddc84;
    --sc-success-soft: rgba(61, 220, 132, 0.14);
    --sc-danger: #ff6b6b;
    --sc-danger-soft: rgba(255, 107, 107, 0.14);
    --sc-warning: #ff9f43;

    --sc-gradient-primary: linear-gradient(135deg, #3cf2c6 0%, #09d3a4 45%, #2fa4ff 100%);
    --sc-gradient-gold: linear-gradient(135deg, #ffd96b 0%, #ff9f43 100%);
    --sc-gradient-xp: linear-gradient(90deg, #9d7bff 0%, #1ee6b4 100%);
    --sc-gradient-danger: linear-gradient(135deg, #ff8a7a 0%, #ff4d6d 100%);
    --sc-gradient-success: linear-gradient(135deg, #5ef0a0 0%, #1fbf74 100%);

    /* Shape */
    --sc-radius-sm: 10px;
    --sc-radius: 16px;
    --sc-radius-lg: 22px;
    --sc-radius-pill: 999px;
    --sc-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --sc-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --sc-glow-primary: 0 0 0 1px rgba(var(--sc-primary-rgb), 0.35), 0 8px 24px rgba(var(--sc-primary-rgb), 0.25);

    /* Type */
    --sc-font-display: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
    --sc-font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Layout */
    --sc-topbar-height: 56px;
    --sc-tabbar-height: 64px;
    --sc-safe-top: env(safe-area-inset-top, 0px);
    --sc-safe-bottom: env(safe-area-inset-bottom, 0px);
    --sc-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --sc-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */
/*
 * Mobile Safari: keep text at the size we set (it inflates text in some orientations), and never let anything wider
 * than the screen widen the page - clip doesn't create a scroll container, so sticky headers keep working.
 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    overflow-x: clip;
}

html, body {
    min-height: 100%;
    margin: 0;
    background: var(--sc-bg);
    color: var(--sc-text);
    font-family: var(--sc-font-body);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--sc-font-display);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--sc-text);
}

h1:focus {
    outline: none;
}

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

p {
    margin-bottom: 0.5rem;
}

button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: rgba(var(--sc-primary-rgb), 0.35);
}

/* Slim, unobtrusive scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--sc-gold);
}

.content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ==========================================================================
   Buttons (restyles Bootstrap's so every screen matches)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--sc-radius-pill);
    font-family: var(--sc-font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

.btn:disabled, .btn.disabled {
    opacity: 0.45;
    filter: grayscale(0.4);
}

.btn-primary {
    background: var(--sc-gradient-primary);
    color: #071022;
    box-shadow: 0 6px 18px rgba(var(--sc-primary-rgb), 0.3);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--sc-gradient-primary);
    color: #071022;
    filter: brightness(1.08);
}

.btn-success {
    background: var(--sc-gradient-success);
    color: #062014;
    box-shadow: 0 6px 18px rgba(61, 220, 132, 0.28);
}

.btn-success:hover, .btn-success:focus {
    background: var(--sc-gradient-success);
    color: #062014;
    filter: brightness(1.08);
}

.btn-warning {
    background: var(--sc-gradient-gold);
    color: #2a1600;
    box-shadow: 0 6px 18px rgba(255, 159, 67, 0.28);
}

.btn-warning:hover, .btn-warning:focus {
    background: var(--sc-gradient-gold);
    color: #2a1600;
    filter: brightness(1.08);
}

.btn-danger {
    background: var(--sc-gradient-danger);
    color: #fff;
}

.btn-secondary {
    background: var(--sc-surface-3);
    color: var(--sc-text);
    box-shadow: inset 0 0 0 1px var(--sc-line-strong);
}

.btn-secondary:hover, .btn-secondary:focus {
    background: var(--sc-surface-3);
    color: var(--sc-text);
    filter: brightness(1.15);
}

.btn:focus-visible, .form-control:focus, .form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--sc-primary-rgb), 0.45);
}

/* Shared app button, used by the scanner and result screens */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 0 auto;
    padding: 12px 20px;
    border: none;
    border-radius: var(--sc-radius-pill);
    background: var(--sc-gradient-primary);
    color: #071022;
    font-family: var(--sc-font-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(var(--sc-primary-rgb), 0.3);
    transition: transform 0.15s ease, filter 0.2s ease;
}

.button:hover {
    filter: brightness(1.08);
}

.button:active {
    transform: scale(0.97);
}

/* Round icon button */
.sc-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(var(--sc-bg-rgb), 0.55);
    color: var(--sc-text);
    font-size: 20px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px var(--sc-line-strong);
    transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}

.sc-icon-button:hover {
    background: rgba(var(--sc-bg-rgb), 0.75);
}

.sc-icon-button:active {
    transform: scale(0.9);
}

.sc-icon-button.is-primary {
    background: var(--sc-primary);
    color: #071022;
    box-shadow: none;
}

.sc-icon-button.is-danger {
    color: var(--sc-danger);
}

/* ==========================================================================
   Form controls
   ========================================================================== */
/* :where() keeps the bare element selectors at zero specificity so component classes can override them */
.form-control, .form-select, :where(textarea, input[type="text"], input[type="password"], input[type="number"]) {
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--sc-line-strong);
    border-radius: 12px;
    background-color: var(--sc-bg-elevated);
    color: var(--sc-text);
    font-family: var(--sc-font-body);
    font-size: 16px; /* 16px stops iOS zooming into the field */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, :where(textarea, input):focus {
    border-color: var(--sc-primary);
    background-color: var(--sc-bg-elevated);
    color: var(--sc-text);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--sc-primary-rgb), 0.25);
}

.form-control:disabled, .form-control[readonly] {
    background-color: var(--sc-surface);
    color: var(--sc-text-muted);
    opacity: 1;
}

.form-control::placeholder, input::placeholder, textarea::placeholder {
    color: var(--sc-text-faint);
}

label {
    margin-bottom: 6px;
    color: var(--sc-text-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--sc-success);
}

.invalid {
    outline: none;
    border-color: var(--sc-danger) !important;
}

.validation-message {
    margin-top: 4px;
    color: var(--sc-danger);
    font-size: 13px;
}

.alert-danger {
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 12px;
    background: var(--sc-danger-soft);
    color: #ffc2c2;
}

/* Search field */
.search-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
    margin-bottom: 12px;
    padding: 0 14px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius-pill);
    background-color: var(--sc-bg-elevated);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar-container:focus-within {
    border-color: var(--sc-primary);
    box-shadow: 0 0 0 3px rgba(var(--sc-primary-rgb), 0.2);
}

.search-bar,
.search-bar:focus {
    flex-grow: 1;
    min-height: 44px;
    padding: 0;
    border: none;
    outline: none;
    background: none;
    box-shadow: none;
    color: var(--sc-text);
    font-size: 16px;
}

.search-icon {
    order: -1;
    font-size: 18px;
    color: var(--sc-text-faint);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    margin: 0;
    padding: 0;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    background-color: var(--sc-surface);
    color: var(--sc-text);
    box-shadow: var(--sc-shadow);
    text-align: left;
}

.card-body {
    overflow-x: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sc-line);
    background: transparent;
    font-family: var(--sc-font-display);
    font-size: 17px;
    font-weight: 600;
}

.card-header:first-child {
    border-radius: var(--sc-radius) var(--sc-radius) 0 0;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--sc-line);
    background: transparent;
}

.card-footer:last-child {
    border-radius: 0 0 var(--sc-radius) var(--sc-radius);
}

/* ==========================================================================
   Shared building blocks
   ========================================================================== */
.sc-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-section + .sc-section {
    margin-top: 22px;
}

.sc-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    font-family: var(--sc-font-display);
    font-size: 19px;
    font-weight: 600;
}

.sc-section-title small {
    font-family: var(--sc-font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--sc-text-muted);
}

.sc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--sc-radius-pill);
    background: var(--sc-surface-3);
    color: var(--sc-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.sc-chip ion-icon {
    font-size: 14px;
}

.sc-chip.is-primary { background: var(--sc-primary-soft); color: var(--sc-primary); }
.sc-chip.is-gold { background: var(--sc-gold-soft); color: var(--sc-gold); }
.sc-chip.is-purple { background: var(--sc-purple-soft); color: var(--sc-purple); }
.sc-chip.is-success { background: var(--sc-success-soft); color: var(--sc-success); }
.sc-chip.is-danger { background: var(--sc-danger-soft); color: var(--sc-danger); }

.sc-coins {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--sc-radius-pill);
    background: rgba(255, 200, 61, 0.12);
    color: var(--sc-gold);
    font-family: var(--sc-font-display);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    box-shadow: inset 0 0 0 1px rgba(255, 200, 61, 0.3);
}

.sc-coins::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff3b0 0%, #ffd23f 35%, #e08a00 100%);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 0 8px rgba(255, 200, 61, 0.5);
}

.sc-progress {
    position: relative;
    height: 8px;
    border-radius: var(--sc-radius-pill);
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.sc-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--sc-gradient-xp);
    box-shadow: 0 0 12px rgba(157, 123, 255, 0.5);
    transition: width 0.8s var(--sc-ease-out);
}

.sc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 20px;
    border: 1px dashed var(--sc-line-strong);
    border-radius: var(--sc-radius);
    color: var(--sc-text-muted);
    text-align: center;
}

.sc-empty ion-icon {
    font-size: 40px;
    color: var(--sc-text-faint);
}

.sc-empty strong {
    font-family: var(--sc-font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--sc-text);
}

.tab-divider {
    display: none;
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sc-danger);
    box-shadow: 0 0 0 2px var(--sc-bg), 0 0 10px rgba(255, 107, 107, 0.8);
    animation: sc-ping 2s ease-in-out infinite;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 2px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--sc-surface-3);
    color: var(--sc-primary);
    font-size: 19px;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease;
}

.icon-button:active {
    transform: scale(0.9);
}

.back-button {
    margin: 10px 0;
    font-size: 25px;
    z-index: 10;
}

.text-warning {
    color: var(--sc-gold) !important;
}

.text-danger {
    color: var(--sc-danger) !important;
}

/* Entrance animations fill "backwards" only: Chrome treats an element with a lingering transform animation as the
   containing block for position: fixed descendants, which would trap popups and the battle overlay inside it */
.sc-fade-in {
    animation: sc-fade-up 0.35s var(--sc-ease-out) backwards;
}

@keyframes sc-fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes sc-ping {
    0%, 100% { box-shadow: 0 0 0 2px var(--sc-bg), 0 0 0 0 rgba(255, 107, 107, 0.6); }
    50% { box-shadow: 0 0 0 2px var(--sc-bg), 0 0 0 5px rgba(255, 107, 107, 0); }
}

@keyframes sc-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Blazor
   ========================================================================== */
#blazor-error-ui {
    position: fixed;
    bottom: calc(var(--sc-tabbar-height) + var(--sc-safe-bottom) + 12px);
    left: 12px;
    right: 12px;
    z-index: 2000;
    display: none;
    padding: 12px 44px 12px 16px;
    border: 1px solid rgba(255, 107, 107, 0.5);
    border-radius: var(--sc-radius);
    background: #2a1420;
    color: #ffd6d6;
    box-shadow: var(--sc-shadow-lg);
}

#blazor-error-ui .reload {
    color: var(--sc-gold);
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 10px;
    right: 14px;
    cursor: pointer;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT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