:root {
    --primary: #0D3692;
    --accent: #F5B400;
    --bg: #0F172A;
    --surface: #1E293B;
    --nav-h: 3.25rem;
    --topbar-h: 2.5rem;
}

body {
    background-color: var(--bg);
}

body.dx-has-topbar {
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}

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

.drag-handle:active,
.fav-drag-handle:active {
    cursor: grabbing;
}

#yt-player iframe {
    width: 100%;
    height: 100%;
}

[x-cloak] {
    display: none !important;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 2px;
}

/* —— Compact UI —— */
.dx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.3125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.dx-btn-icon {
    padding: 0.375rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
    font-size: 0.875rem;
}

.dx-btn-ghost {
    background: var(--surface);
    border-color: rgba(100, 116, 139, 0.45);
    color: #cbd5e1;
}

.dx-btn-ghost:hover {
    border-color: rgba(245, 180, 0, 0.45);
    color: #fff;
}

.dx-btn-accent {
    background: rgba(245, 180, 0, 0.15);
    border-color: rgba(245, 180, 0, 0.35);
    color: var(--accent);
}

.dx-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.dx-btn-primary {
    background: var(--primary);
    color: #fff;
}

.dx-btn-fill-accent {
    background: var(--accent);
    color: var(--bg);
}

.dx-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid rgba(100, 116, 139, 0.45);
    border-radius: 0.5rem;
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    line-height: 1.25;
}

.dx-input:focus {
    outline: none;
    border-color: var(--accent);
}

.dx-select {
    background: var(--surface);
    border: 1px solid rgba(100, 116, 139, 0.45);
    border-radius: 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

.dx-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.4375rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid rgba(100, 116, 139, 0.45);
    background: var(--surface);
    color: #94a3b8;
    max-width: 6.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dx-chip-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.dx-tabs {
    display: flex;
    flex: 1;
    gap: 0.125rem;
    padding: 0.125rem;
    background: var(--surface);
    border: 1px solid rgba(100, 116, 139, 0.45);
    border-radius: 0.625rem;
}

.dx-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.0625rem;
    padding: 0.3125rem 0.125rem;
    font-size: 0.5625rem;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 0.4375rem;
    color: #94a3b8;
    transition: background-color 0.15s, color 0.15s;
}

.dx-tab-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.dx-tab-active {
    background: var(--primary);
    color: #fff;
}

.dx-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    max-width: 32rem;
    margin: 0 auto;
    display: flex;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem calc(0.375rem + env(safe-area-inset-bottom, 0px));
    background: rgba(30, 41, 59, 0.96);
    border-top: 1px solid rgba(100, 116, 139, 0.35);
    backdrop-filter: blur(10px);
}

.dx-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.0625rem;
    padding: 0.3125rem 0.125rem;
    border-radius: 0.5rem;
    font-size: 0.5625rem;
    font-weight: 600;
    line-height: 1.1;
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.dx-nav-icon {
    font-size: 1rem;
    line-height: 1;
}

.dx-nav-accent {
    background: var(--accent);
    color: var(--bg);
}

.dx-nav-primary {
    background: var(--primary);
    color: #fff;
}

.dx-nav-ghost {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(100, 116, 139, 0.4);
    color: #cbd5e1;
}

.dx-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

/* —— App top bar (auth) —— */
.dx-app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    box-sizing: border-box;
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.5rem;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(100, 116, 139, 0.35);
    backdrop-filter: blur(8px);
}

.dx-app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #e2e8f0;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.dx-app-brand:hover {
    color: var(--accent);
}

.dx-app-brand-icon {
    font-size: 1rem;
    line-height: 1;
}

.dx-app-brand-text {
    display: none;
}

@media (min-width: 380px) {
    .dx-app-brand-text {
        display: inline;
    }
}

.dx-app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    min-width: 0;
    justify-content: flex-end;
    overflow: hidden;
}

.dx-app-topbar-actions a.dx-auth-short {
    display: none;
}

@media (max-width: 420px) {
    .dx-app-topbar-actions a.dx-auth-full {
        display: none;
    }

    .dx-app-topbar-actions a.dx-auth-short {
        display: inline;
    }
}

.dx-app-user {
    color: #94a3b8;
    font-size: 0.6875rem;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.25rem;
}

@media (min-width: 480px) {
    .dx-app-user {
        max-width: 8rem;
    }
}

.dx-app-topbar-actions a {
    color: #94a3b8;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    text-decoration: none;
    white-space: nowrap;
}

.dx-app-topbar-actions a:hover {
    color: var(--accent);
}

.dx-app-topbar-actions a.text-accent {
    color: var(--accent);
}

.dx-page {
    min-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
}

.dx-sticky-below-topbar {
    position: sticky;
    z-index: 20;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}

.dx-flash {
    position: fixed;
    z-index: 45;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 0.375rem);
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    max-width: 32rem;
    margin: 0 auto;
}

.dx-room-header {
    padding: 0.5rem 0.75rem;
}

.dx-panel-head {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(100, 116, 139, 0.35);
}

.dx-list-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.4375rem 0.5rem;
    border-radius: 0.625rem;
    border: 1px solid rgba(100, 116, 139, 0.25);
    background: var(--surface);
}

@media (min-width: 400px) {
    .dx-list-item {
        flex-wrap: nowrap;
    }
}

.dx-has-bottom-nav {
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

.dx-overlay-below-topbar {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}
