:root {
    --tv-bg: #f5ecdf;
    --tv-bg-deep: #efe1cf;
    --tv-panel: rgba(255, 250, 244, 0.94);
    --tv-panel-soft: rgba(151, 27, 31, 0.08);
    --tv-accent: #971b1f;
    --tv-accent-strong: #7f1518;
    --tv-accent-soft: rgba(151, 27, 31, 0.12);
    --tv-text: #1f1814;
    --tv-muted: #6c5a4f;
    --tv-line: rgba(151, 27, 31, 0.12);
    --tv-danger: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(151, 27, 31, 0.08), transparent 32%),
        radial-gradient(circle at bottom right, rgba(201, 145, 84, 0.16), transparent 36%),
        linear-gradient(180deg, var(--tv-bg) 0%, var(--tv-bg-deep) 100%);
    color: var(--tv-text);
    font-family: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}

body.tv-screen-body,
body.tv-screen-body * {
    user-select: none;
}

body.tv-screen-body {
    overflow: hidden;
}

.tv-login-shell,
.tv-selector-shell,
.tv-preview-shell {
    min-height: 100vh;
    padding: 28px;
}

.tv-login-shell {
    display: grid;
    place-items: center;
}

.tv-login-card,
.tv-selector-card {
    background: var(--tv-panel);
    border: 1px solid var(--tv-line);
    border-radius: 26px;
    box-shadow: 0 24px 60px rgba(80, 47, 28, 0.14);
}

.tv-login-card {
    width: min(460px, 100%);
    padding: 34px;
}

.tv-login-kicker,
.tv-screen-code {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--tv-accent);
    font-size: 12px;
    font-weight: 800;
}

.tv-login-card h1,
.tv-selector-header h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 54px);
    line-height: 0.94;
    color: var(--tv-accent-strong);
}

.tv-login-form {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.tv-login-form label,
.tv-check span {
    color: var(--tv-muted);
    font-size: 14px;
}

.tv-login-form input[type="password"] {
    width: 100%;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--tv-line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--tv-text);
    font-size: 18px;
}

.tv-login-form button,
.tv-primary-link,
.tv-secondary-link,
.tv-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.tv-login-form button,
.tv-primary-link {
    border: none;
    background: linear-gradient(135deg, #b3272c, #971b1f);
    color: #fff8f4;
}

.tv-secondary-link,
.tv-secondary-button {
    border: 1px solid var(--tv-line);
    background: rgba(255, 255, 255, 0.65);
    color: var(--tv-text);
}

.tv-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-error {
    margin: -4px 0 0;
    color: var(--tv-danger);
}

.tv-selector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.tv-selector-grid,
.tv-preview-grid {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

.tv-selector-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tv-selector-card {
    padding: 24px;
}

.tv-selector-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.tv-selector-card p {
    margin: 0 0 16px;
    color: var(--tv-muted);
}

.tv-selector-card ul {
    margin: 0 0 20px;
    padding-left: 18px;
    color: var(--tv-text);
}

.tv-stage-frame {
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.tv-stage {
    width: 1920px;
    height: 1080px;
    padding: 30px 34px 22px;
    transform-origin: top left;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 28%),
        radial-gradient(circle at top right, rgba(151, 27, 31, 0.08), transparent 30%),
        linear-gradient(180deg, #f8efe3 0%, #efe1cf 100%);
    overflow: hidden;
    position: relative;
}

.tv-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    opacity: 0.45;
    transform: translateX(var(--tv-sweep-offset, -25%));
}

.tv-stage-header,
.tv-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.tv-stage-header h1 {
    margin: 0;
    font-size: 42px;
    line-height: 0.96;
    letter-spacing: -0.04em;
    color: var(--tv-accent-strong);
}

.tv-clock,
.tv-status,
.tv-scene {
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--tv-line);
    font-size: 17px;
    font-weight: 700;
    color: var(--tv-text);
}

.tv-stage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
    height: 900px;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.tv-category {
    border-radius: 18px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--tv-line);
    box-shadow: 0 10px 30px rgba(80, 47, 28, 0.05);
    backdrop-filter: blur(6px);
}

.tv-category h2 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--tv-accent-strong);
}

.tv-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(151, 27, 31, 0.08);
}

.tv-item:last-child {
    border-bottom: none;
}

.tv-item-name {
    font-size: 20px;
    line-height: 1.08;
    font-weight: 800;
    color: var(--tv-text);
}

.tv-item-meta,
.tv-item-description {
    color: var(--tv-muted);
    font-size: 13px;
    line-height: 1.3;
}

.tv-item-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tv-item-price {
    font-size: 20px;
    line-height: 1;
    font-weight: 900;
    color: var(--tv-accent);
    white-space: nowrap;
}

.tv-loading {
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 28px;
    color: var(--tv-muted);
}

.tv-footer {
    margin-top: 10px;
}

.tv-debug {
    position: absolute;
    right: 18px;
    bottom: 18px;
    max-width: 360px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(32, 23, 18, 0.82);
    color: #d7ffe1;
    font: 13px/1.45 ui-monospace, monospace;
    white-space: pre-wrap;
}

.tv-preview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tv-preview-grid iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    border: 1px solid var(--tv-line);
    background: #000;
}

@media (max-width: 1200px) {
    .tv-preview-grid {
        grid-template-columns: 1fr;
    }
}
