:root {
    --bg: #05050a;
    --panel: #121836;
    --line: #3f4f87;
    --text: #eef2ff;
    --muted: #9eaed7;
    --accent: #5fe8ff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    padding: 1rem;
    display: flex;
    justify-content: center;
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at 14% 10%, rgba(95, 232, 255, 0.18), transparent 34%),
        radial-gradient(circle at 82% 15%, rgba(255, 82, 202, 0.2), transparent 40%),
        linear-gradient(165deg, #05050b 0%, #090e20 52%, #04050a 100%);
}

.app {
    width: min(1040px, 100%);
    display: grid;
    gap: 0.85rem;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(17, 24, 53, 0.96), rgba(9, 13, 28, 0.96));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.topbar {
    padding: 0.9rem 1rem;
}

.back {
    text-decoration: none;
    color: #ffd070;
    font-weight: 700;
}

h1 {
    margin: 0.56rem 0 0.32rem;
    font-size: clamp(1.3rem, 3vw, 2rem);
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.controls {
    display: grid;
    gap: 0.64rem;
    padding: 0.82rem;
}

label {
    display: grid;
    gap: 0.24rem;
    font-size: 0.84rem;
    color: var(--muted);
}

input,
select,
button {
    font: inherit;
}

input[type="text"],
select {
    width: 100%;
    border: 1px solid #455ca2;
    border-radius: 10px;
    background: #111d45;
    color: var(--text);
    padding: 0.55rem 0.6rem;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.56rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

button {
    border: 1px solid #4f6bb7;
    border-radius: 10px;
    background: #1a2d63;
    color: var(--text);
    padding: 0.56rem 0.74rem;
    cursor: pointer;
    font-weight: 650;
    transition: transform 120ms ease, border-color 120ms ease;
}

button:hover {
    transform: translateY(-1px);
    border-color: #8ac9ff;
}

button:active {
    transform: translateY(1px);
}

button.primary {
    background: linear-gradient(180deg, #954cff, #6333b0);
    border-color: #c395ff;
}

.output {
    padding: 0.84rem;
    display: grid;
    gap: 0.52rem;
}

.frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid #4f63a9;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #0b1230, #040716 66%, #02040d);
}

.safe-area {
    position: absolute;
    inset: 8% 4.5% 8% 4.5%;
    display: grid;
    align-content: end;
    gap: 0.46rem;
}

.title-stack {
    max-width: 76%;
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
}

.title-line,
.host-line {
    margin: 0;
    padding: 0.22rem 0.5rem;
    font-family: "Courier New", "Consolas", monospace;
    letter-spacing: 0.04em;
}

.title-line {
    font-size: clamp(0.7rem, 2vw, 1.18rem);
    font-weight: 700;
}

.host-line {
    font-size: clamp(0.62rem, 1.4vw, 0.9rem);
    opacity: 0.94;
}

.ticker-wrap {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(0, 0, 0, 0.28);
    height: clamp(24px, 4vw, 42px);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.ticker-track {
    white-space: nowrap;
    padding-left: 100%;
    font-family: "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: clamp(0.66rem, 1.6vw, 1rem);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.24);
    will-change: transform;
}

.scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.05) 0,
        rgba(255, 255, 255, 0.05) 1px,
        transparent 1px,
        transparent 4px
    );
    mix-blend-mode: screen;
    opacity: 0.58;
}

.noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.28;
}

.timestamp,
.record-dot {
    position: absolute;
    top: 9px;
    font-family: "Courier New", monospace;
    font-size: clamp(0.58rem, 1.25vw, 0.78rem);
    letter-spacing: 0.08em;
}

.timestamp {
    left: 12px;
    color: #fffcc6;
}

.record-dot {
    right: 12px;
    color: #ff8fa8;
    font-weight: 700;
}

.status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 800px) {
    .row {
        grid-template-columns: 1fr;
    }

    .title-stack {
        max-width: 100%;
    }
}
