/* ===== Terminal (CRT Phosphor) Theme ===== */

.tm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(6px);
}

.tm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted, #6b7280);
    letter-spacing: 0.02em;
    user-select: none;
}

.tm-switch {
    position: relative;
    width: 38px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.tm-switch:focus-visible {
    outline: 2px solid rgba(74, 222, 128, 0.6);
    outline-offset: 2px;
}

.tm-switch-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #94a3b8;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s ease,
                box-shadow 0.25s ease;
}

.tm-switch[aria-pressed="true"] {
    background: rgba(74, 222, 128, 0.18);
    border-color: rgba(74, 222, 128, 0.45);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.25);
}

.tm-switch[aria-pressed="true"] .tm-switch-thumb {
    transform: translateX(18px);
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

/* ===== Window ===== */
.tm-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.tm-window {
    position: relative;
    width: min(640px, 92vw);
    border-radius: 10px;
    background:
        radial-gradient(ellipse at center,
            rgba(8, 16, 10, 0.96) 0%,
            rgba(2, 8, 4, 0.98) 100%);
    border: 1px solid rgba(74, 222, 128, 0.2);
    box-shadow:
        0 30px 60px -22px rgba(0, 0, 0, 0.8),
        inset 0 0 0 1px rgba(74, 222, 128, 0.06),
        inset 0 0 80px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    color: #4ade80;
    font-family: "Menlo", "Monaco", "Consolas", "Courier New", monospace;
    font-size: clamp(13px, 1.4vw, 15px);
    line-height: 1.5;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.55), 0 0 18px rgba(74, 222, 128, 0.18);
}

/* Title bar */
.tm-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(74, 222, 128, 0.06);
    border-bottom: 1px solid rgba(74, 222, 128, 0.15);
    font-size: 12px;
    color: rgba(74, 222, 128, 0.6);
    letter-spacing: 0.05em;
}

.tm-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(74, 222, 128, 0.4);
}

.tm-dot-r { background: rgba(248, 113, 113, 0.7); box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
.tm-dot-y { background: rgba(250, 204, 21, 0.7); box-shadow: 0 0 6px rgba(250, 204, 21, 0.4); }
.tm-dot-g { background: rgba(74, 222, 128, 0.7); box-shadow: 0 0 6px rgba(74, 222, 128, 0.4); }

.tm-title {
    margin-left: 12px;
    flex: 1;
    text-align: center;
    color: rgba(74, 222, 128, 0.6);
}

/* Body */
.tm-body {
    padding: 18px 22px 20px;
    position: relative;
    z-index: 2;
}

.tm-line {
    white-space: pre-wrap;
    margin-bottom: 6px;
}

.tm-prompt {
    color: rgba(74, 222, 128, 0.85);
}

.tm-prompt-user { color: #facc15; text-shadow: 0 0 8px rgba(250, 204, 21, 0.5); }
.tm-prompt-path { color: #38bdf8; text-shadow: 0 0 8px rgba(56, 189, 248, 0.45); }
.tm-command      { color: rgba(74, 222, 128, 0.85); }

.tm-ascii pre {
    margin: 8px 0 12px;
    color: rgba(74, 222, 128, 0.7);
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.45);
    font-size: clamp(10px, 1.2vw, 13px);
    line-height: 1.2;
    text-align: center;
}

.tm-line-time {
    text-align: center;
    margin: 18px 0 14px;
}

.tm-time {
    font-family: "Menlo", "Monaco", "Consolas", monospace;
    font-weight: 700;
    font-size: clamp(40px, 7vw, 72px);
    letter-spacing: 0.06em;
    color: #bbf7d0;
    text-shadow:
        0 0 6px rgba(74, 222, 128, 0.85),
        0 0 18px rgba(74, 222, 128, 0.55),
        0 0 36px rgba(74, 222, 128, 0.25);
    line-height: 1;
}

.tm-info {
    border-top: 1px dashed rgba(74, 222, 128, 0.18);
    border-bottom: 1px dashed rgba(74, 222, 128, 0.18);
    padding: 10px 0;
    margin: 14px 0 10px;
    color: rgba(74, 222, 128, 0.75);
}

.tm-info-line {
    margin-bottom: 2px;
    font-size: clamp(11px, 1.2vw, 13px);
}

.tm-key {
    color: rgba(74, 222, 128, 0.55);
    letter-spacing: 0.04em;
}

.tm-prompt-bottom {
    margin-bottom: 0;
}

.tm-cursor {
    display: inline-block;
    color: #bbf7d0;
    animation: tm-blink 1.1s steps(1) infinite;
}

@keyframes tm-blink {
    0%, 50%   { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* ===== CRT effects ===== */
.tm-scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(74, 222, 128, 0.25) 2px,
        rgba(74, 222, 128, 0.25) 3px
    );
    opacity: 1;
    transition: opacity 0.3s ease;
}

.tm-window.no-scanlines .tm-scanlines {
    opacity: 0;
}

.tm-flicker {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background:
        radial-gradient(ellipse at center,
            transparent 60%,
            rgba(0, 0, 0, 0.45) 100%);
    animation: tm-flicker 4.5s steps(8) infinite;
}

@keyframes tm-flicker {
    0%, 96%, 100% { opacity: 0.85; }
    97%           { opacity: 0.7; }
    98%           { opacity: 0.95; }
    99%           { opacity: 0.78; }
}

@media (max-width: 640px) {
    .tm-window { font-size: 12px; }
    .tm-titlebar { padding: 8px 12px; font-size: 11px; }
    .tm-body { padding: 14px 16px; }
    .tm-toolbar { gap: 6px 12px; padding: 5px 10px; }
    .tm-toggle-label { font-size: 11px; }
}