:root {
    /* This block used to be a private, light-only copy of the ENTIRE token set:
       it pinned the palette, borders and shadows to literal light values (so this
       page could not follow the theme toggle) and shipped a second type scale
       that disagreed with the canonical one (--font-size-xs 0.75rem vs 0.70rem,
       --font-size-sm 0.875rem vs 0.80rem), which is why Help's body copy did not
       match any other view. All of those names already resolve to canonical
       tokens via the alias block in tokens.css, so the shadows are gone.

       What is genuinely local to this view is the gradient set, which nothing
       else uses — those stay, now expressed in shared tokens so they theme too. */
    --primary-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-accent) 100%);
    --secondary-gradient: linear-gradient(135deg, var(--accent-color) 0%, var(--text-accent) 100%);
    --accent-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    --success-gradient: linear-gradient(135deg, var(--accent-color) 0%, var(--text-accent) 100%);
    --hero-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 70%, var(--secondary-color) 100%);
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-color);
    overflow-x: hidden;
}

/* Help header. This was a full-bleed gradient hero with a grid-pattern overlay and
   a 30px white h1 — the only page title in the app that was not the shared
   .view-title, and the last remaining gradient hero. It is a normal page header
   now; the search box below is what actually made the block worth having. */
.help-hero {
    margin-bottom: var(--space-6);
}

/* Gained a border: it used to float on the gradient hero on nothing but a shadow,
   which reads as an unbounded box now the ground behind it is flat. */
.help-search-wrap {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
}

.help-search-wrap i {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.help-search {
    flex: 1;
    width: 100%;
    padding: var(--spacing-md) 0;
    border: none;
    font-size: var(--font-size-sm);
    font-family: inherit;
    outline: none;
    background: transparent;
}

/* Topic grid */
/* This block used to be pulled up by -28px so it straddled the gradient hero's
   extra bottom padding, and carried its own 1200px column + 32px side padding
   nested inside the page column. With the hero gone that negative margin lifted
   the label on top of the search box, and the nested column left the cards
   inset from the page header. Geometry comes from .app-page now. */
.topic-grid-wrap {
    padding-bottom: var(--spacing-lg);
}

.topic-grid-label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    /* Was rgba(255,255,255,0.85) — white, for the gradient behind it. On the flat
       page ground that is invisible in light mode. */
    color: var(--muted);
    margin-bottom: var(--spacing-md);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.help-topic-card {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    text-decoration: none;
    display: block;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, transform 0.15s;
}

.help-topic-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

.help-topic-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-sm);
    color: white;
    font-size: 16px;
}

.help-topic-card-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    margin-bottom: 2px;
}

.help-topic-card-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .topic-grid { grid-template-columns: 1fr; }
}

/* FAQ */
.help-faq {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.help-faq details {
    border-top: 1px solid var(--border-color);
}

.help-faq details:first-child {
    border-top: none;
}

.help-faq summary {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

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

.help-faq summary .collapsible-icon {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    transition: transform 0.2s;
}

.help-faq details[open] summary .collapsible-icon {
    transform: rotate(180deg);
}

.help-faq-answer {
    padding: 0 var(--spacing-lg) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-faq-answer code {
    background: var(--background-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-color);
}

/* Contact card */
.help-contact-card {
    margin-top: var(--spacing-lg);
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.help-contact-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.help-contact-text { flex: 1; }
.help-contact-title { font-size: var(--font-size-base); font-weight: 700; color: var(--text-primary); }
.help-contact-desc { font-size: var(--font-size-sm); color: var(--text-secondary); }

.help-contact-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.15s;
}

.help-contact-btn:hover { opacity: 0.9; text-decoration: none; }

@media (max-width: 480px) {
    .help-contact-card { flex-wrap: wrap; }
    .help-contact-btn { width: 100%; justify-content: center; }
}

/* Main Content. Was a second 1200px column with 32px side padding nested inside
   the page column, which inset everything below the topic grid relative to the
   page header. Vertical rhythm only now. */
.main-content {
    padding: var(--spacing-3xl) 0;
}

.section {
    margin-bottom: var(--spacing-3xl);
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.section-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--secondary-gradient);
    border-radius: 2px;
}

.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Command Cards */
.command-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

/* Steps */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
}

.step-badge {
    min-width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--font-size-lg);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.step-content {
    padding-top: 10px;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    line-height: 1.6;
}

.command-card {
    background: var(--background-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.command-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.command-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.command-code {
    font-family: 'Monaco', 'Menlo', monospace;
    background: var(--background-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.command-type {
    background: var(--accent-gradient);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.command-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.command-example {
    background: var(--background-secondary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--accent-color);
}

.command-example-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.command-example-code {
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--accent-color);
    font-size: var(--font-size-sm);
}

/* Collapsible Sections */
.collapsible-section {
    background: var(--background-primary);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.collapsible-header {
    background: var(--primary-gradient);
    padding: var(--spacing-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    color: white;
}

.collapsible-header:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.collapsible-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.collapsible-icon {
    transition: transform 0.3s ease;
    color: var(--secondary-color);
}

.collapsible-header.active .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.collapsible-content.active {
    max-height: 8000px;
}

.collapsible-body {
    padding: var(--spacing-xl);
}

/* Game Cards */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.game-card {
    background: var(--background-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.game-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.game-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.game-title i {
    color: var(--accent-color);
}

.game-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Table Styles */
.command-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-lg);
    background: var(--background-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.command-table th,
.command-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.command-table th {
    background: var(--background-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.command-table tr:hover {
    background: var(--background-secondary);
}

.command-table code {
    background: var(--background-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

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

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .command-grid,
    .game-grid {
        grid-template-columns: 1fr;
    }

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

    .main-content {
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .section-title {
        font-size: var(--font-size-2xl);
    }

    .help-hero h1 {
        font-size: var(--font-size-2xl);
    }
}

/* A private @media (prefers-color-scheme: dark) block used to live here. It was the
   only dark-mode system in the app that keyed off the OS rather than the app's own
   data-theme toggle, so a dark-OS user got a half-dark Help page while the rest of
   the app stayed light — and the toggle could not turn it off. tokens.css handles
   dark for this page now, like every other view. */
