:root {
    --bg: #080d18;
    --panel: rgba(12, 18, 32, 0.82);
    --panel-strong: rgba(15, 23, 42, 0.94);
    --line: rgba(148, 163, 184, 0.18);
    --text: #f8fafc;
    --muted: #94a3b8;
    --soft: #cbd5e1;
    --accent: #38bdf8;
    --accent-strong: #2563eb;
}

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

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.2), transparent 30%),
        radial-gradient(circle at 85% 18%, rgba(37, 99, 235, 0.2), transparent 28%),
        linear-gradient(135deg, #070b14 0%, #0b1220 48%, #111827 100%);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 82%);
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
    align-items: center;
    gap: clamp(28px, 6vw, 72px);
    padding: 56px 0;
}

.hero {
    display: grid;
    gap: 28px;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 999px;
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    max-width: 560px;
    font-size: clamp(3.2rem, 9vw, 6.8rem);
    line-height: 0.9;
    letter-spacing: -0.08em;
    text-transform: uppercase;
}

.lead {
    max-width: 560px;
    margin-top: 22px;
    color: var(--soft);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.6;
}

.game-card {
    width: 100%;
}

.topic-display {
    position: relative;
}

.topic-display {
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vw, 44px) 0;
    margin-bottom: 24px;
}

#topic-text {
    width: 100%;
    color: var(--text);
    font-size: clamp(1.75rem, 4.5vw, 3rem);
    font-weight: 850;
    line-height: 1.12;
    text-align: center;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.final-topic {
    animation: popIn 0.36s cubic-bezier(0.21, 0.75, 0.45, 1.02) forwards;
    color: #e0f2fe;
}

.btn,
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 16px 24px;
    border-radius: 18px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.btn {
    width: 100%;
    border: 0;
    background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 20px 46px rgba(37, 99, 235, 0.34);
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 24px 54px rgba(37, 99, 235, 0.42);
}

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

.btn:disabled {
    cursor: wait;
    filter: grayscale(0.25) brightness(0.85);
    box-shadow: none;
}

.feedback-link {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 2;
    transform: translateX(-50%);
    color: var(--soft);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    white-space: nowrap;
    pointer-events: auto;
}

.feedback-link a {
    color: #bae6fd;
    text-decoration: none;
}

.feedback-link a:hover {
    text-decoration: underline;
}

.share-btn {
    position: fixed;
    left: 18px;
    bottom: 18px;
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(148, 163, 184, 0.1);
    color: var(--soft);
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.share-btn:hover {
    transform: translateY(-2px);
    background: rgba(148, 163, 184, 0.18);
    color: var(--text);
}

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

.share-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-btn.is-copied {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.35);
}

.share-btn.is-error {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.28);
}

@keyframes popIn {
    0% {
        transform: scale(0.94) translateY(10px);
        opacity: 0;
    }

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

@media (max-width: 820px) {
    .app-shell {
        width: min(100% - 28px, 640px);
        grid-template-columns: 1fr;
        align-content: start;
        gap: 24px;
        padding: 32px 0;
    }

    h1 {
        font-size: clamp(3rem, 18vw, 5.4rem);
    }

    .lead {
        margin-top: 16px;
    }

    .topic-display {
        min-height: 190px;
    }
}

@media (max-width: 460px) {
    .app-shell {
        width: min(100% - 20px, 640px);
        padding: 22px 0;
    }

    .feedback-link {
        bottom: 12px;
        max-width: min(320px, calc(100% - 80px));
        font-size: 0.9rem;
        line-height: 1.4;
        white-space: normal;
    }

    .game-card {
        border-radius: 26px;
    }

    .topic-display {
        min-height: 170px;
        border-radius: 20px;
    }

    .share-btn {
        left: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
    }
}
