:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-2: #1a1a25;
    --border: #2a2a3a;
    --text: #e4e4ef;
    --text-muted: #9999aa;
    --accent: #22c55e;
    --accent-dim: rgba(34, 197, 94, 0.15);
    --gold: #fbbf24;
    --red: #ef4444;
    --font-sans: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Hints */
.hints-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.hints-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.hints-box ul {
    list-style: none;
    padding: 0;
}

.hints-box li {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
}

.hints-box li::before {
    content: '\25B8  ';
    color: var(--accent);
}

kbd {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--accent);
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 1rem;
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--accent), #16a34a);
    color: #000;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 1rem;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-cert {
    display: block;
    width: 100%;
    padding: 0.85rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid var(--gold);
    border-radius: 0.75rem;
    background: rgba(251, 191, 36, 0.08);
    color: var(--gold);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cert:hover {
    background: rgba(251, 191, 36, 0.18);
}

/* Timer */
.timer {
    text-align: center;
    margin-bottom: 1rem;
}

.timer span {
    font-family: var(--font-mono);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.timer.timer-running span {
    animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 10px rgba(34, 197, 94, 0.2); }
    50% { text-shadow: 0 0 25px rgba(34, 197, 94, 0.5); }
}

/* Terminal */
.terminal-wrapper {
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.terminal-chrome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background: #ef4444; }
.dot.yellow { background: #eab308; }
.dot.green { background: #22c55e; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

#terminal-container {
    height: 380px;
    background: #000;
    overflow: hidden;
}

#terminal-container .xterm {
    height: 100%;
    padding: 4px;
}

#terminal-container .xterm-viewport {
    background-color: #000 !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
}

#terminal-container .xterm-viewport::-webkit-scrollbar {
    display: none !important;
}

#terminal-container .xterm-helper-textarea {
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    resize: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: 0 !important;
    z-index: -5 !important;
}

.terminal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.loading-sub {
    font-size: 0.75rem;
    color: #555;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Success */
.success-card {
    text-align: center;
}

.trophy {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.success-time {
    font-size: 1.2rem;
    color: var(--text) !important;
}

.success-time strong {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1.4rem;
}

.success-sub {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

#reward-icon {
    font-size: 2rem;
}

/* Share */
.share-section {
    margin: 1.5rem 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.share-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted) !important;
    margin-bottom: 0.75rem !important;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s;
    border: none;
    font-family: var(--font-sans);
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-x { background: #1d9bf0; color: #fff; }
.share-linkedin { background: #0a66c2; color: #fff; }
.share-reddit { background: #ff4500; color: #fff; }
.share-email { background: #6b7280; color: #fff; font-size: 1.2rem; }
.share-copy { background: var(--surface-2); color: var(--text-muted); }

/* Certificate section */
.cert-section {
    margin: 1.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.cert-hint {
    margin-top: 0.75rem !important;
    font-size: 0.8rem;
}

.cert-hint a {
    color: var(--text-muted);
}

.cert-hint a:hover {
    color: var(--accent);
}

.print-tips {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-top: 0.75rem;
    text-align: left;
}

.print-tips h3 {
    font-size: 0.85rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.print-tips ol {
    padding-left: 1.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.print-tips li {
    margin-bottom: 0.3rem;
}

/* Progressive hint bar */
.hint-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    transition: opacity 0.3s;
    line-height: 1.7;
}

.hint-bar kbd {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.1rem 0.45rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--accent);
}

/* Nano suggestion */
.nano-suggest {
    margin: 1.5rem 0 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.nano-suggest a {
    color: var(--accent);
    text-decoration: underline;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

footer a {
    color: var(--text-muted);
    text-decoration: underline;
}

footer a:hover {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 600px) {
    header h1 { font-size: 1.8rem; }
    .timer span { font-size: 2rem; }
    #terminal-container { height: 300px; }
    .card { padding: 1.25rem; }
}
