.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-spacer {
    width: 36px;
    flex-shrink: 0;
}

.header-inner h1 {
    flex: 1;
    text-align: center;
}

.help-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.help-btn:hover {
    border-color: #fff;
    color: #fff;
}

.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.help-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.help-modal {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    max-width: 420px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.94);
    transition: transform 0.2s ease;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
}

.help-overlay.visible .help-modal {
    transform: scale(1);
}

.term-bar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.term-title {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
}

.help-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.help-close:hover {
    color: #fff;
}

.term-body {
    padding: 18px 20px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: #c9d1d9;
}

.term-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.term-heading {
    color: #ff7b72;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.term-highlight {
    color: #ffa657;
    font-weight: 600;
}

.term-comment {
    color: #6e7681;
    font-size: 0.78rem;
    margin-left: 6px;
}

.term-prompt {
    color: #58a6ff;
    font-weight: 700;
}

.term-cursor {
    color: #58a6ff;
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


.help-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid #30363d;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
}

.help-tile.correct {
    background-color: #538d4e;
    border-color: #538d4e;
}

.help-tile.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
}

.help-tile.absent {
    background-color: #66666b;
    border-color: #66666b;
}

@media (max-width: 400px) {
    .term-body {
        padding: 14px 16px;
        font-size: 0.75rem;
    }

    .help-tile {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
}