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

:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --border: #1e1e2e;
    --text: #c8c8d8;
    --text-dim: #666680;
    --accent: #00ff88;
    --accent-dim: #00aa55;
    --danger: #ff4466;
    --warn: #ffaa00;
}

body {
    font-family: 'Courier New', monospace;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    flex-shrink: 0;
}

.logo {
    font-size: 1.3rem;
    color: var(--accent);
    letter-spacing: 0.3em;
    font-weight: 400;
}

.subtitle { font-size: 0.65rem; color: var(--text-dim); }

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.controls {
    width: 250px;
    min-width: 250px;
    padding: 0.6rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.control-group label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

input[type="file"] {
    background: var(--bg);
    border: 1px dashed var(--border);
    padding: 0.35rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.65rem;
    border-radius: 3px;
    cursor: pointer;
}

input[type="file"]:hover { border-color: var(--accent-dim); }

select {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.3rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.65rem;
    border-radius: 3px;
}

select:focus { border-color: var(--accent); outline: none; }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.toggles { flex-direction: row; gap: 0.5rem; }
.toggle { display: flex; align-items: center; gap: 0.2rem; cursor: pointer; }
.toggle input[type="checkbox"] { accent-color: var(--accent); }
.toggle span { font-size: 0.6rem; color: var(--text); text-transform: none; letter-spacing: 0; }

.btn {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.65rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-primary {
    background: var(--accent-dim);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: bold;
}

.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-small { padding: 0.2rem 0.45rem; font-size: 0.55rem; }

.btn-play.playing {
    background: var(--accent-dim);
    color: var(--bg);
    border-color: var(--accent);
}

.buttons { flex-direction: row; gap: 0.35rem; }
.frame-nav { display: flex; gap: 0.2rem; flex-wrap: wrap; }
.speed-control { display: flex; flex-direction: column; gap: 0.15rem; }
.video-meta, .file-info, .buffer-info { font-size: 0.55rem; color: var(--text-dim); }

.stats {
    margin-top: auto;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border);
}

.stats #statsText {
    font-size: 0.5rem;
    color: var(--text-dim);
    line-height: 1.4;
    white-space: pre-wrap;
}

/* status panel */
.status-panel {
    border-top: 1px solid var(--border);
    padding-top: 0.3rem;
}

.status-text {
    font-size: 0.45rem;
    color: var(--text-dim);
    line-height: 1.4;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
}

/* progress */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-fill.indeterminate {
    width: 100% !important;
    background: linear-gradient(90deg, var(--accent-dim) 0%, var(--accent) 50%, var(--accent-dim) 100%);
    background-size: 200% 100%;
    animation: shimmer 1s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* output */
.output-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    background: var(--bg);
}

.output-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

.ascii-output {
    display: none;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    line-height: 10px;
    color: var(--accent);
    padding: 0.4rem;
    margin: 0;
    white-space: pre;
    user-select: all;
    cursor: text;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    color: var(--text-dim);
}

.ascii-logo { color: var(--accent); font-size: 1rem; line-height: 1.3; margin-bottom: 0.5rem; }
.placeholder p { font-size: 0.7rem; }

/* log panel */
.log-panel {
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem;
    cursor: pointer;
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    user-select: none;
}

.log-header:hover { color: var(--text); }

.log-badge {
    background: var(--border);
    color: var(--text-dim);
    padding: 0.05rem 0.35rem;
    border-radius: 8px;
    font-size: 0.5rem;
    min-width: 1rem;
    text-align: center;
}

.log-badge.error { background: var(--danger); color: #fff; }
.log-arrow { margin-left: auto; font-size: 0.55rem; }
.log-body { border-top: 1px solid var(--border); }
.log-actions { padding: 0.25rem 1rem; display: flex; gap: 0.3rem; }

.log-output {
    height: 140px;
    overflow-y: auto;
    padding: 0.3rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.55rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line-error { color: var(--danger); }
.log-line-warn { color: var(--warn); }
.log-line-info { color: var(--text-dim); }

/* limits info */
.limits-info {
    font-size: 0.55rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
    padding: 0.25rem 0.4rem;
    background: rgba(255, 170, 0, 0.06);
    border: 1px solid rgba(255, 170, 0, 0.15);
    border-radius: 3px;
}

/* toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1.2rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s, transform 0.3s;
}
.toast-visible { opacity: 1; transform: translateX(0); }
.toast-error {
    background: rgba(255, 68, 102, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}
.toast-warn {
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid var(--warn);
    color: var(--warn);
}

@media (max-width: 768px) {
    .main-layout { flex-direction: column; }
    .controls {
        width: 100%; min-width: 100%; max-height: 40vh;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .header { flex-direction: column; gap: 0.2rem; padding: 0.4rem 0.75rem; }
}
