/* ==========================================================================
   SEOFAI AI Glossary v1.3 — Frontend Styles
   Modern design, load-more, quiz game, N/A filtering
   ========================================================================== */

:root {
    --sg-primary: #2563eb;
    --sg-primary-dark: #1d4ed8;
    --sg-primary-light: #eff6ff;
    --sg-primary-rgb: 37, 99, 235;
    --sg-accent: #06b6d4;
    --sg-accent-light: #ecfeff;
    --sg-text: #0f172a;
    --sg-text-muted: #64748b;
    --sg-bg: #f8fafc;
    --sg-white: #ffffff;
    --sg-border: #e2e8f0;
    --sg-radius: 16px;
    --sg-radius-sm: 10px;
    --sg-radius-xs: 6px;
    --sg-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --sg-shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --sg-shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
    --sg-shadow-xl: 0 20px 48px rgba(0,0,0,0.14);
    --sg-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sg-max-width: 1240px;
    --sg-hero-bg: #0f172a;
    --sg-hero-surface: #1e293b;
}

/* Reset */
.sg-glossary-wrap *,
.sg-single-wrap * {
    box-sizing: border-box;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.sg-hero {
    background: var(--sg-hero-bg);
    padding: 56px 24px 64px;
    text-align: center;
    color: var(--sg-white);
    position: relative;
}

.sg-hero-inner {
    max-width: var(--sg-max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.sg-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.7);
}

.sg-hero-game-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 10px 24px;
    background: var(--sg-primary);
    color: var(--sg-white);
    border: 1px solid transparent;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--sg-transition);
    box-shadow: 0 4px 16px rgba(var(--sg-primary-rgb), 0.3);
}
.sg-hero-actions .sg-hero-game-link { margin-top: 0; }

.sg-hero-game-link:hover {
    background: var(--sg-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(var(--sg-primary-rgb), 0.4);
    color: var(--sg-white);
}

.sg-hero-title {
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -1px;
    color: var(--sg-white);
    line-height: 1.1;
}

.sg-hero-subtitle {
    font-size: 17px;
    color: rgba(255,255,255,0.75);
    margin: 0 0 32px;
    font-weight: 400;
    line-height: 1.6;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.sg-hero-subtitle strong {
    font-weight: 700;
    color: #60a5fa;
}

/* Hero Stats */
.sg-hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 28px;
}

.sg-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sg-hero-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--sg-white);
    line-height: 1.1;
}

.sg-hero-stat-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* ==========================================================================
   SEARCH
   ========================================================================== */

.sg-search-wrap {
    max-width: 580px;
    margin: 0 auto;
}

.sg-search-box {
    position: relative;
}

.sg-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sg-text-muted);
    pointer-events: none;
    z-index: 2;
}

.sg-search-input {
    width: 100%;
    padding: 16px 60px 16px 50px;
    font-size: 16px;
    border: 2px solid transparent;
    border-radius: 50px;
    background: var(--sg-white);
    color: var(--sg-text);
    outline: none;
    transition: border-color var(--sg-transition), box-shadow var(--sg-transition);
    box-shadow: var(--sg-shadow-lg);
}

.sg-search-input:focus {
    border-color: var(--sg-primary);
    box-shadow: var(--sg-shadow-xl), 0 0 0 4px rgba(var(--sg-primary-rgb), 0.15);
}

.sg-search-input::placeholder {
    color: #94a3b8;
}

.sg-search-kbd {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sg-bg);
    border: 1px solid var(--sg-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sg-text-muted);
    font-family: inherit;
    pointer-events: none;
}

.sg-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--sg-white);
    border-radius: var(--sg-radius);
    box-shadow: var(--sg-shadow-xl);
    z-index: 100;
    display: none;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--sg-border);
}

.sg-search-results.sg-active {
    display: block;
    animation: sgFadeIn 0.2s ease;
}

@keyframes sgFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.sg-search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--sg-text);
    border-bottom: 1px solid var(--sg-border);
    transition: background var(--sg-transition);
}

.sg-search-result-item:last-child {
    border-bottom: none;
}

.sg-search-result-item:hover,
.sg-search-result-item.sg-hover {
    background: var(--sg-primary-light);
}

.sg-search-result-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--sg-text);
}

.sg-search-result-abbr {
    display: inline-block;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 6px;
}

.sg-search-result-def {
    font-size: 13px;
    color: var(--sg-text-muted);
    margin-top: 3px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sg-search-no-results {
    padding: 24px 18px;
    text-align: center;
    color: var(--sg-text-muted);
    font-size: 14px;
}

/* ==========================================================================
   CATEGORY FILTER
   ========================================================================== */

.sg-cat-section {
    background: var(--sg-bg);
    border-bottom: 1px solid var(--sg-border);
}

.sg-cat-section-inner {
    max-width: var(--sg-max-width);
    margin: 0 auto;
    padding: 20px 24px;
}

.sg-cat-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.sg-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sg-text-muted);
    cursor: pointer;
    transition: all var(--sg-transition);
    white-space: nowrap;
}

.sg-cat-pill i {
    font-size: 12px;
    opacity: 0.65;
}

.sg-cat-pill:hover {
    border-color: var(--sg-primary);
    color: var(--sg-primary);
    background: var(--sg-primary-light);
    transform: translateY(-1px);
    box-shadow: var(--sg-shadow);
}

.sg-cat-pill.sg-cat-active {
    background: var(--sg-primary);
    color: var(--sg-white);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.35);
}

.sg-cat-pill.sg-cat-active i {
    opacity: 1;
}

.sg-cat-count {
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,0.06);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sg-cat-active .sg-cat-count {
    background: rgba(255,255,255,0.25);
}

/* Load More Categories */
.sg-cat-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 12px auto 0;
    padding: 8px 20px;
    background: transparent;
    border: 1px dashed var(--sg-primary);
    border-radius: 50px;
    color: var(--sg-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sg-transition);
}

.sg-cat-load-more:hover {
    background: var(--sg-primary-light);
    border-style: solid;
}

.sg-cat-load-remaining {
    font-weight: 400;
    opacity: 0.7;
}

/* Hidden state for filtered cards */
.sg-term-card.sg-hidden {
    display: none !important;
}

.sg-letter-section.sg-section-hidden {
    display: none !important;
}

/* ==========================================================================
   A-Z NAVIGATION
   ========================================================================== */

.sg-az-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--sg-border);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.sg-az-letter {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: 700;
    color: var(--sg-primary);
    background: var(--sg-primary-light);
    border-radius: var(--sg-radius-sm);
    text-decoration: none;
    transition: all var(--sg-transition);
    position: relative;
    padding: 2px 6px;
}

.sg-az-letter:hover {
    background: var(--sg-primary);
    color: var(--sg-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.3);
}

.sg-az-letter.sg-az-active {
    background: var(--sg-primary);
    color: var(--sg-white);
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.3);
}

.sg-az-letter.sg-az-disabled {
    background: #f1f5f9;
    color: #cbd5e1;
    pointer-events: none;
}

.sg-az-count {
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    opacity: 0.7;
}

/* ==========================================================================
   TERMS CONTAINER
   ========================================================================== */

.sg-terms-container {
    max-width: var(--sg-max-width);
    margin: 0 auto;
    padding: 36px 24px 64px;
}

/* ==========================================================================
   LETTER SECTIONS
   ========================================================================== */

.sg-letter-section {
    margin-bottom: 48px;
    scroll-margin-top: 70px;
}

.sg-letter-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--sg-border);
}

.sg-letter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--sg-primary);
    color: var(--sg-white);
    font-size: 24px;
    font-weight: 800;
    border-radius: var(--sg-radius-sm);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.25);
}

.sg-letter-count {
    font-size: 14px;
    color: var(--sg-text-muted);
    font-weight: 500;
}

/* ==========================================================================
   TERM CARDS
   ========================================================================== */

.sg-terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

.sg-term-card {
    display: flex;
    flex-direction: column;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    padding: 0;
    text-decoration: none;
    color: var(--sg-text);
    transition: all var(--sg-transition);
    position: relative;
    overflow: hidden;
}

.sg-term-card-inner {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sg-term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sg-primary);
    opacity: 0;
    transition: opacity var(--sg-transition);
}

.sg-term-card:hover {
    border-color: rgba(var(--sg-primary-rgb), 0.3);
    box-shadow: var(--sg-shadow-lg);
    transform: translateY(-3px);
}

.sg-term-card:hover::before {
    opacity: 1;
}

.sg-term-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sg-term-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sg-text);
    margin: 0;
    line-height: 1.3;
}

.sg-term-abbr {
    display: inline-block;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sg-term-def {
    font-size: 14px;
    color: var(--sg-text-muted);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.sg-term-arrow {
    position: absolute;
    top: 18px;
    right: 18px;
    color: var(--sg-primary);
    opacity: 0;
    transition: opacity var(--sg-transition), transform var(--sg-transition);
}

.sg-term-card:hover .sg-term-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* Load More Terms Button */
.sg-letter-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px auto 0;
    padding: 10px 24px;
    background: var(--sg-white);
    border: 1px dashed rgba(var(--sg-primary-rgb), 0.4);
    border-radius: 50px;
    color: var(--sg-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sg-transition);
}

.sg-letter-load-more:hover {
    background: var(--sg-primary-light);
    border-style: solid;
    border-color: var(--sg-primary);
    transform: translateY(-1px);
    box-shadow: var(--sg-shadow);
}

.sg-load-remaining {
    font-weight: 400;
    opacity: 0.65;
    font-size: 13px;
}

/* ==========================================================================
   QUIZ GAME
   ========================================================================== */

.sg-quiz-section {
    background: var(--sg-bg);
    padding: 56px 24px;
    border-top: 1px solid var(--sg-border);
}

.sg-quiz-inner {
    max-width: 680px;
    margin: 0 auto;
    background: var(--sg-white);
    border-radius: var(--sg-radius);
    box-shadow: var(--sg-shadow-lg);
    overflow: hidden;
    border: 1px solid var(--sg-border);
}

.sg-quiz-header {
    background: var(--sg-hero-bg);
    padding: 32px 32px 28px;
    text-align: center;
    color: var(--sg-white);
}

.sg-quiz-icon {
    margin-bottom: 12px;
    opacity: 0.9;
}

.sg-quiz-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--sg-white);
}

.sg-quiz-desc {
    font-size: 15px;
    opacity: 0.85;
    margin: 0;
}

.sg-quiz-body {
    padding: 32px;
}

/* Quiz Start State */
.sg-quiz-start-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.sg-quiz-start-stat {
    text-align: center;
    font-size: 14px;
    color: var(--sg-text-muted);
    font-weight: 500;
}

.sg-quiz-start-stat span {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--sg-primary);
    margin-bottom: 2px;
}

.sg-quiz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--sg-transition);
}

.sg-quiz-btn-start {
    background: var(--sg-primary);
    color: var(--sg-white);
    box-shadow: 0 4px 16px rgba(var(--sg-primary-rgb), 0.35);
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
}

.sg-quiz-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(var(--sg-primary-rgb), 0.45);
}

.sg-quiz-btn-share {
    background: var(--sg-white);
    color: var(--sg-primary);
    border: 2px solid var(--sg-primary);
    gap: 6px;
}

.sg-quiz-btn-share:hover {
    background: var(--sg-primary-light);
}

/* Loading State */
.sg-quiz-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--sg-text-muted);
    font-size: 15px;
}

.sg-quiz-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--sg-border);
    border-top-color: var(--sg-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: sgSpin 0.8s linear infinite;
}

@keyframes sgSpin {
    to { transform: rotate(360deg); }
}

/* Streak Bar */
.sg-quiz-streak-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 10px 20px;
    background: var(--sg-bg);
    border-radius: 50px;
    border: 1px solid var(--sg-border);
}

.sg-quiz-streak-flame {
    display: flex;
    align-items: center;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.sg-quiz-streak-flame.sg-streak-hot {
    color: #f59e0b;
}

.sg-quiz-streak-flame.sg-streak-fire {
    color: #ef4444;
}

.sg-quiz-streak-flame.sg-streak-inferno {
    color: #ef4444;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.5));
}

.sg-quiz-streak-flame.sg-streak-pulse {
    animation: sgFlameGrow 0.4s ease;
}

@keyframes sgFlameGrow {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.sg-quiz-streak-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--sg-primary);
    line-height: 1;
}

.sg-quiz-streak-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sg-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Term Display */
.sg-quiz-term-display {
    text-align: center;
    margin-bottom: 24px;
}

.sg-quiz-term-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sg-quiz-term-name {
    font-size: 26px;
    font-weight: 800;
    color: var(--sg-text);
    line-height: 1.2;
    margin-bottom: 6px;
}

.sg-quiz-term-abbr {
    display: inline-block;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
}

/* Quiz Options */
.sg-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sg-quiz-option {
    display: block;
    width: 100%;
    padding: 14px 18px;
    background: var(--sg-bg);
    border: 2px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--sg-text);
    cursor: pointer;
    transition: all var(--sg-transition);
    text-align: left;
    line-height: 1.5;
}

.sg-quiz-option:hover {
    border-color: var(--sg-primary);
    background: var(--sg-primary-light);
    transform: translateX(4px);
}

.sg-quiz-option.sg-quiz-correct {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 600;
    transform: translateX(4px);
}

.sg-quiz-option.sg-quiz-wrong {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

.sg-quiz-option.sg-quiz-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.sg-quiz-option.sg-quiz-disabled.sg-quiz-correct {
    opacity: 1;
}

/* Game Over Result */
.sg-quiz-result {
    text-align: center;
}

.sg-quiz-result-emoji {
    font-size: 56px;
    margin-bottom: 8px;
    line-height: 1;
}

.sg-quiz-result-score {
    font-size: 42px;
    font-weight: 800;
    color: var(--sg-primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.sg-quiz-result-msg {
    font-size: 16px;
    color: var(--sg-text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.sg-quiz-result-best {
    font-size: 14px;
    color: var(--sg-text-muted);
    margin-bottom: 20px;
}

.sg-quiz-result-best strong {
    color: var(--sg-primary);
    font-weight: 800;
}

/* Learn Link */
.sg-quiz-result-learn {
    margin-bottom: 24px;
}

.sg-quiz-learn-link {
    display: block;
    padding: 14px 18px;
    background: var(--sg-bg);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    text-decoration: none;
    color: var(--sg-text);
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
    transition: all var(--sg-transition);
}

.sg-quiz-learn-link:hover {
    border-color: var(--sg-primary);
    box-shadow: var(--sg-shadow);
}

.sg-quiz-learn-link strong {
    color: var(--sg-primary);
}

.sg-quiz-learn-link span {
    display: block;
    margin-top: 6px;
    color: var(--sg-primary);
    font-weight: 600;
    font-size: 13px;
}

.sg-quiz-result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */

.sg-back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--sg-primary);
    color: var(--sg-white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(var(--sg-primary-rgb), 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--sg-transition);
    z-index: 40;
}

.sg-back-top.sg-visible {
    opacity: 1;
    visibility: visible;
}

.sg-back-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 28px rgba(var(--sg-primary-rgb), 0.5);
}

/* ==========================================================================
   SINGLE TERM PAGE
   ========================================================================== */

.sg-single-wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 36px 24px 72px;
}

/* Breadcrumb */
.sg-breadcrumb {
    font-size: 14px;
    color: var(--sg-text-muted);
    margin-bottom: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sg-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--sg-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--sg-transition);
}

.sg-breadcrumb a:hover {
    color: var(--sg-primary-dark);
}

.sg-breadcrumb-sep {
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
}

.sg-breadcrumb-current {
    color: var(--sg-text);
    font-weight: 600;
}

/* Term Header */
.sg-term-header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--sg-border);
}

.sg-term-header-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.sg-single-letter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--sg-primary);
    color: var(--sg-white);
    font-size: 28px;
    font-weight: 800;
    border-radius: var(--sg-radius-sm);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.25);
}

.sg-term-header-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.sg-single-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--sg-text);
    margin: 0;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.sg-single-abbr {
    display: inline-flex;
    align-self: flex-start;
    background: var(--sg-primary);
    color: var(--sg-white);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 50px;
    letter-spacing: 0.5px;
}

.sg-single-short-def {
    font-size: 18px;
    color: var(--sg-text-muted);
    line-height: 1.6;
    margin: 0 0 14px;
}

.sg-single-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sg-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 50px;
    text-decoration: none;
    border: 1px solid rgba(var(--sg-primary-rgb), 0.15);
    transition: all var(--sg-transition);
}

.sg-cat-badge i {
    font-size: 11px;
}

.sg-cat-badge:hover {
    background: var(--sg-primary);
    color: var(--sg-white);
    border-color: var(--sg-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.25);
}

/* Definition Body */
.sg-definition-body {
    font-size: 16.5px;
    line-height: 1.85;
    color: var(--sg-text);
    margin-bottom: 48px;
}

.sg-definition-body h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 36px 0 14px;
    color: var(--sg-text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--sg-border);
}

.sg-definition-body h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 28px 0 10px;
    color: var(--sg-text);
}

.sg-definition-body p {
    margin: 0 0 18px;
}

.sg-definition-body ul,
.sg-definition-body ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.sg-definition-body li {
    margin-bottom: 8px;
}

/* Auto-interlinks */
.sg-definition-body a.sg-interlink {
    color: var(--sg-primary);
    text-decoration: none;
    border-bottom: 1px dashed rgba(var(--sg-primary-rgb), 0.4);
    transition: border-color var(--sg-transition), color var(--sg-transition);
}

.sg-definition-body a.sg-interlink:hover {
    color: var(--sg-primary-dark);
    border-bottom-style: solid;
    border-bottom-color: var(--sg-primary);
}

/* ==========================================================================
   FAQ SECTION
   ========================================================================== */

.sg-faq-section {
    margin-bottom: 48px;
}

.sg-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sg-faq-item {
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    overflow: hidden;
    transition: border-color var(--sg-transition), box-shadow var(--sg-transition);
}

.sg-faq-item[open] {
    border-color: rgba(var(--sg-primary-rgb), 0.3);
    box-shadow: var(--sg-shadow);
}

.sg-faq-question {
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--sg-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--sg-transition), color var(--sg-transition);
}

.sg-faq-question::-webkit-details-marker {
    display: none;
}

.sg-faq-question::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    color: var(--sg-primary);
    flex-shrink: 0;
    transition: transform var(--sg-transition);
}

.sg-faq-item[open] .sg-faq-question::after {
    content: '−';
}

.sg-faq-question:hover {
    background: var(--sg-primary-light);
    color: var(--sg-primary);
}

.sg-faq-answer {
    padding: 0 20px 16px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--sg-text-muted);
}

.sg-faq-answer p {
    margin: 0;
}

/* ==========================================================================
   RELATED TERMS
   ========================================================================== */

.sg-related-section {
    margin-bottom: 48px;
}

.sg-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--sg-text);
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--sg-border);
}

.sg-section-heading svg {
    color: var(--sg-primary);
    flex-shrink: 0;
}

.sg-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

/* ==========================================================================
   PREV / NEXT NAVIGATION
   ========================================================================== */

.sg-term-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    padding-top: 28px;
    border-top: 2px solid var(--sg-border);
}

.sg-nav-link {
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    text-decoration: none;
    color: var(--sg-text);
    transition: all var(--sg-transition);
}

.sg-nav-link:hover {
    border-color: var(--sg-primary);
    box-shadow: var(--sg-shadow-md);
    transform: translateY(-2px);
}

.sg-nav-prev {
    text-align: left;
}

.sg-nav-next {
    text-align: right;
}

.sg-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sg-primary);
    margin-bottom: 4px;
}

.sg-nav-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sg-text);
    line-height: 1.3;
}

.sg-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 50px;
    text-decoration: none;
    transition: all var(--sg-transition);
    white-space: nowrap;
}

.sg-nav-back:hover {
    background: var(--sg-primary);
    color: var(--sg-white);
    box-shadow: 0 4px 12px rgba(var(--sg-primary-rgb), 0.25);
}

/* ==========================================================================
   TAXONOMY ARCHIVE (Category Page)
   ========================================================================== */

.sg-taxonomy-hero {
    background: var(--sg-hero-bg);
    padding: 48px 24px;
    text-align: center;
    color: var(--sg-white);
}

.sg-taxonomy-hero-inner {
    max-width: var(--sg-max-width);
    margin: 0 auto;
}

.sg-taxonomy-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.sg-taxonomy-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--sg-white);
}

.sg-taxonomy-desc {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.sg-taxonomy-grid {
    max-width: var(--sg-max-width);
    margin: 0 auto;
    padding: 36px 24px 64px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

/* ==========================================================================
   GAME PAGE
   ========================================================================== */

.sg-game-wrap {
    background: var(--sg-bg);
}

/* Game Hero */
.sg-game-hero {
    background: var(--sg-hero-bg);
    padding: 36px 24px 48px;
    text-align: center;
    color: var(--sg-white);
}

.sg-game-hero-inner {
    max-width: 680px;
    margin: 0 auto;
}

/* Term Roulette breadcrumb — always white */
.sg-game-hero .sg-breadcrumb-light,
.sg-game-hero .sg-breadcrumb-light a,
.sg-game-hero .sg-breadcrumb-roulette,
.sg-game-hero .sg-breadcrumb-roulette a {
    color: #fff !important;
}
.sg-game-hero .sg-breadcrumb-light .sg-breadcrumb-sep,
.sg-game-hero .sg-breadcrumb-roulette .sg-breadcrumb-sep {
    color: rgba(255,255,255,0.4) !important;
}
.sg-game-hero .sg-breadcrumb-light .sg-breadcrumb-current,
.sg-game-hero .sg-breadcrumb-roulette .sg-breadcrumb-current {
    color: #fff !important;
}
.sg-game-hero .sg-breadcrumb-light {
    justify-content: center;
    margin-bottom: 24px;
}

/* Dark mode breadcrumb — controlled by admin settings via inline CSS */

.sg-game-hero-icon {
    color: var(--sg-primary);
    margin-bottom: 16px;
}

.sg-game-hero-title {
    font-size: 38px;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--sg-white);
    letter-spacing: -0.5px;
}

.sg-game-hero-desc {
    font-size: 16px;
    color: rgba(255,255,255,0.65);
    margin: 0 0 20px;
    line-height: 1.6;
}

.sg-game-hero-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sg-game-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}

/* How to Play */
.sg-game-howto {
    padding: 48px 24px;
    background: var(--sg-white);
    border-bottom: 1px solid var(--sg-border);
}

.sg-game-howto-inner {
    max-width: 800px;
    margin: 0 auto;
}

.sg-game-section-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--sg-text);
    margin: 0 0 28px;
    text-align: center;
}

.sg-game-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.sg-game-step {
    text-align: center;
    padding: 24px 16px;
    background: var(--sg-bg);
    border-radius: var(--sg-radius);
    border: 1px solid var(--sg-border);
}

.sg-game-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--sg-primary);
    color: var(--sg-white);
    font-size: 18px;
    font-weight: 800;
    border-radius: 50%;
    margin-bottom: 14px;
}

.sg-game-step h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--sg-text);
    margin: 0 0 6px;
}

.sg-game-step p {
    font-size: 14px;
    color: var(--sg-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Stats Section */
.sg-game-stats-section {
    padding: 36px 24px;
    background: var(--sg-bg);
    border-bottom: 1px solid var(--sg-border);
}

.sg-game-stats-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.sg-game-stat-card {
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    padding: 20px 16px;
    text-align: center;
    transition: all var(--sg-transition);
}

.sg-game-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sg-shadow-md);
}

.sg-game-stat-icon {
    color: var(--sg-primary);
    margin-bottom: 10px;
}

.sg-game-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--sg-text);
    line-height: 1;
    margin-bottom: 4px;
}

.sg-game-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--sg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Reset Stats Button */
.sg-game-reset-wrap {
    text-align: center;
    margin-top: 16px;
}

.sg-game-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--sg-border);
    color: var(--sg-text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--sg-transition);
}

.sg-game-reset-btn:hover {
    color: #dc2626;
    border-color: #dc2626;
    background: #fef2f2;
}

/* Mode Toggle */
.sg-quiz-mode-toggle {
    display: flex;
    gap: 0;
    background: var(--sg-bg);
    border-radius: 50px;
    padding: 3px;
    margin: 16px auto 20px;
    max-width: 320px;
    border: 1px solid var(--sg-border);
}

.sg-quiz-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 50px;
    background: transparent;
    color: var(--sg-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sg-transition);
    white-space: nowrap;
}

.sg-quiz-mode-btn.active {
    background: var(--sg-primary);
    color: var(--sg-white);
    box-shadow: 0 2px 8px rgba(var(--sg-primary-rgb), 0.3);
}

.sg-quiz-mode-btn:not(.active):hover {
    color: var(--sg-text);
}

/* Score Bar (Your Streak | World Record) */
.sg-quiz-score-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: 14px;
    padding: 12px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.sg-quiz-score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}
.sg-quiz-score-item svg { flex-shrink: 0; color: var(--sg-text-muted); }
.sg-quiz-streak-num,
.sg-quiz-highscore-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--sg-text);
    line-height: 1;
}
.sg-quiz-score-label {
    font-size: 11px;
    color: var(--sg-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sg-quiz-score-divider {
    width: 1px;
    height: 36px;
    background: var(--sg-border);
    margin: 0 16px;
    flex-shrink: 0;
}
.sg-quiz-highscore-item svg { color: #f59e0b; }
.sg-quiz-highscore-num { color: #f59e0b; }

/* Game Controls (Hint + Home centered) */
.sg-quiz-game-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}
.sg-quiz-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: 50px;
    color: var(--sg-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sg-quiz-ctrl-btn svg { flex-shrink: 0; }
.sg-quiz-ctrl-btn:hover {
    border-color: var(--sg-primary);
    color: var(--sg-primary);
    background: var(--sg-primary-light);
}
.sg-quiz-hint-btn-nice:not(.sg-powerup-used):hover {
    background: var(--sg-primary);
    color: #fff;
    border-color: var(--sg-primary);
}
.sg-ctrl-count {
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    padding: 1px 7px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
}
.sg-powerup-used {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
.sg-quiz-home-btn:hover {
    border-color: var(--sg-text-muted);
    color: var(--sg-text);
    background: var(--sg-bg);
}
.sg-quiz-hint-removed {
    text-decoration: line-through;
}
@media (max-width: 480px) {
    .sg-quiz-score-bar { padding: 10px 12px; gap: 0; }
    .sg-quiz-streak-num, .sg-quiz-highscore-num { font-size: 20px; }
    .sg-quiz-score-label { font-size: 10px; }
    .sg-quiz-score-divider { margin: 0 10px; }
    .sg-quiz-game-controls { gap: 8px; }
    .sg-quiz-ctrl-btn { padding: 6px 14px; font-size: 12px; }
}

/* High Score Celebration */
.sg-quiz-celebration {
    text-align: center;
    padding: 40px 20px;
    animation: sg-celebrate-in 0.6s ease;
}
@keyframes sg-celebrate-in {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
.sg-celebration-emoji {
    font-size: 64px;
    margin-bottom: 12px;
    animation: sg-celebrate-bounce 0.8s ease infinite alternate;
}
@keyframes sg-celebrate-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}
.sg-celebration-title {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #f59e0b, #ef4444, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}
.sg-celebration-score {
    font-size: 36px;
    font-weight: 800;
    color: var(--sg-primary);
    margin-bottom: 8px;
}
.sg-celebration-msg {
    font-size: 14px;
    color: var(--sg-text-muted);
}

/* Game Arena */
.sg-game-arena {
    padding: 48px 24px;
    background: var(--sg-bg);
}

.sg-game-arena-inner {
    max-width: 640px;
    margin: 0 auto;
}

.sg-game-arena .sg-quiz-inner {
    border-radius: var(--sg-radius);
    box-shadow: var(--sg-shadow-xl);
    border: 1px solid var(--sg-border);
    background: var(--sg-white);
    overflow: hidden;
}

.sg-game-arena .sg-quiz-body {
    padding: 36px 32px;
}

.sg-quiz-start-visual {
    color: var(--sg-primary);
    margin-bottom: 16px;
    opacity: 0.8;
}

.sg-quiz-start-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--sg-text);
    margin: 0 0 20px;
    text-align: center;
}

/* Challenge Banner */
.sg-game-challenge {
    padding: 40px 24px;
    background: var(--sg-hero-bg);
}

.sg-game-challenge-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.sg-game-challenge-text h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--sg-white);
    margin: 0 0 6px;
}

.sg-game-challenge-text p {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin: 0;
}

.sg-game-challenge-btn {
    flex-shrink: 0;
    border-color: rgba(255,255,255,0.2);
    color: var(--sg-white);
    background: transparent;
}

.sg-game-challenge-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
}

/* Back to Glossary */
.sg-game-back {
    text-align: center;
    padding: 36px 24px 56px;
    background: var(--sg-bg);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .sg-hero {
        padding: 36px 16px 44px;
    }

    .sg-hero-title {
        font-size: 30px;
    }

    .sg-hero-subtitle {
        font-size: 15px;
        margin-bottom: 24px;
    }

    .sg-hero-stats {
        gap: 20px;
    }

    .sg-hero-stat-num {
        font-size: 22px;
    }

    .sg-search-input {
        font-size: 15px;
        padding: 14px 14px 14px 44px;
    }

    .sg-search-kbd {
        display: none;
    }

    .sg-cat-section-inner {
        padding: 14px 16px;
    }

    .sg-cat-pill {
        padding: 6px 12px;
        font-size: 12px;
    }

    .sg-az-nav {
        padding: 8px 12px;
        gap: 3px;
    }

    .sg-az-letter {
        min-width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .sg-az-count {
        display: none;
    }

    .sg-terms-container {
        padding: 20px 16px 48px;
    }

    .sg-terms-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sg-letter-section {
        margin-bottom: 32px;
    }

    .sg-term-card-inner {
        padding: 14px 16px;
    }

    .sg-term-arrow {
        opacity: 1;
    }

    /* Single page */
    .sg-single-wrap {
        padding: 20px 16px 48px;
    }

    .sg-single-letter-badge {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .sg-single-title {
        font-size: 26px;
    }

    .sg-single-short-def {
        font-size: 16px;
    }

    .sg-definition-body {
        font-size: 15px;
    }

    .sg-related-grid {
        grid-template-columns: 1fr;
    }

    .sg-term-nav {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sg-nav-back {
        order: -1;
        justify-content: center;
    }

    .sg-nav-next {
        text-align: left;
    }

    /* Quiz */
    .sg-quiz-section {
        padding: 32px 16px;
    }

    .sg-quiz-header {
        padding: 24px 20px 20px;
    }

    .sg-quiz-title {
        font-size: 20px;
    }

    .sg-quiz-body {
        padding: 24px 20px;
    }

    .sg-quiz-start-stats {
        gap: 16px;
    }

    .sg-quiz-result-score {
        font-size: 36px;
    }

    /* Game page — mobile reorder: game first */
    .sg-game-wrap {
        display: flex;
        flex-direction: column;
    }

    .sg-game-hero { order: 1; padding: 28px 16px 24px; }
    .sg-game-arena { order: 2; padding: 24px 16px; }
    .sg-game-howto { order: 3; }
    .sg-game-stats-section { order: 4; }
    .sg-game-challenge { order: 5; }
    .sg-game-back { order: 6; }

    .sg-game-hero-title {
        font-size: 28px;
    }

    .sg-game-steps {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sg-game-stats-inner {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .sg-game-arena .sg-quiz-body {
        padding: 24px 18px;
    }

    .sg-game-challenge-inner {
        flex-direction: column;
        text-align: center;
    }

    /* Abbreviation inline with title on mobile */
    .sg-term-header-text {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .sg-single-title {
        font-size: 24px;
    }

    .sg-single-abbr {
        align-self: center;
    }

    .sg-taxonomy-grid {
        grid-template-columns: 1fr;
        padding: 20px 16px 48px;
    }
}

@media (max-width: 480px) {
    .sg-hero-title {
        font-size: 26px;
    }

    .sg-hero-badge {
        font-size: 11px;
        padding: 5px 14px;
    }

    .sg-az-letter {
        min-width: 26px;
        height: 28px;
        font-size: 11px;
    }

    .sg-letter-badge {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .sg-single-letter-badge {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .sg-term-header-top {
        gap: 12px;
    }

    .sg-quiz-start-stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* ==========================================================================
   WIDGET SHORTCODE [glossary_terms]
   ========================================================================== */

.sg-widget-wrap { max-width: var(--sg-max-width); margin: 0 auto; padding: 0 24px; }
.sg-widget-wrap.sg-widget-full { max-width: none; padding: 0; }
.sg-widget-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-widget-cols, 4), 1fr);
    gap: 16px;
}
@media (max-width: 1024px) { .sg-widget-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .sg-widget-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .sg-widget-grid { grid-template-columns: 1fr; } }
.sg-widget-card {
    display: block;
    text-decoration: none;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    transition: all var(--sg-transition);
    color: inherit;
}
.sg-widget-card:hover {
    border-color: var(--sg-primary);
    box-shadow: var(--sg-shadow-md);
    transform: translateY(-2px);
}
.sg-widget-card-inner { padding: 16px 18px; }
.sg-widget-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sg-widget-card-title { font-size: 15px; font-weight: 700; color: var(--sg-text); margin: 0; line-height: 1.3; }
.sg-widget-card-abbr {
    font-size: 11px;
    font-weight: 600;
    color: var(--sg-primary);
    background: var(--sg-primary-light);
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}
.sg-widget-card-def {
    font-size: 13px;
    color: var(--sg-text-muted);
    line-height: 1.5;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sg-widget-card-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.sg-widget-card-cat {
    font-size: 11px;
    color: var(--sg-text-muted);
    background: var(--sg-bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--sg-border);
}
.sg-widget-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-bottom: 8px;
}
.sg-widget-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--sg-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--sg-transition);
    border: 1px solid var(--sg-border);
    background: var(--sg-white);
    color: var(--sg-text);
}
.sg-widget-btn:hover { border-color: var(--sg-primary); color: var(--sg-primary); transform: translateY(-1px); box-shadow: var(--sg-shadow); }
.sg-widget-load-more { background: var(--sg-primary); color: #fff; border-color: var(--sg-primary); }
.sg-widget-load-more:hover { background: var(--sg-primary-dark); color: #fff; border-color: var(--sg-primary-dark); }
.sg-widget-load-more:disabled { opacity: 0.7; cursor: wait; }
.sg-widget-game-btn { background: var(--sg-hero-bg); color: #e2e8f0; border-color: var(--sg-hero-bg); }
.sg-widget-game-btn:hover { background: var(--sg-hero-surface); color: #fff; border-color: var(--sg-hero-surface); }
.sg-widget-empty { text-align: center; padding: 40px 20px; color: var(--sg-text-muted); }

/* ==========================================================================
   CATEGORY PAGE LOAD MORE
   ========================================================================== */

.sg-cat-loadmore-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--sg-primary);
    color: #fff;
    border: none;
    border-radius: var(--sg-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sg-transition);
}
.sg-cat-loadmore-btn:hover { background: var(--sg-primary-dark); transform: translateY(-1px); box-shadow: var(--sg-shadow-md); }
.sg-cat-loadmore-btn:disabled { opacity: 0.7; cursor: wait; }
.sg-cat-loadmore-remaining { font-weight: 400; opacity: 0.8; }

/* ==========================================================================
   GAME CTA BUTTON (single term pages)
   ========================================================================== */

.sg-game-cta {
    text-align: center;
    padding: 8px 0;
}
.sg-game-cta[data-placement="content"] { padding: 4px 0 12px; }
.sg-game-cta[data-placement="nav"] { padding: 12px 0 0; }
.sg-game-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--sg-hero-bg);
    color: #e2e8f0;
    border-radius: var(--sg-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--sg-transition);
}
.sg-game-cta-btn:hover {
    background: var(--sg-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--sg-shadow-md);
}
.sg-game-cta-btn svg { flex-shrink: 0; }

/* Flashcard CTA button — distinct teal/indigo style */
.sg-game-cta[data-placement="fc-content"] { padding: 4px 0 12px; }
.sg-game-cta[data-placement="fc-nav"] { padding: 12px 0 0; }
.sg-fc-cta-btn {
    background: linear-gradient(135deg, #0f172a, #1a1145);
    color: #a5b4fc;
    border: 1px solid #334155;
}
.sg-fc-cta-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-color: transparent;
}

/* Flashcard button in glossary archive hero */
.sg-hero-game-link-fc {
    background: linear-gradient(135deg, #1a1145, #0f172a);
    border-color: #4f46e5;
    color: #a5b4fc;
}
.sg-hero-game-link-fc:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-color: transparent;
}

/* ==========================================================================
   DIFFICULTY TOGGLE (game page)
   ========================================================================== */

.sg-quiz-difficulty-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}
.sg-quiz-diff-btn {
    padding: 8px 20px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.sg-quiz-diff-btn:hover { border-color: var(--sg-primary); color: var(--sg-primary); background: #e0e7ff; }
.sg-quiz-diff-btn.active {
    background: var(--sg-primary);
    border-color: var(--sg-primary);
    color: #fff;
}

/* ==========================================================================
   CATEGORY INDEX PAGE /ai-glossary/category/
   ========================================================================== */

.sg-catindex-hero {
    background: var(--sg-hero-bg);
    padding: 48px 24px 40px;
    text-align: center;
    color: #fff;
    overflow: visible;
}
.sg-catindex-hero-inner { max-width: var(--sg-max-width); margin: 0 auto; }
.sg-catindex-hero h1 { font-size: 32px; font-weight: 800; margin: 0 0 8px; color: #fff; }
.sg-catindex-hero p { font-size: 16px; color: #94a3b8; margin: 0 0 20px; }

/* Category Index Search */
.sg-catindex-search-wrap { max-width: 520px; margin: 0 auto; position: relative; }
.sg-catindex-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 0 18px;
    height: 46px;
}
.sg-catindex-search-box svg { color: #94a3b8; flex-shrink: 0; }
.sg-catindex-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
}
.sg-catindex-search-box input::placeholder { color: #64748b; }
.sg-catindex-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    max-height: 380px;
    overflow-y: auto;
    z-index: 100;
}
.sg-catindex-sr-section { padding: 8px 0; }
.sg-catindex-sr-section + .sg-catindex-sr-section { border-top: 1px solid var(--sg-border); }
.sg-catindex-sr-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sg-text-muted);
    padding: 6px 16px 4px;
    letter-spacing: 0.05em;
}
.sg-catindex-sr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--sg-text);
    transition: background 0.15s;
}
.sg-catindex-sr-item:hover { background: var(--sg-primary-light); }
.sg-catindex-sr-cat i { color: var(--sg-primary); width: 18px; text-align: center; }
.sg-catindex-sr-count { margin-left: auto; font-size: 12px; color: var(--sg-text-muted); }
.sg-catindex-sr-term { flex-direction: column; align-items: flex-start; gap: 2px; }
.sg-catindex-sr-term-title { font-size: 14px; font-weight: 600; }
.sg-catindex-sr-term-def { font-size: 12px; color: var(--sg-text-muted); }
.sg-catindex-sr-empty { padding: 20px 16px; text-align: center; color: var(--sg-text-muted); font-size: 14px; }

/* Category Index A-Z Nav */
.sg-catindex-az-wrap {
    max-width: var(--sg-max-width);
    margin: 20px auto 0;
    padding: 0 24px;
    overflow-x: auto;
}
.sg-catindex-az-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.sg-catindex-az-btn {
    padding: 6px 10px;
    border: 1px solid var(--sg-border);
    border-radius: 6px;
    background: var(--sg-white);
    color: var(--sg-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 32px;
    text-align: center;
}
.sg-catindex-az-btn:hover { border-color: var(--sg-primary); color: var(--sg-primary); }
.sg-catindex-az-btn.active {
    background: var(--sg-primary);
    border-color: var(--sg-primary);
    color: #fff;
}
.sg-catindex-az-empty { text-align: center; padding: 32px 16px; color: var(--sg-text-muted); font-size: 14px; }

/* Category Index Grid */
.sg-catindex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    max-width: var(--sg-max-width);
    margin: 20px auto 0;
    padding: 0 24px;
}
.sg-catindex-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    text-decoration: none;
    color: inherit;
    transition: all var(--sg-transition);
}
.sg-catindex-card:hover {
    border-color: var(--sg-primary);
    box-shadow: var(--sg-shadow-md);
    transform: translateY(-2px);
}
.sg-catindex-card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sg-primary-light);
    color: var(--sg-primary);
    border-radius: 10px;
    font-size: 18px;
    flex-shrink: 0;
}
.sg-catindex-card-info { flex: 1; min-width: 0; }
.sg-catindex-card-name { font-size: 15px; font-weight: 700; color: var(--sg-text); margin: 0 0 2px; }
.sg-catindex-card-count { font-size: 12px; color: var(--sg-text-muted); }
.sg-catindex-card-arrow { color: var(--sg-text-muted); flex-shrink: 0; transition: transform 0.2s; }
.sg-catindex-card:hover .sg-catindex-card-arrow { transform: translateX(3px); color: var(--sg-primary); }
.sg-catindex-loadmore-wrap { text-align: center; padding: 24px 24px 0; }
.sg-catindex-back { text-align: center; padding: 24px 24px 64px; }

/* Hero Button Glow Effect */
.sg-hero-btn-glow {
    position: relative;
}
.sg-hero-btn-glow::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    background: var(--sg-glow-color, rgba(var(--sg-primary-rgb), 0.35));
    filter: blur(12px);
    z-index: -1;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.sg-hero-btn-glow:hover::before { opacity: 1; }
.sg-hero-game-link-secondary {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    box-shadow: none;
}
.sg-hero-game-link-secondary:hover {
    background: rgba(255,255,255,0.14);
    box-shadow: none;
}

/* Random Dice Button — Archive Hero */
.sg-hero-dice-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: all var(--sg-transition);
    border: 1px solid transparent;
    box-shadow: none;
    position: relative;
}
.sg-hero-dice-link:hover {
    transform: translateY(-2px);
    filter: brightness(1.15);
    color: #fff;
}
.sg-hero-dice-link svg { flex-shrink: 0; }
.sg-hero-dice-link.sg-hero-btn-glow::before {
    background: var(--sg-dice-glow-color, rgba(245,158,11,0.4));
}

/* Random Dice Button — Single Term (inline with CTA) */
.sg-game-cta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sg-dice-btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--sg-hero-bg);
    color: #e2e8f0;
    border-radius: var(--sg-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--sg-transition);
}
.sg-dice-btn-inline:hover {
    background: var(--sg-hero-surface);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--sg-shadow-md);
}
.sg-dice-btn-inline svg { flex-shrink: 0; }

/* Random Dice — Category Index (next to search) */
.sg-catindex-search-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}
.sg-catindex-search-row .sg-catindex-search-wrap { flex: 1; min-width: 0; }
.sg-catindex-dice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 18px;
    height: 46px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
}
.sg-catindex-dice-btn:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
    color: #fff;
}
.sg-catindex-dice-btn svg { flex-shrink: 0; }
/* Hide dice text on mobile */
@media (max-width: 768px) {
    .sg-dice-text-hide-mobile { display: none !important; }
    .sg-catindex-dice-btn { padding: 0 14px; }
    .sg-catpage-dice-btn { padding: 0 12px; }
}

/* Category Page Search (taxonomy page) */
.sg-catpage-search-wrap {
    max-width: var(--sg-max-width);
    margin: 16px auto 0;
    padding: 0 24px;
}
.sg-catpage-search-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    max-width: 520px;
}
.sg-catpage-search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--sg-white);
    border: 1px solid var(--sg-border);
    border-radius: 10px;
    padding: 0 16px;
    height: 42px;
    position: relative;
    box-sizing: border-box;
}
.sg-catpage-search-box svg { color: var(--sg-text-muted); flex-shrink: 0; }
.sg-catpage-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--sg-text);
    font-size: 14px;
}
.sg-catpage-search-box input::placeholder { color: #94a3b8; }
.sg-catpage-dice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 42px;
    background: var(--sg-hero-bg);
    color: #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
}
.sg-catpage-dice-btn:hover {
    background: var(--sg-hero-surface);
    color: #fff;
    transform: translateY(-1px);
}
.sg-catpage-dice-btn svg { flex-shrink: 0; }

/* Widget Browse Tags button */
.sg-widget-tags-btn { background: var(--sg-primary-light); color: var(--sg-primary); border-color: var(--sg-primary-light); }
.sg-widget-tags-btn:hover { background: var(--sg-primary); color: #fff; border-color: var(--sg-primary); }
