:root {
    --bg: #11161d;
    --bg-top: #1a232d;
    --surface: rgba(18, 24, 31, 0.88);
    --surface-strong: rgba(12, 17, 23, 0.96);
    --line: rgba(122, 209, 255, 0.17);
    --line-strong: rgba(255, 184, 43, 0.35);
    --text: #ecede7;
    --muted: #9aa8b6;
    --signal: #7ad1ff;
    --safety: #ffb82b;
    --danger: #ff8370;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

html, body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(122, 209, 255, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 184, 43, 0.1), transparent 22%),
        linear-gradient(180deg, var(--bg-top), var(--bg));
    font-family: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(122, 209, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(122, 209, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 92%);
}

h1:focus {
    outline: none;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 3px;
}

#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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8y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xNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    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 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--signal);
            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-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

::selection {
    background: rgba(255, 184, 43, 0.28);
}

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

/* iOS Safe Area and PWA Integration Styles */
.app-shell {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* iOS Install Banner - Premium Glassmorphism at bottom of viewport */
.ios-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(26, 35, 45, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(122, 209, 255, 0.25);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    z-index: 1000;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.ios-install-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ios-install-icon {
    font-size: 24px;
    background: rgba(122, 209, 255, 0.15);
    padding: 8px;
    border-radius: 12px;
}

.ios-install-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ios-install-text strong {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.ios-install-text span {
    color: var(--muted);
    font-size: 12px;
}

.ios-install-btn {
    background: linear-gradient(135deg, #7ad1ff, #009dff);
    color: #0c1117;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(122, 209, 255, 0.25);
}

.ios-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(122, 209, 255, 0.4);
}

.ios-install-btn:active {
    transform: translateY(0);
}

/* iOS Instructions Overlay - Dark Glass Overlay */
.ios-instructions-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1010;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ios-instructions-card {
    background: #1a232d;
    border: 1px solid rgba(255, 184, 43, 0.25);
    border-radius: 24px;
    padding: 24px;
    width: calc(100% - 32px);
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ios-instructions-card h3 {
    margin: 0;
    color: var(--safety);
    font-size: 20px;
    font-weight: 700;
}

.ios-instructions-card ol {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: var(--text);
    font-size: 14px;
}

.ios-instructions-card li strong {
    color: #fff;
}

.share-icon, .add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    margin: 0 4px;
}

.ios-close-btn {
    background: transparent;
    color: var(--safety);
    border: 1px solid var(--safety);
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.ios-close-btn:hover {
    background: rgba(255, 184, 43, 0.1);
}

/* GenUI Layout Engine Styling */
:root {
    --genui-spacing-step: 28px;
    --genui-accent: #ff9f1c;
}

.genui-renderer-container {
    display: flex;
    flex-direction: column;
    gap: var(--genui-spacing-step);
    padding: var(--genui-spacing-step);
    padding-left: calc(var(--genui-spacing-step) + env(safe-area-inset-left, 0px));
    padding-right: calc(var(--genui-spacing-step) + env(safe-area-inset-right, 0px));
    padding-bottom: calc(var(--genui-spacing-step) + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: "Aptos", "Trebuchet MS", sans-serif;
}

.genui-card {
    background: rgba(26, 35, 45, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(122, 209, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    color: var(--text);
}

.genui-card-header {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--safety);
}

.genui-card-text {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.genui-card-text:last-of-type {
    margin-bottom: 0;
}

.btn-flat {
    background: transparent;
    border: none;
    color: var(--genui-accent);
    font-weight: 700;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.2s ease;
}

.btn-flat:hover {
    opacity: 0.8;
}

.genui-button-select {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.genui-button-select-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
}

.genui-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.btn-genui-option {
    background: rgba(18, 24, 31, 0.8);
    border: 1.5px solid rgba(122, 209, 255, 0.2);
    color: var(--text);
    padding: 14px 10px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px; /* High accessibility touch target */
}

.btn-genui-option:hover {
    border-color: var(--genui-accent);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 159, 28, 0.25);
}

.btn-genui-option:active {
    transform: scale(0.98);
}

.genui-context-chipbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: rgba(12, 17, 23, 0.5);
    border-radius: 12px;
    border: 1px dashed rgba(122, 209, 255, 0.15);
}

.genui-chip {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 159, 28, 0.12);
    border: 1px solid rgba(255, 159, 28, 0.35);
    border-radius: 20px;
    padding: 4px 10px;
    gap: 6px;
}

.genui-chip-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.btn-genui-chip-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-genui-chip-remove:hover {
    color: #fff;
}

