@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --starry-midnight: #0f1729;
    --starry-indigo: #1a2642;
    --starry-deep-blue: #192038;
    --moonlight-gold: #f4d58d;
    --soft-lavender: #b8a5d8;
    --muted-mint: #c8e6d8;
    --starry-purple: #2d2550;
    --accent-glow: #ffd89b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, var(--starry-midnight) 0%, var(--starry-indigo) 50%, var(--starry-deep-blue) 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
}

body {
    position: relative;
}

/* Twinkling stars background */
body::before,
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 60px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 90px 10px, white, transparent),
        radial-gradient(1px 1px at 150px 120px, white, transparent),
        radial-gradient(2px 2px at 200px 60px, white, transparent),
        radial-gradient(1px 1px at 250px 90px, white, transparent),
        radial-gradient(1px 1px at 300px 30px, white, transparent),
        radial-gradient(2px 2px at 350px 100px, white, transparent);
    background-size: 400px 200px;
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
    animation: twinkle 8s ease-in-out infinite;
    opacity: 0.6;
}

body::after {
    background-image: 
        radial-gradient(1px 1px at 40px 20px, white, transparent),
        radial-gradient(1px 1px at 80px 80px, white, transparent),
        radial-gradient(2px 2px at 120px 40px, white, transparent),
        radial-gradient(1px 1px at 180px 100px, white, transparent),
        radial-gradient(1px 1px at 220px 20px, white, transparent),
        radial-gradient(2px 2px at 280px 70px, white, transparent),
        radial-gradient(1px 1px at 320px 50px, white, transparent);
    background-size: 400px 200px;
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
    animation: twinkle 8s ease-in-out infinite 1s;
    opacity: 0.8;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.8; }
}

#app {
    position: relative;
    z-index: 1;
}

/* Typography */
.storybook-title {
    font-family: 'Fredoka', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fredoka', sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

/* Container */
.container {
    max-width: 28rem;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 6rem;
}

/* Story Card */
.story-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 0.75rem;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.05),
        0 20px 25px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.story-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--moonlight-gold) 0%, var(--accent-glow) 100%);
}

.story-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--moonlight-gold) 0%, #f4a261 100%);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 0.875rem 1.5rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(244, 213, 141, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--starry-midnight);
    font-size: 0.875rem;
}

.form-label .required {
    color: var(--moonlight-gold);
    margin-left: 2px;
}

.form-label .optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.8125rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1.5px solid rgba(184, 165, 216, 0.3);
    border-radius: 16px;
    background: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: var(--starry-midnight);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9ca3af;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--moonlight-gold);
    box-shadow: 0 0 0 3px rgba(244, 213, 141, 0.1);
}

.form-textarea {
    min-height: 96px;
    resize: vertical;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* Name Pills */
.name-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(184, 165, 216, 0.2) 0%, rgba(200, 230, 216, 0.2) 100%);
    border: 1.5px solid rgba(184, 165, 216, 0.4);
    font-weight: 500;
    color: var(--starry-purple);
    transition: transform 0.2s ease, border-color 0.2s ease;
    cursor: default;
}

.name-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(184, 165, 216, 0.6);
}

.name-pill.winner {
    background: linear-gradient(135deg, rgba(244, 213, 141, 0.3) 0%, rgba(255, 216, 155, 0.3) 100%);
    border: 1.5px solid var(--moonlight-gold);
    color: var(--starry-midnight);
    box-shadow: 0 0 20px rgba(244, 213, 141, 0.3);
}

.name-pill.winner .pill-text {
    background: linear-gradient(135deg, #d4a03c 0%, #b87d00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar input {
    padding-left: 2.75rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft-lavender);
    pointer-events: none;
}

/* Filter Chips */
.filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-chips::-webkit-scrollbar {
    height: 4px;
}

.filter-chips::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.filter-chips::-webkit-scrollbar-thumb {
    background: rgba(184, 165, 216, 0.3);
    border-radius: 2px;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border-radius: 16px;
    border: 1.5px solid rgba(184, 165, 216, 0.4);
    background: rgba(255, 255, 255, 0.9);
    color: var(--starry-midnight);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 1);
}

.filter-chip.active {
    background: var(--moonlight-gold);
    color: white;
    border-color: var(--moonlight-gold);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(184, 165, 216, 0.2);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: rgba(15, 23, 41, 0.5);
    transition: color 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    color: rgba(15, 23, 41, 0.7);
}

.nav-item.active {
    color: var(--moonlight-gold);
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6b7280;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Success State */
.success-message {
    text-align: center;
    padding: 2rem;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--moonlight-gold);
    animation: spin 0.6s ease-in-out;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.success-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--starry-midnight);
}

.success-subtitle {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.success-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--soft-lavender);
    text-decoration: none;
    transition: all 0.2s ease;
}

.success-link:hover {
    color: white;
}

.success-link svg {
    transition: transform 0.2s ease;
}

.success-link:hover svg {
    transform: translateX(4px);
}

/* Link styles */
.view-guesses-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--soft-lavender);
    text-decoration: none;
    font-size: 0.875rem;
    margin-top: 1rem;
    transition: color 0.2s ease;
}

.view-guesses-link:hover {
    color: white;
}

.view-guesses-link svg {
    transition: transform 0.2s ease;
}

.view-guesses-link:hover svg {
    transform: translateX(4px);
}

/* Guess Card Specific */
.guess-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.name-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.guess-note {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(184, 165, 216, 0.2);
    color: var(--starry-midnight);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.guess-note-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more-btn {
    background: none;
    border: none;
    color: var(--soft-lavender);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    margin-top: 0.25rem;
    transition: color 0.2s ease;
}

.read-more-btn:hover {
    color: var(--moonlight-gold);
}

.guess-timestamp {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #9ca3af;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Winner Card */
.winner-card {
    box-shadow: 
        0 0 20px rgba(244, 213, 141, 0.2),
        0 0 40px rgba(244, 213, 141, 0.1),
        0 4px 6px rgba(0, 0, 0, 0.07);
    border: 2px solid var(--moonlight-gold);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 213, 141, 0.05) 100%);
}

.winner-card .guess-meta {
    background: linear-gradient(135deg, #d4a03c 0%, #b87d00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.3s ease-out;
}

/* Staggered animation for lists */
.stagger-item {
    animation: fadeInUp 0.3s ease-out backwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* Responsive */
@media (min-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    
    .story-card {
        padding: 2rem;
    }
}

#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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCB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2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: #1b6ec2;
            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;
}

.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;
}