:root {
    --bg-gradient: linear-gradient(135deg, #1a1c2c 0%, #4a192c 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --device-icon-size: 34px;
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #b8b8b8;
    --text-section-header: rgba(255, 255, 255, 0.95);
    --accent-color: #ff0055;
    --accent-hover: #ff3377;
    --accent-shadow: rgba(255, 0, 85, 0.3);
    --btn-text: white;
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-text: white;
    --btn-secondary-border: 1px solid transparent;
    --text-placeholder: rgba(255, 255, 255, 0.5);
    --dropdown-bg: rgba(20, 20, 30, 0.95);
    --swatch-border: rgba(255, 255, 255, 0.2);
    --success-color: #10b981;
    --success-bg: rgba(0, 255, 136, 0.15);
    --success-shadow: rgba(0, 255, 136, 0.1);
    --warning-color: #ffaa00;
    --warning-bg: rgba(255, 170, 0, 0.2);
    --terminal-bg: #000000;
    --progress-bg: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --card-radius: 16px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ========== THEME DEFINITIONS ========== */

/* Theme: Midnight (Default) - Already in :root */
html.theme-midnight {
    --bg-gradient: linear-gradient(135deg, #1a1c2c 0%, #4a192c 100%);
    --accent-color: #ff0055;
    --accent-hover: #ff3377;
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #b8b8b8;
}

/* Theme: Ocean - Deep Blue/Teal */
html.theme-ocean {
    --bg-gradient: linear-gradient(135deg, #0a1628 0%, #1e293b 100%);
    --accent-color: #5ccffb;
    --accent-hover: #38bdf8;
    --accent-shadow: rgba(56, 189, 248, 0.25);
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #94b8d4;
    --text-placeholder: rgba(255, 255, 255, 0.45);
    --success-color: #4ade80;
}

/* Theme: Forest - Deep Emerald */
html.theme-forest {
    --bg-gradient: linear-gradient(135deg, #0d1f0d 0%, #1a3a1a 100%);
    --accent-color: #34d399;
    --accent-hover: #10b981;
    --accent-shadow: rgba(52, 211, 153, 0.25);
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #9ec5a8;
    --success-color: #a3e635;
}

/* Theme: Sunset - Warm Orange/Brown */
html.theme-sunset {
    --bg-gradient: linear-gradient(135deg, #2d1810 0%, #4a2c1a 100%);
    --accent-color: #fbbf24;
    --accent-hover: #f59e0b;
    --accent-shadow: rgba(251, 191, 36, 0.25);
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #d4b896;
    --success-color: #facc15;
    --text-placeholder: rgba(255, 255, 255, 0.45);
}

/* Theme: Lavender - Purple/Violet */
html.theme-lavender {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #2d1a3a 100%);
    --accent-color: #d8b4fe;
    --accent-hover: #c084fc;
    --success-color: #4ade80;
    --accent-shadow: rgba(216, 180, 254, 0.3);
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: #c4b8d4;
    --text-placeholder: rgba(255, 255, 255, 0.45);
}

/* Theme: Noir - Pure Black */
html.theme-noir {
    --bg-gradient: linear-gradient(135deg, #000000 0%, #0f172a 100%);
    --accent-color: #f1f5f9;
    --accent-hover: #e2e8f0;
    --accent-shadow: rgba(255, 255, 255, 0.15);
    --btn-text: #0f172a;
    --text-main: rgba(255, 255, 255, 0.95);
    --text-muted: #a8b5c4;
    --text-placeholder: rgba(255, 255, 255, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
}

/* Theme: Snowfall - Clean Light */
html.theme-snowfall {
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-shadow: rgba(37, 99, 235, 0.2);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-placeholder: #94a3b8;
    --text-section-header: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.12);
    --btn-text: white;
    --btn-secondary-bg: rgba(0, 0, 0, 0.06);
    --btn-secondary-text: #1e293b;
    --btn-secondary-border: 1px solid rgba(0, 0, 0, 0.1);
    --dropdown-bg: rgba(255, 255, 255, 0.98);
    --hover-bg: rgba(0, 0, 0, 0.06);
    --swatch-border: rgba(0, 0, 0, 0.2);
    --success-color: #15803d;
    --success-bg: rgba(22, 163, 74, 0.1);
    --success-shadow: rgba(22, 163, 74, 0.1);
    --warning-color: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.1);
    --terminal-bg: rgba(255, 255, 255, 0.5);
    --progress-bg: rgba(0, 0, 0, 0.1);
    --scrollbar-thumb: rgba(37, 99, 235, 0.5);
}

/* Specific Override for Snowfall Progress Bar to ensure correct color */
html.theme-snowfall .progress-bar-fill {
    background: var(--success-color) !important;
}

/* Specific Override for Snowfall Progress Bar to ensure correct color */
html.theme-snowfall .progress-bar-fill {
    background: var(--success-color) !important;
}


/* ========== THEME PICKER STYLES ========== */

.theme-picker-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-picker-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent-shadow);
}

.theme-picker-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--dropdown-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    min-width: 200px;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.theme-picker-dropdown.open {
    display: block;
    animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-picker-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.theme-option:last-child {
    margin-bottom: 0;
}

.theme-option:hover {
    background: var(--hover-bg);
}

.theme-option.active {
    background: var(--hover-bg);
    border: 1px solid var(--accent-color);
}

.theme-option:not(.active) {
    border: 1px solid transparent;
}

.theme-swatch {
    width: 32px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--swatch-border);
}

/* Swatch colors for each theme */
.theme-swatch.swatch-midnight {
    background: #ff0055;
}

.theme-swatch.swatch-ocean {
    background: #00d4ff;
}

.theme-swatch.swatch-forest {
    background: #10b981;
}

.theme-swatch.swatch-sunset {
    background: #ff8844;
}

.theme-swatch.swatch-lavender {
    background: #b388ff;
}

.theme-swatch.swatch-noir {
    background: #111111;
}

.theme-swatch.swatch-snowfall {
    background: #f8fafc;
}


.theme-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.theme-option.active .theme-name {
    color: var(--accent-color);
}

.session-controls {
    position: relative;
}

/* Global Reset for Touch Highlight */
button,
.icon-btn,
.action-btn,
.delete-btn,
.pool-item {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

button:focus,
.icon-btn:focus,
.action-btn:focus,
.delete-btn:focus {
    outline: none;
}

/* Custom Scrollbar Styles */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
    transition: background 0.2s;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

html {
    background-color: #000000;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: block;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
    margin: 0 auto;
    /* Center horizontally */
}

.app-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 12px;
}

/* PIN label uses accent color */
.pin-label {
    color: var(--accent-color) !important;
}

.app-header {
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
    flex-wrap: wrap;
    gap: 20px;
}

.app-logo {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
}

.app-logo .dot {
    color: var(--accent-color);
    font-size: 2.2rem;
    line-height: 0;
    margin-left: 2px;
}

.device-identity {
    display: flex;
    align-items: center;
    gap: 15px;
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-name-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
}

.device-name-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
    width: auto;
    min-width: 60px;
    max-width: 200px;
    padding: 0;
    outline: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.device-name-input:focus {
    border-bottom-color: var(--accent-color);
}

.device-name-input::placeholder {
    color: var(--text-placeholder);
    opacity: 0.7;
}


.identity-icon {
    color: var(--text-secondary);
    margin-right: 10px;
    display: flex;
    width: var(--device-icon-size);
    height: var(--device-icon-size);
}


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

.device-ip {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
}

.current-device-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.current-device-label::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    opacity: 0.5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
    margin-top: 0;
    color: var(--text-main);
}

.modal-card p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Session Overlay */
.session-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.session-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 32px;
    border-radius: 24px;
    text-align: center;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.session-description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Session Tabs */
.session-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
}

.session-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.session-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.session-tab.active {
    background: var(--accent-color);
    color: var(--btn-text);
    box-shadow: 0 4px 15px var(--accent-shadow);
}

.session-tab svg {
    flex-shrink: 0;
}

/* Session Panels */
.session-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.25s ease;
}

.session-panel.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Session ID Input */
.session-id-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 16px 20px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
    transition: all 0.2s ease;
}

.session-id-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.session-id-input::placeholder {
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-placeholder);
}

/* Generated ID Display */
.generated-id-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.id-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.id-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 3px;
    font-family: monospace;
}

.regenerate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.regenerate-btn:hover {
    background: var(--accent-color);
    color: var(--btn-text);
    transform: rotate(180deg);
}

/* PIN Protection Toggle Option */
.pin-protection-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.option-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-info svg {
    color: var(--accent-color);
}

.option-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.option-label {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-main);
    text-align: left;
}

.option-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent-color);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

/* PIN Input Wrapper */
.pin-input-wrapper,
.create-pin-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 100, 100, 0.05);
    border: 1px solid rgba(255, 100, 100, 0.15);
    border-radius: 12px;
    animation: slideDown 0.2s ease;
}

.create-pin-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: left;
}

.input-label svg {
    color: var(--accent-color);
}

/* PIN Field */
.pin-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 4px;
    transition: all 0.2s ease;
}

.pin-field:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.pin-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0 12px 48px;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-align: center;
    outline: none;
    min-width: 0;
    /* Allow shrinking in flex container */
}

.pin-input::placeholder {
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-placeholder);
}

.pin-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    /* Prevent button from being squashed */
}

.pin-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.pin-toggle-btn .eye-closed {
    display: none;
}

.pin-toggle-btn.showing .eye-open {
    display: none;
}

.pin-toggle-btn.showing .eye-closed {
    display: block;
}

/* Error Message */
.error-message {
    font-size: 0.85rem;
    color: #ff6b6b;
    text-align: left;
    margin: 0;
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Full Width Button */
.primary-btn.full-width {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.primary-btn.full-width svg {
    flex-shrink: 0;
}

/* Session Footer Actions */
.session-footer-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.link-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Session Badge Protected State */
.session-lock-icon {
    color: var(--accent-color);
    margin-right: 6px;
    flex-shrink: 0;
    pointer-events: none;
}

.session-info.protected .session-lock-icon {
    display: inline-block;
}

.session-info .session-lock-icon.hidden {
    display: none;
}

/* Session Badges Container */
.session-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Session PIN Badge - uses same class as session-info */
#session-pin-display.hidden {
    display: none;
}

/* Backward Compatibility - Keep old styles */
#session-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 0;
    text-align: center;
    outline: none;
}

#session-input:focus {
    border-color: var(--accent-color);
}

.session-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.primary-btn,
.secondary-btn {
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.primary-btn {
    background: var(--accent-color);
    color: var(--btn-text);
}

.secondary-btn {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: var(--btn-secondary-border);
}

.primary-btn:hover,
.secondary-btn:hover {
    transform: translateY(-2px);
}

main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 30px 30px 30px;
}

/* Responsive grid for certain sections */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

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

@media (max-width: 768px) {
    main {
        padding: 0 20px 20px 20px;
        gap: 16px;
    }

    .sections-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 18px;
    backdrop-filter: blur(10px);
}

h2 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

/* Unified Sharing Container */
.share-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.share-container:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.share-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    /* Starts small */
    max-height: 300px;
    padding: 0;
    outline: none;
    overflow-y: auto;
    /* Allow scroll when max-height is reached */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    white-space: pre-wrap;
    /* Preserve whitespace and wrap text */
    overflow-wrap: anywhere;
    /* Force break at any point if needed */
    word-break: break-all;
    /* Ensure words break if too long */
    box-sizing: border-box;
}

.share-input::placeholder {
    color: var(--text-placeholder);
}

.share-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.attach-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

.share-submit-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: var(--btn-text);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px var(--accent-shadow);
}

.share-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-shadow);
    filter: brightness(1.1);
}

.share-submit-btn:active {
    transform: translateY(0);
}

/* Device List */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    /* Space for scrollbar */
}

.device-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.device-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.device-item.drag-over {
    border-color: var(--success-color);
    background: rgba(0, 255, 136, 0.1);
}

.device-icon {
    font-size: 24px;
    margin-right: 15px;
    width: var(--device-icon-size);
    height: var(--device-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-icon svg {
    width: 100%;
    height: 100%;
}

.device-info {
    flex: 1;
    min-width: 0;
    /* Enable flex truncation */
}

.device-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-ip {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section Styles */
.share-section,
.my-files-section,
.public-feed-section,
.devices-section,
.transfers-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 0;
    min-width: 0;
    /* Prevent grid blowout */
}

.share-section h2,
.my-files-section h2,
.public-feed-section h2,
.devices-section h2,
.transfers-section h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-section-header);
    font-weight: 600;
}

.my-files-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.drop-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

/* Content List - Single column layout */
.file-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 900px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    padding-right: 14px;
    /* Extra space for scrollbar */
}

/* Content Item Card - Horizontal layout */
.pool-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    transition: all 0.2s;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 0;
    /* Ensure children can truncate */
}

.pool-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border);
}

.pool-item:focus-within {
    border-color: var(--accent-color);
    outline: none;
}

/* Icon Section */
.pool-item .file-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 6px;
}

.pool-item .file-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

/* Content Section */
.content-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.content-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-text {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    /* Better than break-word */
    word-break: break-word;
    /* Fallback */
    max-width: 100%;
    white-space: pre-wrap;
    /* Preserve line breaks */
    transition: max-height 0.3s ease;
}

.content-text:not(.truncated) {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
    /* Space for scrollbar */
}



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

/* Expanded State Styles */
.pool-item.expanded {
    align-items: flex-start;
    padding-bottom: 40px;
    /* Space for bottom actions */
}

.pool-item.expanded .content-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 4px;
    /* Background removed to fix dark box in light theme */
}

/* Ensure text takes full width when expanded */
.pool-item.expanded .content-body {
    margin-right: 0;
    /* Reclaim space from actions */
}

.content-url {
    font-size: 0.8rem;
    color: var(--accent-color);
    text-decoration: none;
    font-family: monospace;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.content-url:hover {
    text-decoration: underline;
}

.content-url:focus {
    outline: none;
}

.content-url {
    -webkit-tap-highlight-color: transparent;
}

.content-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.owner-name {
    font-weight: 500;
    opacity: 0.9;
}

.time-ago {
    cursor: help;
}

/* Action Buttons */
.content-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0 12px;
    height: 28px;
    min-width: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 0, 85, 0.3);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.action-btn:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Download button with loading state */
.download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-btn .btn-spinner {
    animation: spin 1s linear infinite;
}

.download-btn.loading {
    background: var(--warning-bg);
    border-color: var(--warning-color);
    color: var(--warning-color);
    cursor: wait;
}

.download-btn:disabled {
    opacity: 0.8;
    cursor: wait;
}

.download-btn:disabled:hover {
    background: var(--warning-bg);
    border-color: var(--warning-color);
    color: var(--warning-color);
    transform: none;
}

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

    to {
        transform: rotate(360deg);
    }
}

.download-btn.downloading {
    background: rgba(64, 156, 255, 0.2);
    border-color: #409cff;
    color: #409cff;
    cursor: progress;
}

.download-btn.success {
    background: var(--success-bg);
    border-color: var(--success-color);
    color: var(--success-color);
}

/* Retry state - draw attention */
.download-btn .btn-text:contains('Retry') {
    font-weight: 600;
}

/* Delete button (for own content) */
.pool-item .delete-btn {
    opacity: 1;
    /* Redundant styles removed to inherit unified .action-btn styles */
}

.pool-item .delete-btn:hover {
    background: rgba(255, 50, 50, 0.3);
    border-color: #ff5555;
    color: #ff5555;
}

.pool-item .delete-btn:focus {
    outline: 2px solid #ff5555;
    outline-offset: 2px;
}

/* Legacy file name/meta styles (for backward compatibility) */
.pool-item .file-name {
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pool-item .file-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0;
}

/* Log Section */
.log-section {
    grid-column: 1 / -1;
}

.transfer-log {
    background: var(--terminal-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    min-height: 50px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--success-color);
    display: flex;
    flex-direction: column-reverse;
    flex-direction: column-reverse;
    box-shadow: inset 0 0 10px var(--success-shadow);
    transition: height 0.3s ease;
}

.log-stats {
    position: sticky;
    top: 0;
    background: var(--terminal-bg);
    color: var(--accent-color);
    font-weight: bold;
    border-bottom: 1px dashed var(--glass-border);
    padding-bottom: 5px;
    margin-bottom: 5px;
    z-index: 10;
    display: flex;
    gap: 15px;
}

.transfer-log div {
    padding: 2px 0;
    border-bottom: none;
    white-space: pre-wrap;
    word-break: break-all;
}

.transfer-log.hidden {
    display: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.section-header h2,
.section-header h3 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.btn-sm {
    background: var(--btn-secondary-bg);
    border: var(--btn-secondary-border);
    color: var(--btn-secondary-text);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.danger-text {
    color: #ff5555;
    font-weight: 600;
}

.btn-sm:hover {
    background: var(--hover-bg);
    /* color: white; - Removed to inherit text color (e.g. red for danger) */
}

/* Transfers Section */
.transfer-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Transfer Active Toast */
.transfer-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.98));
    border: 1px solid var(--warning-color);
    border-radius: 12px;
    color: var(--warning-color);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 180, 0, 0.15);
    z-index: 9999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(10px);
    max-width: calc(100vw - 32px);
    width: auto;
}

.transfer-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.transfer-toast.hidden {
    display: none;
}

.transfer-toast .toast-icon {
    font-size: 1.2rem;
    animation: toast-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.transfer-toast .toast-text {
    white-space: nowrap;
}

@keyframes toast-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.transfer-meta-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-cancel {
    background: rgba(255, 50, 50, 0.2);
    color: #ff5555;
    border: 1px solid rgba(255, 50, 50, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 10px;
}

.btn-cancel:hover {
    background: rgba(255, 50, 50, 0.3);
    color: #ff7777;
}

.transfer-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    transition: background 0.2s;
}

.transfer-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.transfer-card.completed {
    border-color: var(--success-color);
    opacity: 0.8;
}

.transfer-card.highlight {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 0, 85, 0.6);
    }

    100% {
        box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
    }
}

.transfer-card.cancelled {
    border-color: var(--accent-color);
    background: rgba(255, 0, 85, 0.05);
    opacity: 0.8;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* Reduced Motion & Animation Cleanup */
@media (prefers-reduced-motion: no-preference) {
    .pool-item {
        animation: fadeIn 0.3s ease;
    }

    .transfer-card {
        animation: fadeIn 0.3s ease;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.notif-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.notif-close {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.notif-close:hover {
    opacity: 1;
}

.notif-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.notif-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Progress Styles within Card */
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--success-color);
    width: 0%;
    transition: width 0.2s linear;
}

.download-theme .progress-bar-fill {
    background: #409cff;
}

.notif-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Pool Item Animation */
/* Animation handled in media query above */

.pool-item.requesting {
    border-color: #ffaa00;
    /* Yellow/Orange */
    background: rgba(255, 170, 0, 0.1);
    cursor: wait;
    animation: pulse-yellow 1.5s infinite;
}

.pool-item.downloading {
    border-color: #409cff;
    /* Blue */
    background: rgba(64, 156, 255, 0.1);
    cursor: progress;
    animation: pulse-blue 1.5s infinite;
}

/* Done state removed - using button state instead */

@keyframes pulse-yellow {
    0% {
        background: rgba(255, 170, 0, 0.1);
    }

    50% {
        background: rgba(255, 170, 0, 0.2);
    }

    100% {
        background: rgba(255, 170, 0, 0.1);
    }
}

@keyframes pulse-blue {
    0% {
        background: rgba(64, 156, 255, 0.1);
    }

    50% {
        background: rgba(64, 156, 255, 0.2);
    }

    100% {
        background: rgba(64, 156, 255, 0.1);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 30, 30, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 500;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Pool Placeholder */
.pool-placeholder {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
    min-height: 100px;
    box-sizing: border-box;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 0.9rem;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .app-container {
        padding: 0 10px;
    }

    .app-header {
        padding: 15px 20px;
    }

    .app-logo {
        font-size: 1.4rem;
    }

    /* Toolbar - Wrap badges on narrow screens */
    .app-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 15px;
    }

    .device-identity {
        margin-right: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Badges container wraps to second row on narrow screens */
    .session-badges {
        flex: 0 0 100%;
        /* Force full width, move to new row */
        order: 1;
        /* Put after device-identity */
    }

    .device-info {
        flex: 1;
        min-width: 0;
    }

    /* Session and PIN badges stay together on second row */
    .session-info {
        flex-shrink: 0;
    }

    .device-name-input {
        font-size: 1rem;
        max-width: 100%;
    }

    .device-meta {
        flex-wrap: wrap;
    }

    .session-info {
        flex-shrink: 0;
    }

    /* Reset PIN input centering compensation on mobile to prevent shift */
    .pin-input {
        padding-left: 0 !important;
    }

    /* Header - keep logo left, buttons right on mobile */
    .app-header {
        display: flex;
        flex-wrap: nowrap;
        /* Force single line */
        justify-content: space-between;
        width: 100%;
        gap: 10px;
        padding: 15px 20px;
        /* Increased to 20px to match main */
        box-sizing: border-box;
    }

    .app-logo {
        margin-right: auto;
    }

    .header-controls {
        margin-left: auto;
    }

    /* Sections - Single column */
    .sections-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    main {
        padding: 10px 20px 20px 20px;
        gap: 16px;
    }

    section {
        padding: 18px;
    }

    .share-section,
    .my-files-section,
    .public-feed-section,
    .devices-section,
    .transfers-section {
        padding: 16px;
    }

    h2 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    /* Pool items - Better mobile layout */
    .pool-item {
        padding: 10px;
        gap: 8px;
    }

    .pool-item .file-icon {
        width: 28px;
        height: 28px;
        padding: 4px;
    }

    .content-body {
        min-width: 0;
        flex: 1;
    }

    .content-title {
        font-size: 0.85rem;
    }

    .content-meta {
        font-size: 0.65rem;
    }

    .content-actions {
        flex-shrink: 0;
    }

    .action-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    /* Share Container */
    .share-container {
        padding: 15px;
    }

    .share-input {
        font-size: 1rem;
    }

    .share-footer {
        padding-top: 10px;
    }

    .share-submit-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    /* Device list items */
    .device-item {
        padding: 14px;
    }

    .device-icon {
        width: 28px;
        height: 28px;
        margin-right: 12px;
    }

    .device-name {
        font-size: 0.9rem;
    }

    /* File grid */
    .file-grid {
        max-height: 400px;
        padding: 6px;
    }

    /* Transfer cards */
    .transfer-card {
        padding: 12px;
    }

    /* Log section */
    .transfer-log {
        max-height: 200px;
        font-size: 0.75rem;
    }
}

/* Small phone optimizations */
@media (max-width: 480px) {
    .app-container {
        padding: 0 5px;
    }

    .app-header {
        padding: 12px 15px;
        justify-content: center;
        text-align: center;
    }

    .app-logo {
        font-size: 1.2rem;
    }

    .app-toolbar {
        padding: 10px 12px;
        gap: 10px;
    }

    .device-identity {
        gap: 10px;
    }

    .identity-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }

    .device-name-input {
        font-size: 0.9rem;
        min-width: 50px;
    }

    .current-device-label {
        font-size: 0.65rem;
    }

    .device-ip {
        font-size: 0.7rem;
    }

    /* Session badge compact */
    .session-badge {
        padding: 4px 5px 4px 10px;
        gap: 6px;
    }

    .session-label {
        font-size: 0.65rem;
    }

    .session-value {
        font-size: 0.8rem;
    }

    .session-controls {
        padding-left: 6px;
        gap: 2px;
    }

    .icon-btn-sm {
        padding: 4px;
    }

    .icon-btn-sm svg {
        width: 14px;
        height: 14px;
    }

    .app-header {
        padding: 12px 15px;
        gap: 8px;
        justify-content: center;
    }

    main {
        padding: 0 10px 15px 10px;
        gap: 12px;
    }

    section,
    .share-section,
    .my-files-section,
    .public-feed-section,
    .devices-section,
    .transfers-section {
        padding: 10px;
        border-radius: 10px;
    }

    h2 {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    /* Pool items - Compact mobile */
    .pool-item {
        padding: 8px;
        min-height: 44px;
        gap: 6px;
    }

    .pool-item .file-icon {
        width: 24px;
        height: 24px;
        padding: 3px;
        border-radius: 6px;
    }

    .pool-item .file-icon svg {
        stroke-width: 2;
    }

    .content-title,
    .file-name {
        font-size: 0.8rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .content-meta,
    .file-meta {
        font-size: 0.6rem;
    }

    /* Actions - Stack on very small screens */
    .content-actions {
        flex-direction: column;
        gap: 4px;
    }

    .action-btn {
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    .pool-item .delete-btn {
        padding: 3px 6px;
        font-size: 0.65rem;
    }

    /* Share container compact */
    .share-container {
        padding: 12px;
        gap: 10px;
    }

    .share-input {
        font-size: 0.95rem;
        min-height: 20px;
    }

    .share-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .attach-actions {
        gap: 4px;
    }

    .icon-btn {
        padding: 6px;
    }

    .share-submit-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 16px;
    }

    /* File grid compact */
    .file-grid {
        max-height: 300px;
        gap: 6px;
        padding: 4px;
    }

    /* Placeholder */
    .pool-placeholder {
        padding: 15px;
        min-height: 80px;
    }

    .placeholder-icon {
        font-size: 32px;
        margin-bottom: 10px;
    }

    .placeholder-text {
        font-size: 0.8rem;
    }

    /* Device list compact */
    .device-item {
        padding: 12px;
    }

    .device-icon {
        width: 24px;
        height: 24px;
        margin-right: 10px;
    }

    .device-name {
        font-size: 0.85rem;
    }

    .device-ip {
        font-size: 0.7rem;
    }

    /* Session overlay - Compact */
    .session-card {
        padding: 25px 20px;
        width: 95%;
    }

    #session-input {
        padding: 12px;
        font-size: 1rem;
    }

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

    .primary-btn,
    .secondary-btn {
        width: 100%;
        padding: 12px 20px;
    }

    /* Modal compact */
    .modal-card {
        padding: 20px;
        width: 95%;
    }

    /* Transfer cards compact */
    .transfer-card {
        padding: 10px;
        border-radius: 10px;
    }

    .notif-title {
        font-size: 0.85rem;
    }

    .notif-body {
        font-size: 0.8rem;
    }

    .progress-bar-bg {
        height: 5px;
    }

    /* Toast compact */
    .toast {
        padding: 10px 18px;
        font-size: 0.85rem;
        max-width: 90%;
    }

    /* Log section compact */
    .section-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .transfer-log {
        max-height: 150px;
        font-size: 0.7rem;
        padding: 10px;
    }
}

/* Extra small devices (320px) */
@media (max-width: 360px) {
    .app-logo {
        font-size: 1rem;
    }

    .session-value {
        font-size: 0.75rem;
    }

    .device-name-input {
        font-size: 0.85rem;
    }

    .content-title,
    .file-name {
        font-size: 0.75rem;
    }

    .action-btn,
    .pool-item .delete-btn {
        padding: 3px 5px;
        font-size: 0.6rem;
    }

    .share-submit-btn span {
        display: none;
    }

    .share-submit-btn svg {
        margin: 0;
    }
}

/* Header Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 4px;
    border-radius: 30px;
}

/* Session Info - inside toolbar */
.session-info {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    width: fit-content;
}

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

.session-info:active {
    transform: scale(0.98);
}

.session-info.copied {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--success-color);
}

.session-info.copied .session-value {
    color: var(--success-color);
}

/* Tooltip for session info */
.session-info::after {
    content: 'Copy Session ID';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
}

.session-info:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

.session-info.copied::after {
    content: 'Copied!';
}

#session-pin-display::after {
    content: 'Copy PIN';
}

#session-pin-display.copied::after {
    content: 'Copied!';
}

.session-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    pointer-events: none;
}

.session-value {
    color: var(--text-muted);
    font-weight: 700;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    pointer-events: none;
}


.icon-btn-sm {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.icon-btn-sm:hover {
    background: var(--hover-bg);
    color: var(--text-main);
    transform: scale(1.05);
}

/* Custom Tooltip/Label on Hover */
.icon-btn-sm[data-label]::after {
    content: attr(data-label);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 10000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

html.theme-snowfall .icon-btn-sm[data-label]::after {
    background: #1e293b;
}

.icon-btn-sm[data-label]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(8px);
}

.icon-btn-sm svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5px;
}

/* Mobile Adjustments for Inputs */
@media (max-width: 480px) {
    .digit-input {
        width: 35px;
        height: 45px;
        font-size: 20px;
    }

    .digit-inputs {
        gap: 6px;
    }
}

/* Toolbar Styles */
.device-identity {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    /* Critical for flex truncation */
    margin-right: 10px;
}

.device-name-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
    /* Truncation */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



.device-icon {
    font-size: 1.2rem;
    margin-right: 12px;
    opacity: 0.8;
}

/* Help Modal & Buttons */
.session-footer-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
}

.link-btn:hover {
    opacity: 1;
    color: var(--accent-color);
    background: var(--hover-bg);
}

.wide-modal {
    max-width: 600px;
    width: 90%;
    text-align: left;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-main);
}

.close-modal-btn {
    padding: 5px;
    margin: -5px;
}

.modal-content-scroll {
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h4 {
    margin: 0 0 10px 0;
    color: var(--text-main);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.help-section p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.help-section ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    color: var(--text-muted);
}

.help-section li {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.app-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin: 0;
}

/* Transfer Log Filename Truncation */
.transfer-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    /* Crucial for flex child truncation */
    margin-right: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* --- Dev Options / Logs --- */
.dev-options-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    /* Managed via absolute positioning of popup */
    pointer-events: none;
}

/* Enable pointer events on children */
.dev-options-wrapper>* {
    pointer-events: auto;
}

.dev-toggle-btn {
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.dev-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.dev-toggle-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: rotate(90deg);
}

/* Fix Noir theme active state (white on light accent) */
html.theme-noir .dev-toggle-btn.active {
    color: var(--btn-text);
}

.dev-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.transfer-log-container {
    position: absolute;
    bottom: 60px;
    /* 48px Button + 12px gap */
    right: 0;
    width: min(800px, calc(100vw - 60px));

    max-height: 400px;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom right;
}



.transfer-log-container.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.log-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-action-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.log-action-btn:hover {
    background: rgba(255, 0, 85, 0.1);
    color: var(--accent-color);
}

.refresh-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.refresh-btn.spinning .icon-refresh svg {
    animation: spin 0.8s linear infinite;
}

.refresh-btn.success {
    color: var(--success-color);
    background: rgba(0, 255, 136, 0.15);
    transform: scale(1.1);
    /* Subtle "pop" on success */
}

.icon-refresh,
.icon-success {
    display: flex;
    align-items: center;
}

.hidden {
    display: none !important;
}

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

    to {
        transform: rotate(360deg);
    }
}

.log-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #444;
    text-align: center;
    gap: 8px;
    user-select: none;
}

.log-empty-state .empty-icon {
    font-size: 24px;
    opacity: 0.5;
    filter: grayscale(100%);
}

.log-empty-state span {
    font-size: 0.8rem;
    font-weight: 500;
}

.transfer-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    color: #a0a0a0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 250px;
}

.transfer-log div {
    word-break: break-all;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 2px;
}

/* ========== SNOWFALL (LIGHT THEME) OVERRIDES ========== */
/* Fix all elements with hardcoded dark-theme colors for light theme compatibility */

html.theme-snowfall .generated-id-display,
html.theme-snowfall .pin-input-wrapper,
html.theme-snowfall .session-input-display,
html.theme-snowfall .join-session-input-wrapper {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
}

html.theme-snowfall .session-input-display:focus-within,
html.theme-snowfall .pin-input-wrapper:focus-within,
html.theme-snowfall .join-session-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

html.theme-snowfall .share-container {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

html.theme-snowfall .share-container:focus-within {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.02);
}

html.theme-snowfall .file-item,
html.theme-snowfall .peer-item {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

html.theme-snowfall .file-item:hover,
html.theme-snowfall .peer-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

html.theme-snowfall .icon-btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}

html.theme-snowfall .icon-btn:hover {
    background: var(--accent-color);
    color: white;
}

html.theme-snowfall .secondary-btn {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-main);
    border-color: rgba(0, 0, 0, 0.12);
}

html.theme-snowfall .secondary-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

html.theme-snowfall .link-btn {
    color: var(--text-muted);
}

html.theme-snowfall .link-btn:hover {
    color: var(--accent-color);
}

html.theme-snowfall .session-info {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

html.theme-snowfall .session-info.copied {
    border-color: var(--success-color);
}

html.theme-snowfall .toggle-switch .slider {
    background: rgba(0, 0, 0, 0.15);
}

html.theme-snowfall .toggle-switch input:checked+.slider {
    background: var(--accent-color);
}

html.theme-snowfall .log-action-btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}

html.theme-snowfall .log-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--accent-color);
}

html.theme-snowfall .log-action-btn.success {
    color: var(--success-color);
    border-color: var(--success-color);
}

html.theme-snowfall .transfer-log {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
}

html.theme-snowfall .transfer-log div {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

html.theme-snowfall .pin-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #b91c1c;
}

html.theme-snowfall .session-tabs .session-tab {
    color: var(--text-muted);
}

html.theme-snowfall .session-tabs .session-tab.active {
    color: white;
    border-color: var(--accent-color);
}

html.theme-snowfall .session-tabs .session-tab:hover:not(.active) {
    color: var(--text-main);
}

html.theme-snowfall .session-footer-actions {
    border-top-color: rgba(0, 0, 0, 0.08);
}

html.theme-snowfall .scrollbar-custom::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

html.theme-snowfall .scrollbar-custom::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

html.theme-snowfall .confirmation-modal-content {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.15);
}

html.theme-snowfall .device-name-input {
    color: var(--text-main);
}

html.theme-snowfall .device-name-input::placeholder {
    color: var(--text-placeholder);
}

/* Loading Overlay for Session Exit */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

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

.loading-text {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

html.theme-snowfall .loading-overlay {
    background: rgba(255, 255, 255, 0.9);
}

html.theme-snowfall .loading-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent-color);
}

html.theme-snowfall .loading-text {
    color: var(--text-main);
}

/* Content Preview Modal */
.preview-card {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    gap: 15px;
    /* Spacing between title and button */
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    /* Flexbox text overflow fix */
}

.modal-header .icon-btn-sm {
    flex-shrink: 0;
    /* Prevent button from squishing */
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
}

.preview-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-main);
    color: var(--text-main);
    line-height: 1.6;
    width: 100%;
}

.preview-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 4px;
    object-fit: contain;
}

.preview-video {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 4px;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
    width: 100%;
}

.preview-placeholder svg {
    color: var(--accent-color);
    opacity: 0.8;
}

/* Preview Metadata */
.preview-metadata {
    width: 100%;
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 8px;
    box-sizing: border-box;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    word-break: break-all;
}

/* Smart Actions (Link Chips) */
.smart-actions {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    overflow-x: auto;
    padding-top: 4px;
    padding-bottom: 4px;
    /* Space for scrollbar if any */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    position: relative;
    z-index: 5;
}

.smart-actions::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.link-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--accent-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    max-width: 200px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.link-chip:hover {
    background: var(--accent-shadow);
    border-color: var(--accent-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.link-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer Link */
.footer-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Anti-FOUC for Session Overlay */
html.has-session #session-overlay {
    display: none !important;
}