:root {
    --bg: #090a13;
    --ink: #eceefb;
    --muted: #9aa0bd;
    --line: rgba(255, 255, 255, .10);
    --glass: rgba(255, 255, 255, .06);
    --glass-hi: rgba(255, 255, 255, .10);
    --violet: #9d6bff;
    --violet-deep: #7c4dff;
    --mint: #3ee6b0;
    --rose: #ff6b7f;
    --font: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font: 400 15px/1.5 var(--font);

    background:
        radial-gradient(900px 600px at 8% -10%,
            rgba(124, 77, 255, .38),
            transparent 60%),
        radial-gradient(800px 600px at 105% 10%,
            rgba(40, 170, 220, .22),
            transparent 60%),
        radial-gradient(700px 500px at 60% 115%,
            rgba(255, 107, 127, .16),
            transparent 60%),
        var(--bg);

    background-attachment: fixed;
}

input[type="range"].field {
    --range-fill: 0%;
    appearance: none;
    -webkit-appearance: none;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    min-width: 0;
}

input[type="range"].field::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--violet) 0 var(--range-fill), rgba(255, 255, 255, .20) var(--range-fill) 100%);
    border: 1px solid rgba(255, 255, 255, .35);
}

input[data-k="appearance.cardOpacity"]::-webkit-slider-runnable-track {
    /* Account for the thumb center at both ends of its travel. */
    --range-fill: calc(7px + (100% - 14px) * var(--opacity-position, 0));
}

input[type="range"].field::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .20);
    border: 1px solid rgba(255, 255, 255, .35);
}

input[type="range"].field::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--violet);
}

input[type="range"].field::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: #91c7ff;
    border: 0;
}

input[type="range"].field::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #91c7ff;
    border: 0;
}

[hidden] {
    display: none !important;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--violet);
    outline-offset: 2px;
}

.glass {
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 20px;

    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .08),
        0 24px 50px -24px rgba(0, 0, 0, .7);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass {
        background: rgba(26, 28, 46, .94);
    }
}

.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;

    max-width: 1160px;
    margin: 0 auto;
    padding: 24px 16px 120px;
}

.side {
    position: sticky;
    top: 24px;
    align-self: start;

    padding: 18px;

    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.01em;

    display: flex;
    align-items: center;
    gap: 10px;
}

.brand img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
}

.brand {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.brand:hover {
    opacity: .9;
}

.nav h2 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);

    margin: 0 0 6px;
}

.nav+.nav {
    margin-top: -4px;
}

.nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    color: var(--ink);
    text-decoration: none;
    background: transparent;
    transition: background .18s, border-color .18s, transform .18s
}

.nav-link:hover {
    background: var(--glass);
    border-color: var(--line);
    transform: translateX(2px)
}

.nav-link::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--mint));
    box-shadow: 0 0 12px rgba(157, 107, 255, .35)
}

.nav-link[aria-current=page] {
    background: rgba(157, 107, 255, .16);
    border-color: rgba(157, 107, 255, .18)
}

main {
    min-width: 0;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    gap: 12px;
    flex-wrap: wrap;

    margin: 6px 4px 18px;
}

h1 {
    margin: 0;

    font-size: 1.7rem;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.sub {
    color: var(--muted);
    margin: 4px 0 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 7px 12px;

    border-radius: 999px;

    font-size: .82rem;

    background: var(--glass);
    border: 1px solid var(--line);
}

.pill i {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #ffc15e;
}

.pill.ok i {
    background: var(--mint);
    box-shadow: 0 0 10px var(--mint);
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;

    gap: 20px;
    align-items: start;
}

.col {
    display: flex;
    flex-direction: column;

    gap: 20px;
    min-width: 0;
}

.card {
    padding: 20px;
}

.card h3 {
    margin: 0 0 2px;
    font-size: 1.05rem;
}

.hint {
    color: var(--muted);
    font-size: .85rem;
    margin: 0 0 12px;
}

label {
    display: block;

    font-size: .85rem;
    font-weight: 600;

    margin: 14px 0 6px;
}

.chk {
    display: flex;
    align-items: center;

    gap: 10px;

    font-weight: 400;
    font-size: .95rem;

    margin: 8px 0;

    cursor: pointer;
}

.chk input {
    width: 18px;
    height: 18px;

    accent-color: var(--violet);
}

.field {
    width: 100%;

    padding: 11px 13px;

    border-radius: 12px;
    border: 1px solid var(--line);

    background: rgba(8, 9, 20, .55);
}

.field:hover {
    border-color: rgba(255, 255, 255, .2);
}

/* Campos de cores do Dynamic Overlay */
#alert-style-card input[type="color"].field {
    display: block;
    width: 100%;
    height: 42px;
    padding: 5px;
    margin-top: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 9, 20, .75);
    cursor: pointer;
    overflow: hidden;
}

/* Chrome, Edge e navegadores baseados em Chromium */
#alert-style-card input[type="color"].field::-webkit-color-swatch-wrapper {
    padding: 0;
}

#alert-style-card input[type="color"].field::-webkit-color-swatch {
    border: none;
    border-radius: 7px;
}

/* Firefox */
#alert-style-card input[type="color"].field::-moz-color-swatch {
    border: none;
    border-radius: 7px;
}

/* Slider de opacidade */
#alert-style-card input[type="range"].field {
    display: block;
    width: 100%;
    margin-top: 6px;
}

select.field option {
    background: #14162a;
    color: var(--ink);
}

.row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.row .field {
    flex: 1;
    min-width: 0;
}

.two {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

.btn {
    padding: 11px 18px;

    border-radius: 12px;
    border: 0;

    font-weight: 600;

    cursor: pointer;

    background: var(--rk-primary);

    color: #fff;
    box-shadow: none;
}

.btn:hover {
    filter: brightness(1.1);
}

.btn.primary:hover:not(:disabled) {
    background: var(--rk-primary-hover);
    filter: none;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: none;
}

.btn.ghost {
    background: var(--glass);

    box-shadow: none;

    border: 1px solid var(--line);
}

.btn.sm {
    padding: 7px 12px;

    font-size: .82rem;

    background: var(--glass);

    box-shadow: none;

    border: 1px solid var(--line);
}

#alert-background-choose {
    margin-block: 12px 8px;
}

#alert-background-framing {
    min-inline-size: 0;
    margin: 16px 0 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

#alert-background-framing legend {
    padding-inline: 6px;
    font-weight: 600;
}

.alert-framing-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: 10px 16px;
    margin-bottom: 10px;
}

.alert-framing-grid output {
    float: inline-end;
    font-variant-numeric: tabular-nums;
}

.premium-locked {
    opacity: .55;
}

.premium-locked :disabled {
    cursor: not-allowed;
}

.premium-lock-hint {
    padding: 12px;
    border: 1px solid #554568;
    border-radius: 10px;
    background: #201a2d;
    color: #e5d5ff;
}

.btn.del {
    color: var(--rose);
}

.btn.del:hover {
    background: rgba(255, 107, 127, .1);
}

.item {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 9px 0;

    border-top: 1px solid var(--line);
}

.item .nm {
    flex: 1;
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item small {
    display: block;

    color: var(--muted);

    overflow: hidden;
    text-overflow: ellipsis;
}

.item img {
    width: 36px;
    height: 36px;

    border-radius: 8px;

    object-fit: contain;

    background: rgba(255, 255, 255, .08);

    flex: none;
}

#livepix-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

#livepix-status .nm {
    width: 100%;
    min-width: 0;
}

#livepix-status small {
    display: block;
    width: 100%;
    color: var(--muted);
    line-height: 1.45;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

#livepix-status .livepix-account {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

#twitch-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

#twitch-status .nm {
    width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

#twitch-status small {
    display: block;
    width: 100%;
    color: var(--muted);
    line-height: 1.45;
    white-space: normal;
}

.empty {
    padding: 10px 0 0;

    color: var(--muted);

    font-size: .9rem;
}

.alr {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview {
    position: sticky;
    top: 24px;

    padding: 20px;
}

.pvbox {
    --preview-inset: 16px;
    position: relative;

    width: 100%;
    height: calc(150px + 2 * var(--preview-inset));
    padding: var(--preview-inset);
    transition: height .35s ease;

    border-radius: 14px;

    overflow: hidden;

    background:
        repeating-conic-gradient(#1a1a1a 0 25%,
            #121212 0 50%) 0 0 / 20px 20px;
}

.pvbox iframe {
    position: absolute;

    top: var(--preview-inset);
    left: var(--preview-inset);

    width: 520px;
    height: 150px;

    border: 0;

    transform-origin: 0 0;

    color-scheme: light;
    background: transparent;
}

.bar {
    position: fixed;

    left: 50%;
    bottom: 20px;

    transform: translateX(-50%);

    z-index: 20;

    display: flex;
    align-items: center;

    gap: 14px;

    padding: 12px 14px 12px 20px;

    border-radius: 999px;

    width: max-content;
    max-width: calc(100vw - 24px);
}

.center {
    max-width: 440px;

    margin: 12vh auto;

    padding: 36px 28px;

    text-align: center;
}

.center p {
    color: var(--muted);
}

a.btn {
    display: inline-block;
    text-decoration: none;
}

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

    .preview {
        position: static;
    }
}

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

    .side {
        position: static;
    }

    .me {
        margin-top: 0;
    }
}

@media (prefers-reduced-motion:reduce) {
    * {
        transition: none !important;
    }
}

/* Alertas: layout compacto em cards, preservando a paleta original do Streamya */
.shell {
    max-width: 1600px;
}

#alert-style-card {
    grid-column: 1 / -1;
    padding: 22px;
}

#alert-style-card>h3 {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

#alert-style-card>#event-sound-settings {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px !important;
    margin-top: 12px;
}

#alert-style-card>label[for="alert-radius"] {
    margin-top: 18px;
}

#alert-style-card>.row:has(#alert-radius) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 9, 20, .35);
}

#alert-radius-value {
    display: block;
    text-align: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(8, 9, 20, .5);
}

.event-sound-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "title preview"
        "source source"
        "status status"
        "volume-label volume-label"
        "volume-slider volume-slider";
    gap: 8px 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(8, 9, 20, .35);
    transition: border-color .18s ease, background .18s ease;
}

.event-sound-row:hover {
    border-color: color-mix(in srgb, var(--violet) 48%, var(--line));
    background: rgba(255, 255, 255, .035);
}

.event-sound-row>label:first-child {
    grid-area: title;
    align-self: center;
    margin: 0;
    font-size: .98rem;
}

.event-sound-row>.row:has(.event-sound-preview) {
    grid-area: preview;
    justify-content: flex-end;
    gap: 6px;
}

.event-sound-row .event-sound-preview,
.event-sound-row .event-sound-remove {
    padding: 7px 10px;
    white-space: nowrap;
    font-size: .78rem;
}

.event-sound-row .event-sound-source {
    grid-area: source;
    padding: 9px 11px;
    border-radius: 9px;
}

.event-sound-row .event-sound-status {
    grid-area: status;
    margin: 0;
    min-height: 18px;
    overflow-wrap: anywhere;
    font-size: .78rem;
}

.event-sound-row>label:has(.event-sound-volume-label) {
    grid-area: volume-label;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 0;
    font-size: .82rem;
    font-weight: 500;
}

.event-sound-row .event-sound-volume {
    grid-area: volume-slider;
    margin-top: 0;
    width: 100%;
    min-width: 0;
    align-self: center;
}

.event-sound-volume-label {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px 8px;
    background: rgba(8, 9, 20, .5);
}

#alert-style-card input[type="range"].field::-webkit-slider-thumb {
    background: var(--violet);
    box-shadow: 0 0 0 3px rgba(157, 107, 255, .15);
}

#alert-style-card input[type="range"].field::-moz-range-thumb {
    background: var(--violet);
    box-shadow: 0 0 0 3px rgba(157, 107, 255, .15);
}

.support-nav {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.premium-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(157, 107, 255, .18);
    color: #c5a6ff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em
}

.premium-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    border-color: rgba(157, 107, 255, .28);
    background: rgba(157, 107, 255, .08);
    transition: background .2s ease, border-color .2s ease;
}

.premium-link:hover {
    background: rgba(157, 107, 255, .17);
    border-color: rgba(157, 107, 255, .55);
}

.premium-link.premium-active {
    color: #3ee6b0;
    border-color: rgba(62, 230, 176, .35);
    background: rgba(62, 230, 176, .09);
}

.premium-link.premium-active:hover {
    background: rgba(62, 230, 176, .15);
    border-color: rgba(62, 230, 176, .55);
}

.premium-link span {
    font-size: 16px;
    line-height: 1;
}

.premium-link::before,
.support-link::before {
    display: none;
    content: none;
}

.beta-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 183, 77, .15);
    color: #ffbd66;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.nav-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.nav-link span:not(.nav-icon) {
    min-width: 0;
}

@media (max-width: 1050px) {
    #alert-style-card>#event-sound-settings {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .shell {
        max-width: 100%;
    }

    #alert-style-card {
        padding: 16px;
    }

    .event-sound-row {
        padding: 13px;
    }
}
