* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Rubik', sans-serif;
}

:root {
    --bg-dark: #0a0a0a;
    --bg-panel: #111111;
    --bg-panel-2: #151515;
    --border-soft: rgba(255,255,255,0.08);
    --border-red: rgba(211,13,13,0.52);
    --text-main: #ffffff;
    --text-muted: #b3b3b3;
    --text-body: #cfcfcf;
    --red: #d30d0d;
    --red-hot: #ff3131;
    --red-dark: #9f0909;
    --discord: #5865F2;
    --shadow: rgba(0,0,0,0.48);
}

html {
    min-height: 100%;
    background: var(--bg-dark);
    scroll-behavior: smooth;
}

body {
    color: var(--text-main);
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(211,13,13,0.16), transparent 38%),
        linear-gradient(-45deg, #0a0a0a, #111111, #0d0d0d, #151515);
    background-size: 160% 160%, 420% 420%;
    animation: gradientShift 22s ease infinite;
    overflow-x: hidden;
}

body.home-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 46px 18px;
}

body.rules-open {
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 50% 0%, 0% 50%; }
    50% { background-position: 50% 0%, 100% 50%; }
    100% { background-position: 50% 0%, 0% 50%; }
}

canvas#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 2;
    width: min(880px, 100%);
    text-align: center;
}

.hero-shell {
    position: relative;
    padding: 0;
}

.logo {
    width: 140px;
    height: 140px;
    margin: 0 auto 18px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #1f1f1f;
    background: #111;
    box-shadow: 0 0 0 0 rgba(211,13,13,0.35), 0 20px 46px rgba(0,0,0,0.38);
    animation: logoPulse 5.5s ease-in-out infinite;
}

.logo img,
.rules-brand img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(211,13,13,0.24), 0 20px 46px rgba(0,0,0,0.38); transform: translateY(0); }
    50% { box-shadow: 0 0 0 12px rgba(211,13,13,0), 0 26px 54px rgba(0,0,0,0.45); transform: translateY(-4px); }
}

.eyebrow {
    color: var(--red-hot);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

h1 {
    font-size: clamp(2.35rem, 7vw, 4.4rem);
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.04em;
}

.subtitle {
    color: var(--text-muted);
    width: min(680px, 100%);
    margin: 0 auto 25px;
    line-height: 1.65;
    font-size: 1.02rem;
}

.highlight {
    color: var(--red-hot);
    font-weight: 700;
}

.announcement,
.focus-card,
.rules-screen {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    color: var(--text-body);
}

.announcement {
    margin: 24px auto 24px;
    padding: 18px;
    font-size: 0.95rem;
    line-height: 1.65;
    width: min(760px, 100%);
    border-radius: 6px;
    box-shadow: 0 20px 52px var(--shadow);
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: min(760px, 100%);
    margin: 0 auto;
}

.btn,
.mini-btn,
.tool-btn,
.rules-close {
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.24s ease, background 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
}

.btn {
    min-height: 48px;
    padding: 13px 18px;
    position: relative;
    overflow: hidden;
}

.btn::after,
.mini-btn::after,
.tool-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.13) 45%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.68s ease;
}

.btn:hover::after,
.mini-btn:hover::after,
.tool-btn:hover::after {
    transform: translateX(120%);
}

.btn:hover,
.mini-btn:hover,
.tool-btn:hover,
.rules-close:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0,0,0,0.3);
}

.discord { background: var(--discord); }
.store,
.rules-btn { background: var(--red); }
.secondary-btn { background: #1a1a1a; }

.rules-btn {
    font-family: inherit;
}

.focus-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.focus-card {
    border-radius: 6px;
    padding: 18px;
    text-align: left;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 20px 50px rgba(0,0,0,0.24);
    position: relative;
    overflow: hidden;
}

.focus-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--red), transparent);
    animation: lineScan 4.6s ease-in-out infinite;
}

@keyframes lineScan {
    0%, 100% { transform: translateX(-40%); opacity: 0.4; }
    50% { transform: translateX(40%); opacity: 1; }
}

.focus-card i {
    color: var(--red-hot);
    font-size: 1.35rem;
    margin-bottom: 14px;
}

.focus-card h2 {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.focus-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 16px;
    flex: 1;
}

.mini-btn,
.tool-btn {
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    min-height: 38px;
    padding: 10px 13px;
    width: fit-content;
    font-family: inherit;
}

.reveal {
    opacity: 0;
    transform: translateY(34px) scale(0.985);
    filter: blur(6px);
    transition:
        opacity 1.25s cubic-bezier(0.16, 1, 0.3, 1),
        transform 1.25s cubic-bezier(0.16, 1, 0.3, 1),
        filter 1.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0ms);
}

.reveal.is-visible,
.no-js .reveal {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0,0,0,0.78);
}

.rules-overlay.is-open {
    display: flex;
    animation: overlayIn 0.32s ease both;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rules-screen {
    width: min(1060px, 100%);
    height: min(780px, 92vh);
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.65);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(30px) scale(0.97);
    animation: screenRise 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes screenRise {
    to { transform: translateY(0) scale(1); }
}

.rules-screen-top,
.rules-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: #0f0f0f;
    border-bottom: 1px solid var(--border-soft);
}

.rules-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
    background: #111;
}

.rules-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.rules-brand img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #202020;
}

.rules-brand strong,
.rules-brand span {
    display: block;
}

.rules-brand span {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

.rules-close {
    width: 42px;
    height: 42px;
    background: #1a1a1a;
    font-size: 1rem;
}

.rules-content {
    overflow: auto;
    padding: clamp(20px, 4vw, 40px);
    line-height: 1.75;
    scrollbar-color: var(--red) #111;
}

.rules-status {
    color: var(--text-muted);
    text-align: center;
    padding: 30px 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: #fff;
    line-height: 1.25;
    margin: 28px 0 12px;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
    margin-top: 0;
}

.markdown-body h1 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 14px;
}

.markdown-body h2 {
    font-size: 1.45rem;
    color: #f2f2f2;
}

.markdown-body h3 {
    font-size: 1.15rem;
}

.markdown-body p { margin: 0 0 14px; }

.markdown-body a {
    color: #ff4b4b;
    text-decoration: none;
    border-bottom: 1px solid rgba(211,13,13,0.45);
}

.markdown-body a:hover { border-bottom-color: #ff4b4b; }

.markdown-body ul,
.markdown-body ol { margin: 0 0 16px 22px; }
.markdown-body li { margin-bottom: 8px; }
.markdown-body strong { color: #fff; }

.markdown-body blockquote {
    margin: 18px 0;
    padding: 14px 16px;
    border-left: 4px solid var(--red);
    background: #151515;
    color: #d7d7d7;
}

.markdown-body code {
    background: #181818;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    padding: 2px 6px;
    color: #fff;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.92em;
}

.markdown-body pre {
    overflow-x: auto;
    background: #0d0d0d;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 14px;
    margin: 18px 0;
}

.markdown-body pre code {
    background: transparent;
    border: 0;
    padding: 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 6px;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 12px;
    text-align: left;
}

.markdown-body th {
    background: rgba(211,13,13,0.28);
    color: #fff;
}

.markdown-body tr:nth-child(even) td { background: #131313; }
.markdown-body hr { border: 0; border-top: 1px solid var(--border-soft); margin: 28px 0; }

@media (max-width: 820px) {
    body.home-page {
        align-items: flex-start;
        padding-top: 28px;
    }

    .button-grid,
    .focus-grid {
        grid-template-columns: 1fr;
    }

    .focus-card {
        min-height: auto;
        text-align: center;
        align-items: center;
    }
}

@media (max-width: 560px) {
    .logo {
        width: 116px;
        height: 116px;
    }

    .rules-overlay {
        padding: 10px;
    }

    .rules-screen {
        height: 94vh;
    }

    .rules-screen-top {
        align-items: flex-start;
    }

    .tool-btn,
    .mini-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
        filter: none;
    }
}
