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

body {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.brand-icon {
    display: inline-block;
    font-size: 1.1rem;
    margin-right: 0.35rem;
    transition: color 0.3s ease, filter 0.3s ease;
    cursor: help;
    vertical-align: middle;
}

.brand-icon.api-checking {
    color: #5a8cb8;
    animation: pulse-icon 1.5s ease-in-out infinite;
}

.brand-icon.api-online {
    color: #00ff88;
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.5));
}

.brand-icon.api-offline {
    color: #ff4466;
    filter: drop-shadow(0 0 4px rgba(255, 68, 102, 0.5));
}

@keyframes pulse-icon {
    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0 0.5rem;
    border-bottom: 1px solid #1d2938;
}

.site-brand {
    color: #9ec3e0;
    text-decoration: none;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.site-nav-link,
.nav-link {
    text-decoration: none;
    color: #cbe4ff;
    border: 1px solid #38506d;
    border-radius: 4px;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.site-nav-link:hover,
.nav-link:hover {
    border-color: #5f8bb6;
    color: #e8f3ff;
}

.nav-link.active {
    border-color: #7fd2ff;
    color: #d9f0ff;
    background: rgba(127, 210, 255, 0.13);
}

.content-view {
    display: none;
}

.content-view.active {
    display: block;
}

.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 3rem;
    color: #00ff88;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.hero .subtitle {
    font-size: 1.25rem;
    color: #888;
    margin-bottom: 2rem;
}

.grid-section {
    text-align: center;
    padding: 2rem 0;
}

.grid-container {
    position: relative;
    display: inline-block;
    border: 2px solid #333;
    background: #0d1117;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

#botboard-canvas {
    display: block;
    width: min(82vw, 760px);
    height: min(82vw, 760px);
    max-height: 78vh;
    image-rendering: pixelated;
    cursor: grab;
    border: 1px solid #273142;
    border-radius: 4px;
    background: #0c1016;
    touch-action: none;
}

#botboard-canvas.dragging {
    cursor: grabbing;
}

.grid-viewport-hint {
    margin-top: 0.55rem;
    color: #8ca6bf;
    font-size: 0.8rem;
    line-height: 1.3;
}

.ring-progress-panel {
    width: min(760px, 100%);
    margin: 1rem auto 0;
    padding: 0.9rem 1rem;
    text-align: left;
    border: 1px solid #29435a;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(12, 18, 28, 0.96), rgba(9, 14, 20, 0.96));
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.ring-progress-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ring-progress-kicker {
    color: #8fb0c9;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ring-progress-badge {
    border: 1px solid #35516a;
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    color: #d9f0ff;
    font-size: 0.74rem;
    font-weight: 700;
    background: rgba(37, 55, 72, 0.6);
}

.ring-progress-copy {
    margin-top: 0.65rem;
    color: #d8e7f6;
    font-size: 0.88rem;
    line-height: 1.45;
}

.ring-progress-bar {
    margin-top: 0.75rem;
    height: 12px;
    overflow: hidden;
    border: 1px solid #213649;
    border-radius: 999px;
    background: #0b1219;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.ring-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00ff88, #7fd2ff);
    transition: width 0.25s ease;
}

.ring-progress-panel.is-disabled .ring-progress-fill {
    width: 100%;
    background: linear-gradient(90deg, #4dd7a0, #8fd8ff);
}

.ring-progress-panel.is-unavailable .ring-progress-fill {
    background: linear-gradient(90deg, #496073, #667f92);
}

.ring-progress-panel.is-loading .ring-progress-fill {
    background: linear-gradient(90deg, #456078, #7a95ab);
}

.grid-feedback {
    min-height: 1.4rem;
    width: min(760px, 100%);
    margin: 0.7rem auto 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #91aac3;
    transition: color 0.2s ease;
}

.grid-feedback.active {
    padding: 0.65rem 0.8rem;
    border: 1px solid #2c4258;
    border-radius: 6px;
    background: rgba(10, 14, 20, 0.9);
}

.grid-feedback.info {
    color: #9fd7ff;
    border-color: #365573;
    background: rgba(9, 20, 31, 0.9);
}

.grid-feedback.locked,
.grid-feedback.warn {
    color: #ffd58b;
    border-color: #6a512a;
    background: rgba(33, 24, 9, 0.92);
}

.grid-feedback.error {
    color: #ff9aa8;
    border-color: #6a3240;
    background: rgba(35, 11, 16, 0.92);
}

.chunk-loading-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(10, 15, 24, 0.92);
    border: 1px solid #365273;
    color: #b7dbff;
    font-size: 0.75rem;
    padding: 0.32rem 0.55rem;
    border-radius: 4px;
    display: none;
    z-index: 30;
    pointer-events: none;
}

.chunk-loading-indicator.active {
    display: block;
}

.minimap-shell {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 168px;
    padding: 6px;
    border: 1px solid #2b3f58;
    border-radius: 6px;
    background: rgba(7, 10, 15, 0.94);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
    z-index: 20;
}

.minimap-label {
    color: #9bb8d2;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

#minimap-canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    border: 1px solid #1f2d40;
    border-radius: 3px;
    image-rendering: pixelated;
    cursor: pointer;
    touch-action: none;
}

.grid-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    color: #00ff88;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.how-it-works {
    padding: 4rem 0;
}

.how-it-works h2 {
    text-align: center;
    font-size: 2rem;
    color: #00ff88;
    margin-bottom: 3rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.step {
    background: #111;
    border: 1px solid #333;
    padding: 2rem;
    text-align: center;
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    background: #00ff88;
    color: #0a0a0a;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.step h3 {
    color: #fff;
    margin-bottom: 0.5rem;
}

.step p {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.5;
}

.step code {
    color: #9fd7ff;
}

footer {
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid #222;
    margin-top: 2rem;
}

footer p {
    color: #666;
    margin-bottom: 1rem;
}

.bot-badge {
    display: inline-block;
    background: #1a1a2e;
    color: #00ff88;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid #00ff88;
}

.legal-links {
    margin-top: 0.9rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.legal-links a {
    color: #8ec6ff;
    text-decoration: none;
}

.legal-links a:hover {
    text-decoration: underline;
}

.tos-section {
    margin-top: 1.8rem;
    border-top: 1px solid #1d2330;
    padding-top: 1.2rem;
    text-align: left;
}

.tos-section h3 {
    color: #7fd2ff;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

.tos-section p {
    color: #8ea4c0;
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 0.45rem;
}

.tooltip {
    position: absolute;
    display: none;
    z-index: 1000;
}

.tooltip.is-visible {
    display: block;
}

.tile-detail {
    position: absolute;
    background: #131a24;
    border: 1px solid #2a3a4e;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    max-width: 260px;
    z-index: 1000;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tile-detail-owner {
    font-weight: 700;
    color: #e0e8f0;
    margin-bottom: 0.25rem;
    overflow-wrap: anywhere;
}

.tile-detail-meta {
    font-size: 0.8rem;
    color: #8ca6bf;
    line-height: 1.5;
}

.tile-detail-meta > div + div {
    margin-top: 0.15rem;
}

.tile-detail-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tile-detail-link {
    color: #00ff88;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.tile-detail-link:hover {
    text-decoration: underline;
}

.tile-detail-badge {
    display: inline-block;
    background: #ffd700;
    color: #0a0f18;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.3rem;
}

.tile-detail-available {
    color: #00ff88;
    font-weight: 600;
}

.competition-view {
    margin-top: 1.5rem;
    padding: 1.3rem 1.1rem;
    border: 1px solid #2a3e56;
    border-radius: 10px;
    background: #0f151e;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

.competition-view h2 {
    margin-bottom: 0.75rem;
    color: #7fd2ff;
    font-size: 1.35rem;
}

.competition-view h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.6rem;
    color: #9ec3e0;
    font-size: 1rem;
}

.competition-panel {
    border: 1px solid #26374a;
    border-radius: 8px;
    background: #0a1018;
    padding: 0.85rem;
}

.loading-text {
    color: #8ca6bf;
    font-size: 0.85rem;
}

.leaderboard-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid #2c425d;
    border-radius: 6px;
    background: #111a26;
}

.leaderboard-entry .rank {
    color: #ffd166;
    font-weight: 700;
}

.leaderboard-entry .name {
    color: #d9ebff;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.leaderboard-entry .score {
    color: #00ff88;
    font-weight: 700;
}

.season-info {
    color: #c8ddf2;
    line-height: 1.45;
    font-size: 0.9rem;
}

.season-info p {
    margin-bottom: 0.35rem;
}

.season-info p:last-child {
    margin-bottom: 0;
}

.hall-of-fame-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #b8d3ef;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.88rem;
}

:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.site-nav-link:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 0.5rem 1rem;
    background: #00ff88;
    color: #0a0f18;
    font-weight: 700;
    z-index: 10000;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

@media (max-width: 700px) {
    .container {
        padding: 1.1rem;
    }

    .site-header {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .leaderboard-entry {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .grid-container {
        width: 100%;
        max-width: 100%;
        padding: 8px;
    }

    #botboard-canvas {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .minimap-shell {
        width: 122px;
        right: 10px;
        bottom: 10px;
        padding: 5px;
    }

    .grid-viewport-hint {
        font-size: 0.74rem;
    }

    .ring-progress-panel {
        padding: 0.8rem 0.85rem;
    }

    .ring-progress-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .grid-stats {
        gap: 1.5rem;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-icon.api-checking {
        animation: none;
        opacity: 0.7;
    }

    .ring-progress-fill {
        transition: none;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* BattleGrid teaser banner */
.teaser-banner {
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin: 2rem 0;
    border: 1px solid #2a3a4e;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 68, 102, 0.06) 0%, rgba(255, 136, 0, 0.06) 100%);
    position: relative;
    overflow: hidden;
}

.teaser-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff4466, #ff8800, #ff4466);
    opacity: 0.7;
}

.teaser-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.teaser-banner h2 {
    font-size: 1.3rem;
    color: #ff8800;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.teaser-banner p {
    color: #9ec3e0;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.teaser-tagline {
    margin-top: 0.75rem !important;
    color: #ff6644 !important;
    font-weight: 700;
    font-style: italic;
    font-size: 0.95rem;
}
