/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #334155;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 960px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; width: 100%; }

/* ===== HEADER ===== */
.site-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.2rem;
    white-space: nowrap;
}

.logo-icon { font-size: 1.5rem; }

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.main-nav a:hover, .main-nav a.active {
    background: var(--bg-elevated);
    color: var(--text);
}

.nav-icon { font-size: 1rem; }

/* Mobile menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .main-nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .main-nav.open { max-height: 500px; overflow-y: auto; }
    .main-nav ul { flex-direction: column; padding: 16px; }
    .main-nav a { padding: 12px; font-size: 1rem; }
    .nav-label { display: inline; }
}

/* ===== MAIN ===== */
.site-main { flex: 1; padding: 32px 0 64px; }

/* ===== HERO / PAGE TITLE ===== */
.page-hero { text-align: center; margin-bottom: 32px; }

.page-hero h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-hero .subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== GENERATOR CARD ===== */
.gen-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .gen-card { padding: 20px; }
}

/* Form rows */
.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    min-width: 120px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.1rem;
    font-family: var(--font);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Checkbox */
.checkbox-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

/* ===== RESULT DISPLAY ===== */
.result-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin-top: 24px;
    animation: fadeInUp 0.4s ease;
}

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

.result-number {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 800;
    color: var(--primary-light);
    line-height: 1;
    margin: 0;
    word-break: break-all;
}

.result-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.result-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
    padding: 0 16px;
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
    animation: popIn 0.3s ease backwards;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.result-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 16px;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-actions .btn { width: auto; padding: 10px 20px; font-size: 0.9rem; }

/* ===== LOTTERY TEMPLATES ===== */
.lottery-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.preset-btn {
    padding: 16px 8px;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    font-family: var(--font);
}

.preset-btn:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.preset-btn.active {
    border-color: var(--primary);
    background: var(--bg-card);
}

.preset-btn .preset-title { font-weight: 700; font-size: 1.1rem; }
.preset-btn .preset-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ===== YES/NO & COIN ===== */
.yesno-result {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    padding: 40px;
    text-align: center;
}

.yesno-result.yes { color: var(--success); }
.yesno-result.no { color: var(--danger); }

.coin-container {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    perspective: 600px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    backface-visibility: hidden;
}

.coin-front { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: white; }
.coin-back { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; transform: rotateY(180deg); }

/* ===== DICE ===== */
.dice-container {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 24px 0;
}

.dice {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, white, #e2e8f0);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--bg);
    box-shadow: var(--shadow);
    animation: diceRoll 0.5s ease;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.dice-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.dice-selector .preset-btn { min-width: 70px; }

/* ===== WHEEL ===== */
.wheel-container {
    text-align: center;
    margin: 20px 0;
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
}

/* ===== LIST INPUT ===== */
.list-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

.list-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.list-result {
    text-align: center;
    padding: 24px;
}

.list-result-item {
    padding: 12px 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 8px 0;
    font-size: 1.1rem;
    animation: fadeInUp 0.3s ease backwards;
}

/* ===== PASSWORD ===== */
.password-display {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    padding: 20px;
    background: var(--bg);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-sm);
    text-align: center;
    word-break: break-all;
    letter-spacing: 2px;
    color: var(--primary-light);
    margin: 16px 0;
}

.password-strength {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
}

.password-strength-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0;
}

/* ===== SEO CONTENT ===== */
.seo-content {
    margin-top: 40px;
    line-height: 1.8;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.seo-content h2 {
    color: var(--text);
    font-size: 1.3rem;
    margin: 32px 0 16px;
}

.seo-content h3 {
    color: var(--text);
    font-size: 1.1rem;
    margin: 24px 0 12px;
}

.seo-content p { margin-bottom: 16px; }

.seo-content ul, .seo-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.seo-content li { margin-bottom: 8px; }

.seo-content a { color: var(--primary-light); }

/* FAQ */
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-question {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after { content: '+'; font-size: 1.5rem; color: var(--primary); transition: var(--transition); }

details[open] .faq-question::after { transform: rotate(45deg); }

.faq-answer {
    padding: 0 20px 16px;
    color: var(--text-muted);
    line-height: 1.7;
}

/* Quick links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: var(--transition);
}

.quick-link:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-link-icon { font-size: 2rem; }
.quick-link-text { font-weight: 600; font-size: 0.9rem; }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.footer-info { color: var(--text-muted); font-size: 0.9rem; }
.stats-line { color: var(--text-dim); margin-top: 4px; }

.footer-share {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border-radius: 50%;
    color: var(--text);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    transition: var(--transition);
}

.share-btn:hover { background: var(--primary); }

.footer-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.footer-nav a:hover { color: var(--text); }

.copyright { color: var(--text-dim); font-size: 0.8rem; }

/* ===== STATS COUNTER ===== */
.stats-banner {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin: 24px 0;
}

.stat-item { text-align: center; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

@media (max-width: 600px) {
    .form-row { flex-direction: column; }
    .form-group { width: 100%; }
    .btn { font-size: 1rem; }
    .result-card { padding: 24px 16px; }
    .quick-links { grid-template-columns: repeat(2, 1fr); }
    .stats-banner { gap: 20px; }
}
