
:root {
    color-scheme: dark;
    --base-background: #060914;
    --base-surface: #10192f;
    --base-surface-elevated: #17233d;
    --base-border: rgba(255, 255, 255, 0.08);
    --base-text: #f5f7ff;
    --base-muted: #9aa6c8;
    --base-accent: #7c63ff;
    --base-positive: #5be9b9;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 10px 24px rgba(4, 8, 18, 0.35);
    --shadow-md: 0 24px 60px rgba(5, 8, 19, 0.55);
    --transition: 180ms ease;

    --user-background: var(--base-background);
    --user-surface: var(--base-surface);
    --user-surface-elevated: var(--base-surface-elevated);
    --user-accent: var(--base-accent);

    --color-background: var(--user-background);
    --color-surface: var(--user-surface);
    --color-surface-elevated: var(--user-surface-elevated);
    --color-border: var(--base-border);
    --color-text: var(--base-text);
    --color-muted: var(--base-muted);
    --color-accent: var(--user-accent);
    --color-positive: var(--base-positive);
    --base-negative: #ff6b6b;
    --base-warning: #ffb347;
    --color-negative: var(--base-negative);
    --color-warning: var(--base-warning);
}

[data-theme="light"] {
    color-scheme: light;
    --base-background: #f4f6ff;
    --base-surface: #ffffff;
    --base-surface-elevated: #f7f9ff;
    --base-border: rgba(14, 23, 56, 0.1);
    --base-text: #0b1325;
    --base-muted: #4d5b7a;
    --base-accent: #5b5ef8;
    --base-positive: #008f5b;
    --user-background: var(--base-background);
    --user-surface: var(--base-surface);
    --user-surface-elevated: var(--base-surface-elevated);
    --user-accent: var(--base-accent);
    --color-border: rgba(14, 23, 56, 0.12);
    --base-negative: #d93232;
    --base-warning: #f6a700;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    font-family: 'Outfit', 'Inter', 'Segoe UI', system-ui, sans-serif;
    height: 100vh;
    background: radial-gradient(circle at 20% 20%, rgba(124, 99, 255, 0.35), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(91, 208, 255, 0.25), transparent 45%),
        var(--color-background);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 3px solid var(--color-accent);
}

.login-header h1 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.login-header p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-muted);
}

.login-field input {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition);
}

.login-field input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.05);
}

.login-button {
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-accent);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.login-button:hover {
    background: #8c73ff;
    transform: translateY(-1px);
}

.login-button:active {
    transform: translateY(0);
}

.login-error {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: clamp(20px, 3vw, 32px);
    gap: clamp(20px, 2.5vw, 32px);
    overflow: hidden;
}

.app-notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 3vw, 20px);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-sm);
    color: inherit;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + clamp(16px, 3vw, 28px));
    left: 50%;
    width: min(640px, calc(100% - clamp(40px, 6vw, 64px)));
    max-width: calc(100% - clamp(32px, 6vw, 72px));
    transition: transform var(--transition), opacity var(--transition);
    transform: translate(-50%, -24px);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.app-notification.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.app-notification[hidden] {
    display: none;
}

.app-notification[data-tone="success"] {
    border-color: rgba(91, 233, 185, 0.4);
    background: rgba(91, 233, 185, 0.14);
    color: var(--color-positive);
}

.app-notification[data-tone="warning"] {
    border-color: rgba(255, 179, 71, 0.4);
    background: rgba(255, 179, 71, 0.14);
    color: var(--color-warning);
}

.app-notification[data-tone="error"] {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.16);
    color: var(--color-negative);
}

.app-notification__content {
    flex: 1 1 auto;
}

.notification-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    padding: 0.4rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.notification-close:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.notification-close .material-symbols-rounded {
    font-size: 1.2rem;
}

[data-theme="light"] .notification-close {
    background: rgba(14, 23, 56, 0.08);
}

[data-theme="light"] .notification-close:hover {
    background: rgba(14, 23, 56, 0.16);
}

.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
    gap: clamp(16px, 3vw, 32px);
    align-items: center;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 2.5vw, 28px);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.brand-avatar {
    width: clamp(56px, 6vw, 72px);
    height: clamp(56px, 6vw, 72px);
    border-radius: 24px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.brand-meta h1 {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 600;
}

.brand-meta p {
    margin: 8px 0 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.connection {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    align-self: stretch;
}

.connection label {
    font-weight: 600;
    color: var(--color-muted);
    margin: 0;
    min-width: 64px;
}

.connection-fields {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 320px;
    min-width: 240px;
}

.connection-fields input {
    flex: 1 1 200px;
    min-width: 0;
}

input,
button,
select {
    font-family: inherit;
    font-size: 0.98rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    color: inherit;
    padding: 0.65rem 0.9rem;
    transition: border var(--transition), transform var(--transition), background var(--transition);
}

input:focus,
select:focus,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#connect {
    background: linear-gradient(135deg, var(--color-accent), rgba(123, 128, 255, 0.85));
    color: #050711;
    border: none;
    font-weight: 600;
    box-shadow: 0 14px 40px rgba(124, 99, 255, 0.35);
}

#disconnect {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.header-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    align-self: stretch;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.status-indicator[data-state="online"] {
    background: rgba(91, 233, 185, 0.16);
    border-color: rgba(91, 233, 185, 0.42);
    color: var(--color-positive);
}

.status-indicator[data-state="connecting"] {
    background: rgba(124, 99, 255, 0.18);
    border-color: rgba(124, 99, 255, 0.45);
    color: var(--color-accent);
}

.status-indicator[data-state="error"] {
    background: rgba(255, 107, 107, 0.18);
    border-color: rgba(255, 107, 107, 0.42);
    color: var(--color-negative);
}

.ghost-button {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: inherit;
}

.ghost-button:hover:not(:disabled),
button:hover:not(:disabled) {
    transform: translateY(-1px);
}

/* Tabs Navigation */
.tabs-navigation {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 12px clamp(18px, 3vw, 26px);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.tabs-list {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.tab-btn .material-symbols-rounded {
    font-size: 1.1rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
}

.tab-btn.active {
    background: rgba(124, 99, 255, 0.16);
    border-color: rgba(124, 99, 255, 0.45);
    color: var(--color-accent);
}

.tab-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: rgba(124, 99, 255, 0.12);
    border: 1px dashed rgba(124, 99, 255, 0.35);
    color: var(--color-accent);
    cursor: pointer;
    transition: all var(--transition);
}

.tab-add-btn:hover {
    background: rgba(124, 99, 255, 0.2);
    border-color: rgba(124, 99, 255, 0.5);
    transform: scale(1.05);
}

.tab-add-btn .material-symbols-rounded {
    font-size: 1.2rem;
}

.tabs-container {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    height: 100%;
    overflow-y: auto;
}

.tab-content.active {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Tab Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

.chat-header {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.15);
    align-items: center;
}

.chat-search {
    flex: 1 1 auto;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition);
}

.chat-search:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: clamp(20px, 3vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-accent), rgba(123, 128, 255, 0.85));
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 99, 255, 0.4);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.scroll-to-bottom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(124, 99, 255, 0.5);
}

.scroll-to-bottom-btn .material-symbols-rounded {
    font-size: 1.5rem;
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: slideIn 0.2s ease;
    transition: background var(--transition);
    padding: 8px;
    border-radius: var(--radius-sm);
    margin: -8px;
}

.chat-message.highlight {
    background: rgba(124, 99, 255, 0.2);
    border: 1px solid rgba(124, 99, 255, 0.4);
}

.chat-message.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(124, 99, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message-content {
    flex: 1 1 auto;
    min-width: 0;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.chat-message-sender {
    font-weight: 600;
    font-size: 1rem;
}

.chat-message-time {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.chat-message-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
    word-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.chat-emote {
    height: 28px;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    margin: 0 2px;
}

.chat-badge {
    display: inline-block;
    font-size: 0.9rem;
    margin-right: 4px;
    vertical-align: middle;
}

.chat-badge-img {
    height: 18px;
    width: auto;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

.chat-messages::-webkit-scrollbar {
    width: 10px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
    background-clip: padding-box;
}

/* Games Tab Styles */
.games-container {
    padding: clamp(24px, 3vw, 40px);
}

.games-header {
    text-align: center;
    margin-bottom: clamp(32px, 4vw, 48px);
}

.games-header h2 {
    margin: 0 0 8px 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 600;
}

.games-description {
    margin: 0;
    color: var(--color-muted);
    font-size: 1rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: clamp(20px, 3vw, 32px);
    margin-bottom: 32px;
}

.game-card {
    background: var(--color-surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: clamp(24px, 3vw, 32px);
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(124, 99, 255, 0.4);
}

.game-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: rgba(124, 99, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-icon .material-symbols-rounded {
    font-size: 3rem;
    color: var(--color-accent);
}

.game-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.game-card p {
    margin: 0 0 20px 0;
    color: var(--color-muted);
    font-size: 0.9rem;
    flex-grow: 1;
}

.game-play-btn {
    width: 100%;
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--color-accent), rgba(123, 128, 255, 0.85));
    color: #050711;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.game-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 99, 255, 0.4);
}

/* Game Dialog Styles */
.game-dialog {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: min(1400px, calc(100vw - 48px));
    width: 90vw;
    max-height: calc(100vh - 48px);
    background: transparent;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.game-dialog::backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.game-dialog-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 48px);
}

.game-dialog .dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(20px, 3vw, 32px);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.game-dialog .dialog-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.game-dialog .dialog-header .ghost-button {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.game-canvas {
    flex: 1;
    min-height: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 20px);
    overflow-y: auto;
    will-change: contents;
    transform: translateZ(0);
}

/* Wheel Game Styles */
.wheel-game-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.wheel-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wheel-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.wheel-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-size: 0.95rem;
}

.wheel-add-btn {
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.wheel-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 99, 255, 0.4);
}

.wheel-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.wheel-option-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(124, 99, 255, 0.15);
    border: 1px solid rgba(124, 99, 255, 0.3);
    border-radius: 999px;
    color: var(--color-text);
    font-size: 0.9rem;
}

.wheel-option-remove {
    background: none;
    border: none;
    color: var(--color-negative);
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}

.wheel-option-remove:hover {
    background: rgba(255, 107, 107, 0.2);
}

.wheel-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.wheel-canvas-container {
    position: relative;
    width: 400px;
    height: 400px;
    contain: layout style paint;
}

.wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    will-change: transform;
    transform: translateZ(0);
}

.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 30px solid var(--color-accent);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 10;
}

.wheel-spin-btn {
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--color-accent), rgba(123, 128, 255, 0.85));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 8px 24px rgba(124, 99, 255, 0.4);
}

.wheel-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(124, 99, 255, 0.5);
}

.wheel-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wheel-result {
    text-align: center;
    padding: 20px;
    background: rgba(124, 99, 255, 0.15);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.wheel-result h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: var(--color-accent);
}

.wheel-result p {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Poll Game Styles */
.poll-game {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.poll-setup {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.poll-setup .field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-setup label {
    font-weight: 600;
    font-size: 0.95rem;
}

.poll-setup input,
.poll-setup textarea {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.poll-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.poll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}

.poll-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--color-accent);
}

.poll-votes {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.poll-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.poll-option-label {
    font-weight: 600;
}

.poll-option-count {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.poll-option-bar {
    height: 32px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.poll-option-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), rgba(124, 99, 255, 0.6));
    border-radius: var(--radius-sm);
    transition: width 0.4s ease;
}

.poll-stats {
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    margin-top: 24px;
}

/* Word Game Styles */
.word-game {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.word-setup,
.word-playing,
.word-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.word-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(124, 99, 255, 0.15);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: 16px;
}

.word-letters-display h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-accent);
    letter-spacing: 2px;
}

.word-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-positive);
}

.word-timer .material-symbols-rounded {
    font-size: 2rem;
}

.word-leaderboard {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
}

.word-leaderboard h4 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.word-submissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-submission {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition);
}

.word-submission.winner {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
}

.word-submission .rank {
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 32px;
}

.word-submission .submission-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.word-submission .word-text {
    color: var(--color-accent);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.word-submission .word-length {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.word-winner {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(124, 99, 255, 0.15));
    border: 2px solid #ffd700;
    border-radius: var(--radius-lg);
}

.word-winner h2 {
    margin: 16px 0;
    font-size: 2rem;
    color: #ffd700;
}

.word-final-standings {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
}

.word-final-standings h4 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.standings-item {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.standings-item .rank {
    font-weight: 700;
    font-size: 1.1rem;
}

.standings-item .word {
    color: var(--color-accent);
    font-weight: 600;
}

.standings-item .length {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* Raffle Game Styles */
.raffle-game {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.raffle-setup,
.raffle-drawing,
.raffle-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.raffle-info {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.raffle-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 32px;
    background: rgba(124, 99, 255, 0.15);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
}

.raffle-stat-card .material-symbols-rounded {
    font-size: 3rem;
    color: var(--color-accent);
}

.raffle-stat-card strong {
    font-size: 2.5rem;
    color: var(--color-accent);
    display: block;
}

.raffle-stat-card p {
    margin: 0;
    color: var(--color-muted);
}

.raffle-drawing {
    align-items: center;
    padding: 60px 20px;
}

.raffle-drum {
    text-align: center;
}

.raffle-drum .material-symbols-rounded {
    font-size: 6rem;
    color: var(--color-accent);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.raffle-drum h3 {
    margin-top: 24px;
    font-size: 1.5rem;
}

.raffle-winners {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(124, 99, 255, 0.15));
    border: 2px solid #ffd700;
    border-radius: var(--radius-lg);
}

.raffle-winners h2 {
    margin: 16px 0 32px 0;
    font-size: 2rem;
}

#winners-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.winner-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.winner-medal {
    font-size: 2rem;
}

.winner-name {
    font-size: 1.5rem;
    color: var(--color-accent);
}

/* Guess Game Styles */
.guess-game {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.guess-setup,
.guess-playing,
.guess-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.guess-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: rgba(124, 99, 255, 0.15);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: 16px;
}

.guess-range h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
}

.guess-range p {
    margin: 0;
    color: var(--color-muted);
    font-size: 1.1rem;
}

.guess-leaderboard {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
}

.guess-leaderboard h4 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.guess-submissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guess-submission {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.guess-submission.winner {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
}

.guess-submission .guess-number {
    color: var(--color-accent);
    font-size: 1.1rem;
    font-weight: 600;
}

.guess-submission .guess-distance {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.guess-winner {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(124, 99, 255, 0.15));
    border: 2px solid #00ff88;
    border-radius: var(--radius-lg);
}

.guess-winner h2 {
    margin: 16px 0;
    font-size: 2rem;
    color: #00ff88;
}

.guess-reveal {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    font-size: 1.3rem;
}

.guess-reveal strong {
    color: var(--color-accent);
    font-size: 2rem;
}

.guess-final-standings {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
}

.guess-final-standings h4 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

/* Word Puzzle Game Styles */
.word-puzzle-game {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

/* Chat Codenames Game Styles */
.codenames-game {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.codenames-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(124, 99, 255, 0.06);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.codenames-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-accent);
}

.game-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.game-stats .stat-item {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.game-stats .stat-item strong {
    color: var(--color-accent);
    font-size: 0.95rem;
}

.codenames-setup {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 40px;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    max-width: 500px;
    margin: 0 auto;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setup-field label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-muted);
}

.setup-field input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-size: 1rem;
}

.codenames-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 14px;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.codenames-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    min-height: 85px;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms var(--transition), border-color 220ms var(--transition), background 220ms var(--transition);
    position: relative;
}

.codenames-tile:hover {
    transform: translateY(-6px);
    border-color: rgba(124,99,255,0.25);
}

.codenames-tile .tile-num {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 0.7rem;
    color: var(--color-muted);
    font-weight: 700;
}

.codenames-tile .tile-word {
    font-weight: 800;
    font-size: clamp(0.85rem, 2.4vw, 1.1rem);
    line-height: 1.05;
    color: var(--color-text);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.codenames-tile .tile-badge {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.75rem;
    color: #fff;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    min-width: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Vote count gradient - brightest green for highest votes */
.codenames-tile .tile-badge.vote-level-max {
    background: linear-gradient(135deg, #00ff88, #00e676);
    color: #0a0f14;
    font-weight: 800;
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.6);
    transform: scale(1.15);
}

.codenames-tile .tile-badge.vote-level-4 {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.85), rgba(0, 230, 118, 0.75));
    color: #0a0f14;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(0, 255, 136, 0.45);
    transform: scale(1.1);
}

.codenames-tile .tile-badge.vote-level-3 {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.65), rgba(0, 230, 118, 0.55));
    color: #0f1419;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.35);
    transform: scale(1.05);
}

.codenames-tile .tile-badge.vote-level-2 {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.5), rgba(0, 180, 90, 0.4));
    color: #e8f5e9;
    font-weight: 600;
}

.codenames-tile .tile-badge.vote-level-1 {
    background: linear-gradient(135deg, rgba(0, 150, 80, 0.35), rgba(0, 130, 70, 0.3));
    color: #c8e6c9;
    font-weight: 500;
}

.codenames-tile.revealed {
    transform: scale(1.03);
    box-shadow: 0 18px 36px rgba(0,0,0,0.45);
}

/* Card type color coding */
.codenames-tile.card-target-unrevealed {
    background: rgba(91, 150, 255, 0.2);
    border-color: rgba(91, 150, 255, 0.5);
}

.codenames-tile.card-target-correct {
    background: linear-gradient(135deg, rgba(91, 233, 185, 0.25), rgba(0, 255, 136, 0.15));
    border-color: var(--color-positive);
}

.codenames-tile.card-wrong {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.25), rgba(217, 50, 50, 0.15));
    border-color: var(--color-negative);
}

.codenames-tile.card-assassin-unrevealed {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

.codenames-tile.card-assassin {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 179, 71, 0.25));
    border-color: #ffd700;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4);
}

.codenames-tile .tile-badge.target {
    background: linear-gradient(90deg, var(--color-accent), rgba(124,99,255,0.6));
    color: #050711;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(124,99,255,0.28);
    animation: pulseTarget 1.8s infinite ease-in-out 0.3s;
}

@keyframes pulseTarget {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-2px) scale(1.03); opacity: 0.95; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Active Clue Display - Prominent center display */
.active-clue-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    margin: 0 auto;
    max-width: 600px;
    background: linear-gradient(135deg, rgba(124, 99, 255, 0.25), rgba(91, 208, 255, 0.2));
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(124, 99, 255, 0.4), 0 0 60px rgba(124, 99, 255, 0.15);
    animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { 
        box-shadow: 0 12px 40px rgba(124, 99, 255, 0.4), 0 0 80px rgba(124, 99, 255, 0.15);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 16px 50px rgba(124, 99, 255, 0.5), 0 0 100px rgba(124, 99, 255, 0.25);
        transform: scale(1.02);
    }
}

.active-clue-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-accent);
    opacity: 0.9;
}

.active-clue-text {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--color-text);
    text-transform: uppercase;
    text-shadow: 0 4px 12px rgba(124, 99, 255, 0.3);
}

/* Make the timer visually match the active clue size and sit beside it */
.active-clue-timer {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    text-transform: uppercase;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(10, 15, 20, 0.9);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 900px) {
    .active-clue-display {
        padding: 18px 28px;
    }
    .active-clue-text {
        font-size: 2rem;
    }
    .active-clue-timer {
        font-size: 2rem;
        min-width: 100px;
        padding: 6px 10px;
    }
}

.codenames-actions {
    background: var(--color-surface-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 12px;
}

.host-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.host-panel input {
    flex: 1 1 200px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
}

.host-panel button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

#codenames-status {
    flex-basis: 100%;
    margin-top: 6px;
    color: var(--color-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

@media (max-width: 900px) {
    .codenames-board { gap: 8px; padding: 10px; }
    .codenames-tile { min-height: 70px; padding: 6px; }
    .codenames-tile .tile-word { font-size: clamp(0.75rem, 3.2vw, 0.95rem); }
    .active-clue-text { font-size: 1.4rem; }
    .active-clue-timer { font-size: 1.4rem; min-width: 80px; }
    .active-clue-display { padding: 10px 16px; gap: 6px; }
}


.word-puzzle-setup,
.word-puzzle-playing,
.word-puzzle-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.source-selection {
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.source-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.source-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.source-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.source-btn.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--color-positive);
    color: var(--color-positive);
}

.source-btn .material-symbols-rounded {
    font-size: 2rem;
}

.tdk-info {
    padding: 16px;
    background: rgba(255, 179, 71, 0.1);
    border: 1px solid rgba(255, 179, 71, 0.3);
    border-radius: var(--radius-md);
}

.difficulty-selection {
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.difficulty-btn.active {
    background: rgba(124, 99, 255, 0.2);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.difficulty-btn .material-symbols-rounded {
    font-size: 2rem;
}

.word-puzzle-header {
    padding: 24px;
    background: rgba(124, 99, 255, 0.15);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
}

.word-puzzle-header h3 {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
}

.word-definition {
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-text);
    text-align: center;
    min-height: 60px;
}

.word-display {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-letters-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.letter-box {
    width: 60px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-muted);
    transition: all var(--transition);
}

.letter-box.revealed {
    background: rgba(124, 99, 255, 0.2);
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: scale(1.05);
}

.word-puzzle-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.word-puzzle-attempts {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
}

.word-puzzle-attempts h4 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.attempts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attempt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.attempt-item.winner {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
}

.puzzle-winner {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(124, 99, 255, 0.15));
    border: 2px solid #ffd700;
    border-radius: var(--radius-lg);
}

.puzzle-winner h2 {
    margin: 16px 0;
    font-size: 2rem;
    color: #ffd700;
}

.puzzle-word-reveal {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.puzzle-word-reveal h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    color: var(--color-muted);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px clamp(18px, 3vw, 26px);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    margin-bottom: clamp(20px, 2.5vw, 32px);
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: inherit;
    font-weight: 500;
}

.filter-btn.active {
    background: rgba(124, 99, 255, 0.16);
    border-color: rgba(124, 99, 255, 0.45);
    color: var(--color-accent);
}

.badge-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.badge-filter-label {
    font-size: 0.9rem;
    color: var(--color-muted);
    font-weight: 500;
}

.badge-filter-btn {
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.badge-filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.badge-filter-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(124, 99, 255, 0.25), 0 2px 8px rgba(124, 99, 255, 0.4);
    transform: translateY(-2px);
}

.badge-filter-btn.active .badge-icon {
    color: #ffffff;
    font-weight: 800;
}

.badge-icon {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.badge-icon.mod {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    color: #000;
}

.badge-icon.vip {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
}

.badge-icon.og {
    background: linear-gradient(135deg, #ff00ff, #8b00ff);
    color: #fff;
}

.badge-icon.sub {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    color: #000;
}

.toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bulk-label {
    font-size: 0.9rem;
    color: var(--color-muted);
}

#bulk-count {
    width: 80px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 0.5fr) minmax(180px, 0.25fr) minmax(180px, 0.25fr);
    gap: clamp(18px, 2vw, 24px);
    align-items: start;
}

.panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: clamp(18px, 2vw, 24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.panel-header p {
    margin: 6px 0 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.panel-feed {
    min-height: clamp(460px, 65vh, 720px);
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: clamp(18px, 2vw, 24px);
    overflow-y: auto;
    max-height: 50vh;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
    contain: layout style paint;
}

.message {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px clamp(12px, 2vw, 18px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(124, 99, 255, 0.08));
    border-radius: var(--radius-md);
    padding: clamp(16px, 2vw, 20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    will-change: transform;
    contain: layout style paint;
}

/* Performance: Use class instead of inline style for filtering */
.message.filtered-out,
.message.badge-filtered {
    display: none;
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.message-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    flex-wrap: wrap;
}

.message-meta time {
    font-size: 0.82rem;
    color: var(--color-muted);
    font-weight: 500;
}

.user-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    vertical-align: middle;
    margin-left: 4px;
}

.user-badge.badge-moderator {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    color: #000;
}

.user-badge.badge-vip {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
}

.user-badge.badge-og {
    background: linear-gradient(135deg, #ff00ff, #8b00ff);
    color: #fff;
}

.user-badge.badge-subscriber {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    color: #000;
}

.user-badge.badge-founder {
    background: linear-gradient(135deg, #9b59b6, #e74c3c);
    color: #fff;
}

.user-badge.badge-sub_gifter {
    background: linear-gradient(135deg, #ff69b4, #ff1493);
    color: #fff;
}

.message-body {
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

.message-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.link-chip-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 999px;
    padding: 4px 4px 4px 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background var(--transition), border-color var(--transition);
}

.link-chip-wrapper:hover {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.18);
}

.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 0.75rem;
    color: inherit;
    text-decoration: none;
    max-width: 100%;
    border-radius: 999px;
    transition: background var(--transition);
}

.link-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.link-chip span {
    opacity: 0.6;
    font-size: 0.8rem;
}

.link-chip strong {
    font-weight: 600;
    max-width: clamp(140px, 20vw, 220px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: rgba(124, 99, 255, 0.2);
    color: var(--color-accent);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.link-preview-btn:hover {
    background: rgba(124, 99, 255, 0.35);
    transform: scale(1.1);
}

.link-preview-btn .material-symbols-rounded {
    font-size: 1.1rem;
}

.message-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pill-button {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
    color: var(--color-muted);
}

.message.visited .message-body,
.message.visited .link-chip {
    opacity: 0.6;
}

.system-log {
    padding: 0 clamp(18px, 2vw, 24px) clamp(18px, 2vw, 28px);
    font-size: 0.85rem;
    color: var(--color-muted);
}

.sidebar {
    display: contents;
}

.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 2vw, 24px);
}

.user-list {
    padding: clamp(16px, 2vw, 20px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
}

.user-count {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--color-muted);
    font-weight: 600;
    vertical-align: middle;
}

.panel-controls {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.panel-collapsed {
    --collapsed-height: 44px;
}

.panel-collapsed .panel-header > :not(.panel-controls) {
    display: none;
}

.panel-collapsed .panel-header {
    min-height: var(--collapsed-height);
    align-items: center;
}

.panel-collapsed .user-list {
    display: none !important;
}

.panel-collapsed .panel-controls #okundu-button {
    display: none;
}

.user-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 99, 255, 0.22);
    font-weight: 700;
}

.user-meta span {
    display: block;
}

.user-meta .name {
    font-weight: 600;
}

.user-meta .time {
    font-size: 0.82rem;
    color: var(--color-muted);
}

.user-card.new {
    animation: pulse 1.6s ease-in-out infinite;
    border-color: rgba(124, 99, 255, 0.45);
}

.user-card.read {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.03);
}

@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(124, 99, 255, 0.0);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(124, 99, 255, 0.18);
    }
}

.rates-grid {
    padding: 0 clamp(18px, 2vw, 24px);
    display: grid;
    gap: 12px;
    font-size: 0.95rem;
}

.rates-grid div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.18);
}

.rates-grid dd {
    margin: 0;
    font-weight: 600;
}

.rates-grid dt {
    font-weight: 500;
    color: var(--color-muted);
}

.rates-updated {
    margin: 16px clamp(18px, 2vw, 24px) clamp(18px, 2vw, 26px);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.panel-blacklist {
    margin-top: clamp(20px, 2vw, 28px);
}

.panel-blacklist .panel-header {
    padding: clamp(16px, 2vw, 20px);
}

/* Blacklist Dialog */
.blacklist-dialog {
    width: min(600px, 90vw);
    max-height: calc(100vh - 48px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.blacklist-dialog::backdrop {
    background: rgba(4, 6, 16, 0.85);
}

.blacklist-dialog .dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.blacklist-dialog .dialog-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.blacklist-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 28px;
    flex-shrink: 0;
}

.blacklist-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.blacklist-tab:hover {
    color: var(--color-text);
}

.blacklist-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.blacklist-search {
    position: relative;
    padding: 20px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.blacklist-search .search-icon {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    font-size: 20px;
    pointer-events: none;
}

.blacklist-search input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
    font-size: 0.95rem;
    transition: all var(--transition);
}

.blacklist-search input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.05);
}

.blacklist-content {
    padding: 24px 28px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.blacklist-tab-content {
    display: none;
}

.blacklist-tab-content.active {
    display: block;
}

.blacklist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.blacklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 107, 107, 0.25);
    background: rgba(255, 107, 107, 0.08);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.blacklist-item:hover {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.35);
}

.blacklist-item-text {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
    font-family: 'Consolas', 'Monaco', monospace;
}

.blacklist-item-remove {
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--color-negative);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.blacklist-item-remove:hover {
    background: rgba(255, 107, 107, 0.35);
    transform: scale(1.05);
}

.blacklist-list:empty::after {
    content: 'Henüz yasaklı yok';
    display: block;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.clear-all-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.1);
    color: var(--color-negative);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-all-btn:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

.clear-all-btn .material-symbols-rounded {
    font-size: 18px;
}

.settings-dialog::backdrop,
.preview-dialog::backdrop {
    background: rgba(4, 6, 16, 0.85);
}

.settings-dialog,
.preview-dialog {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: min(560px, 92vw);
    width: 100%;
    background: var(--color-surface);
    color: inherit;
    position: relative; /* popover anchor */
    overflow: visible;
}

/* Dialog kapalı olduğunda gizle */
.settings-dialog:not([open]),
.preview-dialog:not([open]),
.blacklist-dialog:not([open]) {
    display: none;
}

.preview-dialog {
    max-width: min(1400px, 96vw);
    max-height: min(900px, 92vh);
    display: flex;
    flex-direction: column;
    width: 90vw;
    height: 85vh;
}

.preview-dialog:not([open]) {
    display: none;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-title h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.preview-title .material-symbols-rounded {
    font-size: 1.5rem;
    color: var(--color-accent);
}

.preview-close-btn {
    padding: 0.5rem;
    min-width: auto;
}

.preview-content {
    flex: 1 1 auto;
    overflow: auto;
    position: relative;
    min-height: 500px;
    background: #15202b;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--color-muted);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.preview-embed {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
    display: block;
    background: #15202b;
}

.twitter-iframe {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    border: none;
    background: #15202b;
}

.twitter-embed-wrapper {
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.twitter-embed-wrapper .twitter-tweet {
    margin: 0 auto !important;
    width: 100% !important;
}

.twitter-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--color-muted);
    padding: 40px 20px;
}

.twitter-embed-container::-webkit-scrollbar {
    width: 10px;
}

.twitter-embed-container::-webkit-scrollbar-track {
    background: transparent;
}

.twitter-embed-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.twitter-embed-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
    background-clip: padding-box;
}

.preview-content::-webkit-scrollbar {
    width: 10px;
}

.preview-content::-webkit-scrollbar-track {
    background: transparent;
}

.preview-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.preview-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
    background-clip: padding-box;
}

.preview-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    text-align: center;
}

.preview-error .material-symbols-rounded {
    font-size: 3rem;
    color: var(--color-negative);
}

.preview-error p {
    color: var(--color-muted);
    margin: 0;
}

.preview-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.preview-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-accent), rgba(123, 128, 255, 0.85));
    color: #050711;
    border: none;
    font-weight: 600;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 14px 40px rgba(124, 99, 255, 0.35);
}

.preview-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 48px rgba(124, 99, 255, 0.45);
}

.preview-link-btn .material-symbols-rounded {
    font-size: 1.2rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: visible;
}

.dialog-header {
    padding: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    padding: 24px;
}

.settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* Modern color controls */
.color-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.swatch {
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    border-radius: 10px;
    padding: 6px;
    width: 46px;
    height: 42px;
}

.swatch-chip {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: var(--swatch, #000);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2);
}

.color-hex {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    width: 100%;
    min-width: 0;
}

.color-field .clear {
    height: 42px;
}

.native-color {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0; height: 0; padding: 0; border: 0;
}

/* Popover color picker */
.color-popover {
    position: absolute;
    inset: auto auto auto auto; /* positioned via JS */
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 14px;
    z-index: 1000;
    min-width: 300px;
    max-width: calc(100% - 24px);
}

.picker {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.sv-wrap { position: relative; width: 220px; height: 160px; }
.sv { width: 220px; height: 160px; border-radius: 10px; display: block; }
.sv-cursor { position: absolute; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); transform: translate(-6px,-6px); pointer-events: none; }

.hue-wrap { position: relative; width: 16px; height: 160px; }
.hue { width: 16px; height: 160px; border-radius: 10px; display: block; }
.hue-cursor { position: absolute; left: -2px; width: 20px; height: 4px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); transform: translateY(-2px); pointer-events: none; }

.picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.picker-preview { display: inline-flex; align-items: center; gap: 10px; color: var(--color-muted); font-size: 0.9rem; }
.picker-preview .preview-chip { width: 26px; height: 18px; border-radius: 6px; background: #000; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35); }
.picker-actions { display: inline-flex; gap: 10px; }

.dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.dialog-footer menu {
    display: flex;
    gap: 10px;
    padding: 0;
    margin: 0;
}

#reset-settings {
    color: var(--color-muted);
}

.message-list::-webkit-scrollbar,
.user-list::-webkit-scrollbar {
    width: 10px;
}

.message-list::-webkit-scrollbar-track,
.user-list::-webkit-scrollbar-track {
    background: transparent;
}

.message-list::-webkit-scrollbar-thumb,
.user-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.message-list::-webkit-scrollbar-thumb:hover,
.user-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
    background-clip: padding-box;
}

@media (max-width: 1200px) {
    .app-header {
        grid-template-columns: minmax(0, 1fr);
    }

    .header-controls {
        justify-content: flex-start;
    }

    .connection {
        align-items: stretch;
    }

    .connection label {
        width: 100%;
    }

    .connection-fields {
        flex-wrap: wrap;
        width: 100%;
    }
}

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

    .message-list {
        max-height: none;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar .panel {
        flex: 1 1 280px;
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message {
        grid-template-columns: 1fr;
    }

    .message-actions {
        flex-direction: row;
    }

    .preview-dialog {
        max-width: 98vw;
        max-height: 96vh;
        width: 98vw;
        height: 96vh;
    }

    .preview-content {
        min-height: 250px;
    }

    .preview-embed {
        min-height: 250px;
    }

    .link-chip strong {
        max-width: 160px;
    }
}
