:root {
    --bg-main: #121212;
    --bg-panel: #1e1e1e;
    --bg-header: #181818;
    --accent: #ff6b00;
    --accent-hover: #ff8533;
    --border: #2e2e2e;
    --text-main: #f0f0f0;
    --text-muted: #999999;
}

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

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

/* AVISO DE RESOLUÇÃO MÍNIMA (1280x768) */
#screen-block {
    display: none;
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #1d1d1d 0%, #121212 75%);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.block-card {
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 14px;
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.block-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(255, 107, 0, 0.12);
    border: 1px solid rgba(255, 107, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: var(--accent);
    font-size: 28px;
}

.block-card h2 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
    line-height: 1.3;
}

.block-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 16px;
}

.res-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #121212;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 22px;
}

.res-badge span {
    color: var(--accent);
    font-weight: 700;
}

.btn-back-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-back-home:hover {
    background: var(--accent-hover);
}

.btn-back-home:active {
    transform: scale(0.98);
}

@media (max-width: 1279px), (max-height: 609px) {
    #app-wrapper {
        display: none !important;
    }
    #screen-block {
        display: flex !important;
    }
}

/* ESTRUTURA PRINCIPAL DESKTOP */
#app-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.top-bar {
    height: 44px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    flex-shrink: 0;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.brand img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

.brand span {
    color: var(--accent);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-tool {
    background: #252525;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-tool:hover {
    border-color: var(--accent);
    color: #fff;
}

.btn-tool.active-preset {
    background: rgba(255, 107, 0, 0.16);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.btn-yt-live {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 0 28px;
    box-shadow: none;
    height: 28px;
    font-size: 28px;
    line-height: 1;
    color: #ff2e2e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-yt-live span {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.btn-yt-live:hover,
.btn-yt-live.has-active-audio {
    background: transparent;
    border: none;
    color: #ff5252;
}


/* ÁREA DE TRABALHO MODULAR */
#workspace {
    flex: 1;
    width: 100%;
    height: calc(100vh - 44px);
    display: flex;
    padding: 4px;
    background: var(--bg-main);
    overflow: hidden;
}

/* PAINEL INDIVIDUAL */
.pane {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 120px;
}

.pane.footer-ticker-pane {
    min-height: 68px;
}

.pane:hover {
    border-color: #444;
}

.pane-header {
    height: 30px;
    background: #222222;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    flex-shrink: 0;
    gap: 6px;
}

.pane-badge {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 0 4px;
    user-select: none;
}

.pane-select {
    flex: 1;
    min-width: 0;
    background: #141414;
    color: #f0f0f0;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.pane-select:focus {
    border-color: var(--accent);
}

.pane-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.pane-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.pane-btn:hover {
    background: #333;
    color: #fff;
}

.pane-body {
    flex: 1;
    width: 100%;
    height: calc(100% - 30px);
    position: relative;
    background: #121212;
    min-width: 0;
}

.pane-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* DIVISÓRIAS ARRASTÁVEIS (SPLITTERS) */
.gutter-col {
    width: 6px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
}

.gutter-col::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    width: 2px;
    height: 36px;
    background: #3a3a3a;
    border-radius: 2px;
}

.gutter-col:hover, .gutter-col.dragging {
    background: rgba(255, 107, 0, 0.25);
}

.gutter-col:hover::after, .gutter-col.dragging::after {
    background: var(--accent);
}

.gutter-row {
    height: 6px;
    cursor: row-resize;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
}

.gutter-row::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 2px;
    transform: translateX(-50%);
    height: 2px;
    width: 36px;
    background: #3a3a3a;
    border-radius: 2px;
}

.gutter-row:hover, .gutter-row.dragging {
    background: rgba(255, 107, 0, 0.25);
}

.gutter-row:hover::after, .gutter-row.dragging::after {
    background: var(--accent);
}

.grid-2x2-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}

.right-quad-area {
    display: flex;
    height: 100%;
    min-width: 0;
}

.layout-5b-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.layout-5b-top {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

/* JANELA FLUTUANTE DE LIVES DO YOUTUBE (1 A 3 PLAYERS INDEPENDENTES) */
#yt-live-float {
    position: fixed;
    top: 0px;
    right: 16px;
    width: 440px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 8px);
    background: #191919;
    border: 1px solid #363636;
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.72);
    z-index: 9000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#yt-live-float.is-open {
    display: flex;
}

.yt-float-header {
    height: 34px;
    background: #232323;
    border-bottom: 1px solid #323232;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 10px;
    cursor: move;
    user-select: none;
    gap: 8px;
    flex-shrink: 0;
}

.yt-float-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.yt-float-title i {
    color: #ff2e2e;
    font-size: 14px;
}

.yt-float-audio-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(255, 107, 0, 0.14);
    border: 1px solid rgba(255, 107, 0, 0.35);
    border-radius: 4px;
    padding: 1px 6px;
    display: none;
}

.yt-float-audio-tag.visible {
    display: inline-block;
}

.yt-float-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.yt-float-btn {
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #3d3d3d;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    white-space: nowrap;
}

.yt-float-btn:hover {
    border-color: var(--accent);
    color: #fff;
}

.yt-float-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.yt-float-btn.is-playing {
    border-color: #2ecc71;
    color: #58e896;
    background: rgba(46, 204, 113, 0.14);
}

.yt-float-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.yt-float-top-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.yt-slots-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.yt-top-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.yt-add-player-btn {
    border-color: rgba(255, 107, 0, 0.45);
    color: var(--accent);
    font-weight: 600;
}

.yt-add-player-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.yt-remove-slot-btn {
    padding: 2px 6px;
    font-size: 10px;
}

.yt-slot-card {
    background: #151515;
    border: 1px solid #2b2b2b;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yt-slot-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.yt-selector-row,
.yt-direct-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.yt-channel-select {
    flex: 1;
    min-width: 0;
    background: #121212;
    color: #f0f0f0;
    border: 1px solid #363636;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.yt-channel-select:focus {
    border-color: var(--accent);
}

.yt-direct-input {
    flex: 1;
    min-width: 0;
    background: #121212;
    color: #f0f0f0;
    border: 1px solid #363636;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 11px;
    outline: none;
}

.yt-direct-input:focus {
    border-color: var(--accent);
}

.yt-slot-player {
    width: 100%;
    height: 200px;
    background: #0d0d0d;
    border: 1px solid #282828;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-slot-player iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.yt-player-placeholder {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    line-height: 1.4;
}

/* PROTEÇÃO DE MOUSE DURANTE O ARRASTE */
body.is-resizing iframe {
    pointer-events: none !important;
}
body.is-resizing {
    user-select: none;
}

/* SCROLLBAR WEB-KIT DISCRETA (JANELA FLUTUANTE / PAINÉIS) */
.yt-float-body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.yt-float-body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: #141414;
    border-radius: 4px;
}

.yt-float-body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background: #363636;
    border-radius: 4px;
    border: 1px solid #1e1e1e;
}

.yt-float-body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.btn-yt-help {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0 0 0 2px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #9a9a9a);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.btn-yt-help:hover {
    color: #ff6b00;
    transform: scale(1.08);
}

.yt-help-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.yt-help-backdrop.is-open {
    display: flex;
}

.yt-help-card {
    width: 100%;
    max-width: 520px;
    background: #181818;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
    color: #e6e6e6;
    overflow: hidden;
}

.yt-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1e1e1e;
    border-bottom: 1px solid #2b2b2b;
}

.yt-help-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

.yt-help-header h3 i {
    color: #ff2e2e;
}

.yt-help-close {
    background: transparent;
    border: none;
    color: #aaaaaa;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.yt-help-close:hover {
    color: #ff6b00;
}

.yt-help-body {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #d4d4d4;
}

.yt-help-body p {
    margin: 0 0 10px 0;
}

.yt-help-body ul {
    margin: 0;
    padding-left: 18px;
}

.yt-help-body li {
    margin-bottom: 6px;
}

.yt-help-body code {
    background: #121212;
    border: 1px solid #2c2c2c;
    border-radius: 3px;
    padding: 1px 5px;
    color: #ff6b00;
    font-size: 12px;
}

/* BOTÃO DE CELULAR E POPOVER FLUTUANTE QR CODE DA LIVE */
.yt-phone-btn {
    padding: 4px 7px;
    font-size: 12px;
    justify-content: center;
}

.yt-phone-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.yt-phone-btn.is-ready:not(:disabled) {
    background: rgba(255, 107, 0, 0.16);
    border-color: var(--accent);
    color: var(--accent);
}

.yt-qr-popover {
    display: none;
    position: fixed;
    top: 84px;
    right: 24px;
    width: 224px;
    background: #1b1b1b;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.82);
    z-index: 9500;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-align: center;
}

.yt-qr-popover.is-open {
    display: flex;
}

.yt-qr-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.yt-qr-close {
    background: #2a2a2a;
    color: #ddd;
    border: 1px solid #3d3d3d;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1.2;
}

.yt-qr-close:hover {
    border-color: var(--accent);
    color: #fff;
}

.yt-qr-box {
    width: 172px;
    height: 172px;
    background: #ffffff;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-qr-box img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.yt-qr-caption {
    font-size: 11px;
    color: #bdbdbd;
    line-height: 1.35;
}

.yt-float-btn.is-muted {
    border-color: #ff2e2e;
    color: #ff6b6b;
    background: rgba(255, 46, 46, 0.16);
}