:root {
    --bg-1: #667eea;
    --bg-2: #764ba2;
    --text: #f8f9ff;
    --surface: rgba(255, 255, 255, 0.12);
    --surface-border: rgba(255, 255, 255, 0.18);
    --shadow: rgba(0, 0, 0, 0.28);
    --number-1: #89f7fe;
    --number-2: #66a6ff;
    --btn-1: #ff758c;
    --btn-2: #ff7eb3;
    --toggle-1: rgba(255, 255, 255, 0.2);
    --toggle-2: rgba(255, 255, 255, 0.08);
    --focus: #ffe7a8;
}

body[data-theme="light"] {
    --bg-1: #f5f8ff;
    --bg-2: #dbe8ff;
    --text: #1c1f2a;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(90, 115, 150, 0.15);
    --shadow: rgba(30, 60, 90, 0.18);
    --number-1: #ffcf4a;
    --number-2: #ff7b5c;
    --btn-1: #4cc3ff;
    --btn-2: #6f7bff;
    --toggle-1: rgba(30, 60, 90, 0.08);
    --toggle-2: rgba(30, 60, 90, 0.02);
    --focus: #2f62ff;
}

body {
    font-family: 'Helvetica Neue', sans-serif;
    background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.25), transparent 45%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

.site-header {
    width: min(92vw, 980px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 8px;
}

.site-logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--text);
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
    letter-spacing: 0.04em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.nav-link.is-active {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
}

.layout {
    width: min(94vw, 1100px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 32px;
    align-items: start;
}

.container {
    text-align: center;
    background-color: var(--surface);
    border: 1px solid var(--surface-border);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 18px 40px var(--shadow);
    backdrop-filter: blur(10px);
    position: relative;
    max-width: 720px;
    width: min(90vw, 720px);
    margin-bottom: 48px;
}

.content-section {
    text-align: left;
    margin: 32px 0;
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--surface-border);
}

body[data-theme="light"] .content-section {
    background: rgba(255, 255, 255, 0.78);
}

.content-section h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.content-section p {
    margin: 0 0 16px;
    line-height: 1.6;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.info-card {
    padding: 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--surface-border);
}

body[data-theme="light"] .info-card {
    background: rgba(255, 255, 255, 0.8);
}

.info-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.info-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.page-content {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 12px;
}

.page-section {
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--surface-border);
}

body[data-theme="light"] .page-section {
    background: rgba(255, 255, 255, 0.78);
}

.page-section h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.page-section p {
    margin: 0 0 12px;
    line-height: 1.7;
}

.page-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.7;
}

.ad-sidebar {
    position: sticky;
    top: 24px;
    min-height: 300px;
    border-radius: 16px;
    border: 1px dashed var(--surface-border);
    background: rgba(255, 255, 255, 0.06);
    padding: 16px;
    margin-left: 8px;
}

.ad-slot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    opacity: 0.8;
}

.ad-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
}

.ad-placeholder {
    margin: 0;
    line-height: 1.5;
}

h1 {
    margin: 30px 0 40px;
    font-size: 3em;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    margin: -24px 0 28px;
    font-size: 16px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
}

.theme-toggle {
    background: linear-gradient(135deg, var(--toggle-1) 0%, var(--toggle-2) 100%);
    color: var(--text);
    border: 1px solid var(--surface-border);
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.numbers-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    perspective: 1000px; /* For 3D animation */
    flex-wrap: wrap;
}

.number {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--number-1) 0%, var(--number-2) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform-style: preserve-3d;
    animation: flipIn 0.6s ease-out forwards;
    opacity: 0;
}

@media (max-width: 900px) {
    .container {
        padding: 40px 32px;
    }

    h1 {
        font-size: 2.6em;
    }

    .site-header {
        width: min(92vw, 760px);
    }

    .layout {
        width: min(92vw, 760px);
        grid-template-columns: minmax(0, 1fr) 220px;
        gap: 24px;
    }

    .site-footer {
        width: min(92vw, 760px);
    }
}

@media (max-width: 640px) {
    body {
        padding: 24px 0;
        overflow: auto;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .ad-sidebar {
        position: static;
        min-height: 220px;
        order: 2;
    }

    .container {
        width: 92vw;
        padding: 32px 20px;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    h1 {
        margin: 10px 0 28px;
        font-size: 2.2em;
    }

    .numbers-container {
        gap: 12px;
        margin-bottom: 28px;
    }

    .number {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    #generate-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 18px;
    }

    .email-row {
        flex-direction: column;
        gap: 10px;
    }

    .email-input,
    .email-submit {
        width: 100%;
    }

    .animal-layout {
        grid-template-columns: 1fr;
    }

    .footer-links {
        gap: 10px;
    }
}

@media (max-width: 420px) {
    h1 {
        font-size: 1.9em;
    }

    .number {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }
}

/* Stagger the animation for each number */
.number:nth-child(1) { animation-delay: 0.1s; }
.number:nth-child(2) { animation-delay: 0.2s; }
.number:nth-child(3) { animation-delay: 0.3s; }
.number:nth-child(4) { animation-delay: 0.4s; }
.number:nth-child(5) { animation-delay: 0.5s; }
.number:nth-child(6) { animation-delay: 0.6s; }

@keyframes flipIn {
    from {
        transform: rotateY(90deg) scale(0.8);
        opacity: 0;
    }
    to {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
    }
}

#generate-btn {
    background: linear-gradient(135deg, var(--btn-1) 0%, var(--btn-2) 100%);
    color: #fff;
    border: none;
    padding: 20px 40px;
    font-size: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#generate-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.email-form {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.email-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.8;
}

.email-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.email-input {
    flex: 1 1 220px;
    min-width: 200px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.email-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

body[data-theme="light"] .email-input {
    background: rgba(255, 255, 255, 0.9);
}

body[data-theme="light"] .email-input::placeholder {
    color: rgba(28, 31, 42, 0.5);
}

.email-input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(47, 98, 255, 0.2);
}

.email-submit {
    padding: 14px 22px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--btn-1) 0%, var(--btn-2) 100%);
    color: #fff;
    font-size: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.email-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.email-submit:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.email-note {
    margin: 0;
    font-size: 13px;
    opacity: 0.75;
}

.disqus-thread {
    margin-top: 32px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 16px;
}

body[data-theme="light"] .disqus-thread {
    background: rgba(255, 255, 255, 0.6);
}

.site-footer {
    width: min(92vw, 980px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0 32px;
    font-size: 13px;
    opacity: 0.85;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.footer-links a:hover {
    border-bottom-color: currentColor;
}

.footer-note {
    margin: 0;
}

.animal-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
    text-align: left;
}

.panel {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid var(--surface-border);
}

body[data-theme="light"] .panel {
    background: rgba(255, 255, 255, 0.75);
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.preview-box {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
}

.preview-box video,
.preview-box img,
.preview-box canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.panel-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.panel-actions button,
.panel-actions label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--btn-1) 0%, var(--btn-2) 100%);
    color: #fff;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.panel-actions button:hover,
.panel-actions label:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.panel-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.panel-actions input[type="file"] {
    display: none;
}

.result-box {
    margin-top: 16px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--surface-border);
}

body[data-theme="light"] .result-box {
    background: rgba(255, 255, 255, 0.75);
}

.result-box .result-title {
    margin: 0 0 8px;
    font-size: 15px;
    opacity: 0.8;
}

.result-value {
    font-size: 22px;
    font-weight: 600;
}

.result-details {
    margin-top: 6px;
    font-size: 14px;
    opacity: 0.8;
}

.preview-placeholder {
    margin: 0;
    font-size: 14px;
    opacity: 0.7;
}
