:root {
    --primary: #f218e6;
    /* Neon Pink from OG Image */
    --primary-hover: #d915cc;
    --secondary: #6ed9ff;
    /* Electric Blue from Favicon */
    --secondary-hover: #5cc0e6;
    --bg-color: #fef7e0;
    /* Warm Cream from OG Image */
    --text-main: #2d3748;
    --text-muted: #718096;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(242, 24, 230, 0.08);
    /* Pink shadow */
    --pill-bg: #FFFFFF;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #fff0fb, transparent 40%),
        radial-gradient(circle at bottom left, #e8fbff, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

header {
    text-align: center;
    margin-top: 10px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo-img {
    height: 15rem;
    /* Adjusted for a full wordmark logo */
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(242, 24, 230, 0.3));
    /* Pink glow applied directly to image */
}

.glow-text {
    text-shadow: 0 0 10px rgba(242, 24, 230, 0.4);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 20px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.textarea-wrapper {
    display: flex;
    background: transparent;
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    height: 156px;
    /* Multiple of 26px line-height */
}

.line-numbers {
    padding: 1px 15px 0 5px;
    /* Top padding 1px to align with textarea */
    text-align: right;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    line-height: 26px;
    user-select: none;
    overflow-y: hidden;
    height: 100%;
    min-width: 45px;
    opacity: 0.6;
    font-weight: 800;
    border-right: 2px solid var(--glass-border);
    margin-right: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.line-numbers div {
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

textarea {
    flex: 1;
    height: 100%;
    /* Multiple of 26px line-height */
    border: none;
    background: transparent;
    resize: none;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 26px;
    padding-top: 1px;
    /* Align first line */
    white-space: pre;
    /* Ensure lines don't wrap and cause number desync */
    overflow-x: auto;
}

.lined-textarea {
    background-image: repeating-linear-gradient(transparent, transparent 25px, rgba(0, 0, 0, 0.1) 25px, rgba(0, 0, 0, 0.1) 26px);
    background-clip: content-box;
    background-origin: content-box;
}

textarea:focus {
    outline: none;
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.magic-box-container {
    position: relative;
    height: 250px;
}

.magic-box {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 10px;
    padding: 20px;
}

.magic-box-empty-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
    transition: opacity 0.3s;
}

.pills-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.pill {
    background: var(--pill-bg);
    color: var(--primary);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(242, 24, 230, 0.3);
    animation: drop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: translateY(-50px);
    opacity: 0;
    font-size: 0.9rem;
    word-break: break-all;
    max-width: 100%;
}

@keyframes drop-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pill.highlight {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary);
    transform: scale(1.1);
    transition: all 0.1s;
    z-index: 10;
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.draw-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.draw-controls label {
    font-weight: 600;
    color: var(--text-main);
}

.stepper {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.stepper-btn {
    background: #f1f3f5;
    border: none;
    padding: 10px 15px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s;
}

.stepper-btn:hover {
    background: #e9ecef;
}

.stepper-btn:active {
    background: #dee2e6;
}

.draw-controls input {
    width: 50px;
    text-align: center;
    border: none;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    color: var(--primary);
    background: transparent;
    -moz-appearance: textfield;
    /* Hide default arrows Firefox */
}

.draw-controls input::-webkit-outer-spin-button,
.draw-controls input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.draw-controls input:focus {
    outline: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #e000d0);
    color: white;
    border: none;
    padding: 20px 0;
    width: 100%;
    border-radius: 100px;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(242, 24, 230, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.primary-btn:active,
.primary-btn.active {
    transform: scale(0.96);
    box-shadow: 0 5px 10px rgba(242, 24, 230, 0.2);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: var(--secondary);
    color: white;
    /* Changed specifically for electric blue which might need dark text or white */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: none;
    padding: 15px 30px;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(110, 217, 255, 0.4);
    transition: transform 0.2s;
}

.secondary-btn:active {
    transform: scale(0.96);
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.buy-coffee-link {
    background: #FFDD00;
    color: #4a4a4a;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(255, 221, 0, 0.3);
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-bottom: -10px;
    /* Pull logo up slightly */
    padding-right: 10px;
}

.lang-selector-floating {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 50;
}

.lang-selector-floating a {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: transform 0.2s, filter 0.2s;
    filter: grayscale(40%);
}

.lang-selector-floating img {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lang-selector-floating a:hover {
    transform: scale(1.2);
    filter: grayscale(0%);
}

/* Overlays */
.hidden {
    display: none !important;
}

.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 101;
}

.result-card {
    background: var(--glass-bg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 40px 20px;
    z-index: 102;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.winner-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.winner-name-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    max-height: 50vh;
    overflow-y: auto;
}

.winner-item {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--primary);
    word-break: break-all;
    line-height: 1.2;
    animation: winner-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes winner-pop {
    0% {
        transform: scale(0) translateY(50px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pop-in {
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both infinite;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Countdown Overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
}

.countdown-text {
    font-family: 'Outfit', sans-serif;
    font-size: 8rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: count-pop 1s infinite;
}

@keyframes count-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    30% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
}

.cookie-banner p {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-right: 15px;
    flex: 1;
}

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        bottom: 10px;
        left: 10px;
        right: 10px;
    }

    .cookie-banner p {
        margin-right: 0;
    }
}