:root {
    /* Light Mode (Default) */
    --primary-color: #7c3aed;
    /* Violet 600 */
    --secondary-color: #6d28d9;
    /* Violet 700 */
    --accent-color: #f59e0b;
    /* Amber 500 */
    --bg-gradient: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-color: #4c1d95;
    /* Violet 900 */
    --text-muted: #6d28d9;
    /* Violet 700 */
    --card-bg: #ffffff;
    --ticket-bg: #ffffff;
    --ticket-border: #4c1d95;
    --cell-marked: #fcd34d;
    /* Amber 300 */
}

body.dark-mode {
    /* Dark Mode */
    --primary-color: #a78bfa;
    /* Violet 400 */
    --secondary-color: #c4b5fd;
    /* Violet 300 */
    --accent-color: #fbbf24;
    /* Amber 400 */
    --bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #2e1065 100%);
    --glass-bg: rgba(46, 16, 101, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f5f3ff;
    --text-muted: #ddd6fe;
    --card-bg: rgba(46, 16, 101, 0.8);
    --ticket-bg: #ffffff;
    /* Tickets stay white in dark mode for contrast/printing logic usually, but let's make them dark for screen */
    --ticket-border: #8b5cf6;
    --cell-marked: #d97706;
    /* Amber 600 */
}

/* Override ticket bg for dark mode screen only */
body.dark-mode .tambola-ticket {
    background: #1e1b4b;
    color: #f5f3ff;
    border-color: #8b5cf6;
}

body.dark-mode .ticket-cell {
    border-color: #8b5cf6;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.glass-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1rem;
    margin-bottom: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.back-link {
    justify-self: start;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
}

.logo {
    justify-self: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.theme-btn {
    justify-self: end;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Generator Controls */
.generator-card {
    text-align: center;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    margin-bottom: 2rem;
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.number-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.number-control button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.number-control input {
    width: 60px;
    text-align: center;
    font-size: 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-btn,
.secondary-btn,
.share-btn {
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    transition: transform 0.2s;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.share-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.share-section p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.copy-container {
    display: flex;
    gap: 0.5rem;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

#share-url-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0 0.5rem;
    width: 100%;
    text-overflow: ellipsis;
}

#share-url-input:focus {
    outline: none;
}

.copy-btn {
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    transition: transform 0.2s, background 0.2s;
    color: white;
    background: #4b5563;
    /* Gray 600 */
    box-shadow: 0 4px 15px rgba(75, 85, 99, 0.4);
}

.copy-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.caller-btn {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    /* Pink 500 to Pink 600 */
    color: white;
    margin: 0 auto;
    text-decoration: none;
    justify-content: center;
    width: 100%;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.caller-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

/* Tickets Grid */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.tambola-ticket {
    background: var(--ticket-bg);
    border: 2px solid var(--ticket-border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    page-break-inside: avoid;
    position: relative;
}

.ticket-header {
    text-align: center;
    font-weight: 700;
    color: var(--ticket-border);
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    border-top: 2px solid var(--ticket-border);
    border-left: 2px solid var(--ticket-border);
}

.ticket-cell {
    aspect-ratio: 1;
    border-right: 2px solid var(--ticket-border);
    border-bottom: 2px solid var(--ticket-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    user-select: none;
}

.ticket-cell.empty {
    background: rgba(0, 0, 0, 0.05);
}

.ticket-cell.marked {
    background: var(--cell-marked);
    color: #000;
    border-radius: 50%;
    transform: scale(0.8);
}

.ticket-watermark {
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 5px;
    opacity: 0.6;
}

/* SEO Content */
.seo-content {
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
}

.seo-content h2 {
    color: var(--primary-color);
    margin-top: 0;
}

.technique-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.detail-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.glass-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .app-container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .tickets-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2 columns */
        gap: 20px;
        padding: 20px;
    }

    .tambola-ticket {
        border: 2px solid #000;
        box-shadow: none;
        background: white !important;
        color: black !important;
        break-inside: avoid;
    }

    .ticket-header,
    .ticket-watermark {
        color: #000;
    }

    .ticket-grid {
        border-color: #000;
    }

    .ticket-cell {
        border-color: #000;
        font-size: 12pt;
    }

    .ticket-cell.empty {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}