/* Dynamic Display menu fonts (Admin MENU_FONT_OPTIONS — Flame family). */
@font-face {
    font-family: 'Flame Bold';
    src: url('../font/Flame-Bold.woff2') format('woff2'),
         url('../font/Flame-Bold.woff') format('woff'),
         url('../font/Flame-Bold.ttf') format('truetype');
    font-style: normal;
    font-weight: 700;
}

@font-face {
    font-family: 'Flame Regular';
    src: url('../font/Flame-Regular.woff2') format('woff2'),
         url('../font/Flame-Regular.woff') format('woff'),
         url('../font/Flame-Regular.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
}

@font-face {
    font-family: 'Flame Sans';
    src: url('../font/FlameSans-Regular.woff2') format('woff2'),
         url('../font/FlameSans-Regular.woff') format('woff'),
         url('../font/FlameSans-Regular.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    color: white;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
}

#app-container {
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Loading Screen */
.loading-screen {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
}

.loading-container {
    text-align: center;
    width: 100%;
    max-width: 560px;
    padding: 0 28px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1.35rem;
    font-weight: 600;
    color: #ecf0f1;
    line-height: 1.35;
    margin: 0;
}

.loading-detail {
    margin-top: 12px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.45;
    min-height: 1.45em;
}

.loading-progress {
    margin-top: 22px;
    text-align: left;
}

.loading-meter-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: baseline;
    -webkit-align-items: baseline;
    align-items: baseline;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 8px;
    width: 100%;
}

.loading-meter-head > * {
    margin-right: 10px;
    margin-bottom: 4px;
}

.loading-meter-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.loading-meter-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-variant-numeric: tabular-nums;
}

.loading-meter-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

.loading-track {
    height: 5px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    border-radius: 0;
    background: #e31b23;
    transition: width 0.15s ease-out;
}

/* Flex row spacing without CSS gap (legacy TV WebKit 38) */
.storeplay-flex-gap > * + * {
    margin-left: 18px;
}

.storeplay-flex-gap-16 > * + * {
    margin-left: 16px;
}

.storeplay-flex-gap-14 > * + * {
    margin-left: 14px;
}

.dr-status-layer > * + * {
    margin-top: 16px;
}

/* Initial campaign download — black / white / red */
.storeplay-download-screen {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    padding: 32px 28px;
    background: #000000;
}

.storeplay-download-version {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.42);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    user-select: none;
}

.storeplay-download-panel {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

/* Reuse global .spinner (60px, 4px ring, spin animation) — same as Loading / Pairing */
.storeplay-download-spinner-wrap {
    margin: 0 auto 28px;
}

.storeplay-download-spinner-wrap .spinner {
    margin-bottom: 0;
}

.storeplay-download-headline {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.3;
    margin: 0 auto;
    max-width: 100%;
}

.storeplay-download-active {
    margin-top: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.45;
    max-width: 100%;
    max-height: 4.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.storeplay-download-status {
    margin-top: 14px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.45;
    min-height: 1.45em;
}

.storeplay-download-meter {
    margin-top: 22px;
    text-align: left;
}

.storeplay-download-meter-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: baseline;
    -webkit-align-items: baseline;
    align-items: baseline;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 8px;
    width: 100%;
}

.storeplay-download-meter-head > * {
    margin-right: 10px;
    margin-bottom: 4px;
}

.storeplay-download-meter-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.storeplay-download-meter-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-variant-numeric: tabular-nums;
}

.storeplay-download-meter-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

.storeplay-download-track {
    height: 5px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.storeplay-download-bar {
    height: 100%;
    width: 0%;
    border-radius: 0;
    background: #e31b23;
    transition: width 0.15s ease-out;
}


/* Dashboard */
.dashboard {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    padding: 20px;
    overflow-y: auto;
}

.dashboard-container {
    background: rgba(20, 20, 20, 0.92);
    border-radius: 10px;
    padding: 20px;
    max-width: 1400px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
}

.dashboard-header {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 30px;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

.dashboard-header h2 {
    font-size: 2rem;
    color: #ecf0f1;
    margin: 0 20px 12px 0;
}

.header-buttons {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.header-buttons > * + * {
    margin-left: 15px;
}

.display-button {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

.display-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(142, 68, 173, 0.4);
}

.logout-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.logout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.dashboard-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.dashboard-content > .info-section {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 45%;
    flex: 1 1 45%;
    min-width: 280px;
    margin: 0 10px 20px;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .dashboard-content > .info-section {
        -webkit-flex: 1 1 100%;
        flex: 1 1 100%;
    }
}

.info-section {
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-section h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #3498db;
    border-bottom: 2px solid rgba(52, 152, 219, 0.3);
    padding-bottom: 5px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.info-item .label {
    font-weight: bold;
    color: #bdc3c7;
    font-size: 1.1rem;
}

.info-item .value {
    color: #ecf0f1;
    font-size: 1.1rem;
}

.info-item .value.success {
    color: #2ecc71;
}

.info-item .value.error {
    color: #e74c3c;
}

.info-item .value.warning {
    color: #f39c12;
}

.device-info-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-left: -5px;
    margin-right: -5px;
}

.device-info-grid > * {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 45%;
    flex: 1 1 45%;
    min-width: 120px;
    margin: 5px;
    box-sizing: border-box;
}

.status-indicator {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 2px solid rgba(46, 204, 113, 0.3);
}

.status-indicator .status-dot {
    margin-right: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2ecc71;
}

button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 5px;
}

button:hover:not(:disabled) {
    background: #2980b9;
}

button:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

button:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

/* TV-specific optimizations */
@media (min-width: 1920px) {
    .dashboard-container {
        max-width: 1600px;
        padding: 40px;
    }

    .dashboard-header h2 {
        font-size: 2.5rem;
    }

    .info-section h3 {
        font-size: 1.6rem;
    }

    .info-item .label {
        font-size: 1.2rem;
    }

    .info-item .value {
        font-size: 1.2rem;
    }
}

/* Pairing Screen */
.pairing-screen {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: #000000;
    overflow: hidden;
}

.pairing-layout {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-flex-direction: row;
    flex-direction: row;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    box-sizing: border-box;
}

.pairing-left {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 50%;
    flex: 1 1 50%;
    width: 50%;
    min-width: 0;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    padding: 56px 64px;
    background: #000000;
    box-sizing: border-box;
    overflow: hidden;
}

.pairing-title {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
    line-height: 1.15;
    max-width: 100%;
}

.pairing-subtitle {
    font-size: 1.25rem;
    color: #b0b0b0;
    line-height: 1.5;
    margin: 0 0 28px 0;
    max-width: 100%;
}

.device-code-section {
    margin-top: 20px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

.device-code-label {
    font-size: 1rem;
    color: #888888;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.device-code-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    letter-spacing: 6px;
    margin: 0;
    word-break: break-all;
}

.pairing-right {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 50%;
    flex: 1 1 50%;
    width: 50%;
    min-width: 0;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    padding: 48px 40px;
    background: #000000;
    box-sizing: border-box;
    overflow: hidden;
}

.qr-code-container {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    box-sizing: border-box;
}

.qr-code-image {
    display: block;
    max-width: 100%;
    width: 360px;
    height: auto;
    margin: 0 auto;
}

.qr-code-svg {
    display: block;
    max-width: 100%;
    width: 360px;
    margin: 0 auto;
}

.qr-code-svg svg {
    display: block;
    width: 100%;
    height: auto;
}

.pairing-polling-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    color: #ffffff;
}

.pairing-polling-dot {
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border-radius: 50%;
    margin-right: 15px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    -webkit-animation: pulse 1.5s infinite;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Error Screen */
.error-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
}

.error-container {
    background: rgba(40, 12, 12, 0.95);
    border: 2px solid rgba(231, 76, 60, 0.3);
    border-radius: 10px;
    padding: 40px;
    width: 92%;
    max-width: 720px;
    box-sizing: border-box;
    text-align: center;
}

.error-container h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #e74c3c;
}

.error-container p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #ecf0f1;
}

/* Store Selection */
.store-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.store-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.store-container h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 28px;
}

.store-container p {
    text-align: center;
    color: #34495e;
    margin-bottom: 30px;
}

.stores-list {
    margin-bottom: 30px;
}

.store-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.store-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.store-item.selected {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.05);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.15);
}

.store-item h3 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.store-item p {
    color: #7f8c8d;
    margin: 0;
    font-size: 14px;
    text-align: left;
}

.store-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    margin-bottom: 20px;
}

.store-actions > * + * {
    margin-left: 16px;
}

.skip-button {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skip-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
}

.error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    padding: 16px;
    color: #c0392b;
    margin-top: 20px;
    text-align: center;
}

.no-stores {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* Login logo (Pairing + Client Login) */
.login-logo-wrap {
    background: #ffffff;
    padding: 24px 32px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 40px;
}
.login-logo {
    display: block;
    max-width: 280px;
    max-height: 120px;
    width: auto;
    height: auto;
    -webkit-object-fit: contain;
    object-fit: contain;
}

/* Client Login */
.client-login {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: #000000;
}

.login-container {
    background: rgba(24, 24, 24, 0.96);
    border-radius: 12px;
    padding: 40px;
    width: 92%;
    max-width: 520px;
    box-sizing: border-box;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-container h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #ecf0f1;
}

.login-container .login-hint {
    margin-bottom: 20px;
    color: #bdc3c7;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #bdc3c7;
}

.form-group input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.refresh-button {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

/* Display Renderer */
.display-renderer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 1000;
    overflow: hidden;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-container video {
    width: 100%;
    height: 100%;
    -webkit-object-fit: cover;
    object-fit: cover;
    display: block;
}

.campaign-info-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    z-index: 5;
}

.campaign-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.campaign-progress {
    font-size: 12px;
    opacity: 0.8;
}

.version-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    z-index: 7;
    pointer-events: none;
    opacity: 0.8;
}

/* -------------------------------------------------------------------------
   Legacy TV browsers (Samsung PHFN / Tizen 2.4 WebKit ~38)
   html.tv-legacy is set from index.html via UA / tizen / webOS detection.
   ------------------------------------------------------------------------- */
html.tv-legacy,
html.tv-legacy body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

html.tv-legacy #app-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    width: auto;
}

html.tv-legacy .loading-screen,
html.tv-legacy .pairing-screen,
html.tv-legacy .error-screen,
html.tv-legacy .client-login,
html.tv-legacy .storeplay-download-screen {
    height: 100%;
    width: 100%;
    min-height: 0;
}

html.tv-legacy .pairing-left {
    padding: 40px 48px;
}

html.tv-legacy .pairing-right {
    padding: 32px 28px;
}

html.tv-legacy .pairing-title {
    font-size: 2.6rem;
}

html.tv-legacy .pairing-subtitle {
    font-size: 1.15rem;
}

html.tv-legacy .device-code-section {
    padding: 22px;
    max-width: 100%;
    box-sizing: border-box;
}

html.tv-legacy .device-code-value {
    font-size: 2rem;
    letter-spacing: 4px;
}

html.tv-legacy .login-logo-wrap {
    padding: 18px 24px;
    margin-bottom: 28px;
    max-width: 100%;
    box-sizing: border-box;
}

html.tv-legacy .login-logo {
    max-width: 220px;
    max-height: 90px;
}

html.tv-legacy .qr-code-container {
    padding: 18px;
}

html.tv-legacy .qr-code-image {
    width: 300px;
    max-width: 100%;
}

html.tv-legacy .qr-code-svg {
    width: 300px;
    max-width: 100%;
}

html.tv-legacy .qr-code-svg svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Display renderer — portrait rotation compositing on Samsung/LG WebKit */
html.tv-legacy .dr-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    overflow: hidden;
}

/* Dynamic menu price / sold-out overlays (shared Tizen, webOS, Web). */
.dr-price-overlay {
    letter-spacing: 0.01em;
}

.dr-price-overlay--sold-out {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    /* Match admin MenuDisplay soldOutBlock — readable on menu art. */
    color: #ffffff !important;
    background: rgba(220, 20, 20, 0.95);
    padding: 0.08em 0.28em;
    border-radius: 0.12em;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

html.tv-legacy .dr-layout,
html.tv-legacy .dr-campaign-img-clip,
html.tv-legacy .dr-price-overlay-layer {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

html.tv-legacy .store-selection {
    background: #000000;
}

html.tv-legacy .store-container {
    background: rgba(24, 24, 24, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ecf0f1;
    max-height: 92%;
}

html.tv-legacy .store-container h2,
html.tv-legacy .store-container p {
    color: #ecf0f1;
}

html.tv-legacy .store-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.14);
}

html.tv-legacy .store-item h3 {
    color: #ffffff;
}

html.tv-legacy .store-item p {
    color: #b0b0b0;
}

html.tv-legacy .store-item.selected {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.12);
}

html.tv-legacy .store-item:focus {
    outline: 3px solid #3498db;
    border-color: #3498db;
}

html.tv-legacy .loading-message {
    font-size: 1.35rem;
}

html.tv-legacy button:focus {
    outline: 3px solid #3498db;
    outline-offset: 0;
}
