/* Mobile optimizations, text selection menu, follow-up context badges,
 * landscape tweaks, scroll button adjustments. Contains all @media rules
 * (except a tools-only @media that lives in tools.css).
 * Extracted from styles.css lines 4088-5387.
 */

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Use viewport units that account for mobile browser chrome */
    body {
        height: 100dvh; /* Dynamic viewport height - adjusts when address bar hides */
        min-height: -webkit-fill-available;
    }

    .main-content {
        height: calc(100dvh - 16px);
        min-height: -webkit-fill-available;
        margin: 8px;
        flex: 1;
        width: auto;
    }

    /* Collapse sidebars by default on mobile */
    .left-sidebar.collapsed {
        width: 0;
        min-width: 0;
        padding: 0;
        opacity: 0;
        overflow: hidden;
        position: absolute;
        transform: translateX(-100%);
        pointer-events: none;
    }

    .sidebar-resize-handle {
        display: none;
    }

    .main-content #expandSidebarBtn {
        display: flex !important;
    }

    .right-sidebar.collapsed {
        width: 0;
        margin: 0;
        padding: 0;
        opacity: 0;
        overflow: hidden;
        position: absolute;
        right: 0;
        transform: translateX(100%);
        pointer-events: none;
    }

    #toggleSettingsBtn {
        display: flex !important;
    }

    /* When sidebars are manually expanded on mobile */
    .left-sidebar:not(.collapsed) {
        width: 240px;
        padding: 12px;
        opacity: 1;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        background-color: #ffffff;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
        transform: translateX(0);
        pointer-events: auto;
    }

    .right-sidebar:not(.collapsed) {
        width: 280px;
        padding: 16px;
        margin: 0;
        opacity: 1;
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        background-color: var(--bg-panel);
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
        transform: translateX(0);
        pointer-events: auto;
    }

    #arenaSettings {
        margin-right: -16px;
        padding-right: 16px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.75) transparent;
    }

    #arenaSettings::-webkit-scrollbar {
        width: 7px;
    }

    #arenaSettings::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.75);
        box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
    }

    #arenaSettings::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.95);
    }

    /* Mobile overlay backdrop */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }

    body:has(.left-sidebar:not(.collapsed))::after,
    body:has(.right-sidebar:not(.collapsed))::after {
        opacity: 1;
        pointer-events: auto;
    }

    /* Compact header to save space */
    .main-header {
        padding: 6px 12px;
        min-height: 44px;
    }

    /* Reduce icon button sizes */
    .icon-button {
        padding: 6px;
        width: 32px;
        height: 32px;
    }

    .icon-button svg {
        width: 16px;
        height: 16px;
        font-size: 16px;
    }

    .main-header-icons {
        gap: 4px;
    }

    /* Smaller model selector */
    .model-selector-header {
        margin: 0 6px;
    }

    .model-selector-header select {
        font-size: 14px;
        padding: 4px 20px 4px 6px;
        min-width: 110px;
        background-size: 14px;
    }

    /* More compact expand sidebar button */
    #expandSidebarBtn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    #expandSidebarBtn svg {
        width: 16px;
        height: 16px;
    }

    /* Reduce chat message padding */
    .chat-messages {
        padding: 12px;
        gap: 16px;
    }

    /* Avatar above bubble layout - completely vertical */
    .message-wrapper {
        max-width: 95%;
        width: 100%;
    }

    .message {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        width: 100%;
    }

    .message.user {
        flex-direction: column;
        align-items: flex-end;
    }

    .message.assistant {
        flex-direction: column;
        align-items: flex-start;
    }

    .message.thinking {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
        align-self: flex-start;
    }

    .message.user .message-avatar {
        align-self: flex-end;
    }

    /* More compact message content - now truly full width */
    .message-content {
        padding: 8px 12px;
        border-radius: 12px; /* Less rounded */
        width: 100%;
        max-width: 100%;
        align-self: stretch;
    }

    .message-text {
        font-size: 15px;
        line-height: 1.5;
        width: 100%;
    }

    /* Adjust model label for vertical layout */
    .model-label {
        font-size: 11px;
        margin-bottom: 3px;
        margin-left: 0;
        width: 100%;
    }

    /* Compact input area - LESS ROUNDED */
    .chat-input-container {
        padding: 4px 12px 12px 12px;
    }

    .prompt-area {
        border-radius: 16px; /* Much less rounded than 28px */
        padding: 3px;
    }

    .prompt-input {
        padding: 8px 12px;
        font-size: 15px;
        border-radius: 16px;
        max-height: 120px;
    }

    /* Smaller button icons in prompt area */
    .prompt-buttons {
        gap: 4px;
        padding-right: 4px;
    }

    .prompt-buttons button {
        padding: 6px;
    }

    .attach-btn {
        padding: 6px !important;
    }

    .attach-btn svg {
        width: 16px;
        height: 16px;
    }

    /* More compact send button */
    .prompt-buttons .run-btn {
        padding: 6px 12px;
        border-radius: 12px;
        font-size: 13px;
        gap: 6px;
    }

    .prompt-buttons .run-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Compact attachments preview */
    .attachments-preview {
        padding: 8px;
        gap: 6px;
        margin-bottom: 6px;
        border-radius: 8px;
    }

    .attachment-item {
        padding: 6px 10px;
        gap: 6px;
        border-radius: 6px;
        font-size: 12px;
        max-width: 160px;
    }

    .attachment-item img.attachment-thumbnail {
        width: 24px;
        height: 24px;
    }

    .attachment-item .attachment-icon {
        width: 24px;
        height: 24px;
    }

    /* Compact queue indicator */
    .queued-message-indicator {
        padding: 8px 12px;
        margin: 0 12px 6px 12px;
        gap: 10px;
        border-radius: 12px;
    }
    
    .queued-label {
        font-size: 12px;
    }
    
    .queued-preview {
        font-size: 12px;
    }
    
    .clear-queue-btn {
        width: 20px;
        height: 20px;
    }
    
    .clear-queue-btn svg {
        width: 11px;
        height: 11px;
    }

    /* Reduce welcome screen size and ensure proper behavior */
    .welcome-screen {
        position: static;
        height: auto;
        min-height: 0;
        flex: none;
    }

    .welcome-screen h1 {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .welcome-screen p {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .status-badge {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Align chat messages to top on mobile (not centered) */
    .chat-messages {
        justify-content: flex-start;
        align-items: stretch;
    }

    /* Only center when welcome screen is the only element */
    .chat-messages:empty,
    .chat-messages > .welcome-screen:first-child:last-child {
        justify-content: center;
    }

    /* Ensure welcome screen is hidden when messages exist */
    .chat-messages > .message-wrapper ~ .welcome-screen,
    .chat-messages > .welcome-screen:not(:first-child),
    .chat-messages > .welcome-screen:not(:last-child) {
        display: none !important;
    }

    /* Compact arena mode */
    .arena-panel-header {
        padding: 8px 12px;
        min-height: 44px;
    }

    .arena-panel-label {
        font-size: 12px;
    }

    .arena-model-select {
        font-size: 13px;
        padding: 4px 20px 4px 6px;
        max-width: 120px;
    }

    .arena-chat-messages {
        padding: 12px;
    }

    .arena-chat-messages .welcome-screen h2 {
        font-size: 20px;
    }

    .arena-input-container {
        padding: 4px 12px 12px 12px;
    }

    /* Compact code blocks */
    .message-text .code-container pre {
        padding: 2em 0.75em 0.75em 0.75em;
        max-height: 300px;
        font-size: 0.85em;
    }

    .message-text .code-header {
        padding: 6px 12px;
    }

    .message-text .language-name {
        font-size: 0.7em;
    }

    .message-text .copy-code-button {
        padding: 3px 8px;
        font-size: 0.7em;
    }

    .message-text .copy-table-button {
        padding: 3px 8px;
        font-size: 0.7em;
    }

    .message-text .table-header {
        padding: 6px 12px;
    }

    .message-text .table-label {
        font-size: 0.7em;
    }

    /* Compact message actions */
    .message-actions {
        gap: 6px;
        margin-top: 6px;
        padding-top: 6px;
    }

    .message-action-btn {
        padding: 3px 6px;
        font-size: 12px;
        gap: 3px;
    }

    .message-action-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Compact thinking blocks */
    .thinking-header {
        gap: 6px;
        margin-bottom: 6px;
        font-size: 13px;
    }

    .thinking-icon {
        width: 14px;
        height: 14px;
    }

    .thinking-content {
        max-height: 300px;
        font-size: 13px;
    }

    /* Compact tables */
    .message-text table {
        font-size: 0.85em;
        margin: 0.75em 0;
    }

    .message-text th,
    .message-text td {
        padding: 8px 10px;
    }

    /* Compact headings */
    .message-text h1 { font-size: 1.3em; }
    .message-text h2 { font-size: 1.2em; }
    .message-text h3 { font-size: 1.1em; }

    .message-text h1,
    .message-text h2,
    .message-text h3,
    .message-text h4,
    .message-text h5,
    .message-text h6 {
        margin-top: 1.5em;
        margin-bottom: 0.6em;
    }

    /* Compact lists */
    .message-text ul,
    .message-text ol {
        padding-left: 20px;
        margin-top: 0.75em;
        margin-bottom: 0.75em;
    }

    .message-text li {
        margin-bottom: 0.4em;
        padding-left: 6px;
    }

    /* Compact privacy banner */
    .privacy-mode-banner {
        padding: 6px 12px;
    }

    .privacy-banner-text {
        font-size: 13px;
    }

    .privacy-banner-icon {
        width: 16px;
        height: 16px;
    }

    /* Sidebar content styling when expanded */
    .left-sidebar:not(.collapsed) .logo {
        font-size: 18px;
        padding: 6px 0;
    }

    .left-sidebar:not(.collapsed) .collapse-sidebar-btn {
        width: 28px;
        height: 28px;
    }

    .left-sidebar:not(.collapsed) .nav-item {
        padding: 10px 12px;
        font-size: 14px;
        margin-bottom: 6px;
    }

    .left-sidebar:not(.collapsed) .nav-item svg {
        width: 18px;
        height: 18px;
        margin-right: 12px;
    }

    .left-sidebar:not(.collapsed) .history {
        margin-top: 20px;
    }

    .left-sidebar:not(.collapsed) .history-item {
        padding: 6px 12px;
        font-size: 13px;
        gap: 6px;
    }

    .left-sidebar:not(.collapsed) .sidebar-footer {
        padding: 12px 0;
        font-size: 12px;
    }

    .left-sidebar:not(.collapsed) .privacy-mode-container {
        padding: 8px 12px;
        margin-bottom: 10px;
    }

    .left-sidebar:not(.collapsed) .privacy-mode-label {
        font-size: 13px;
        gap: 6px;
    }

    .left-sidebar:not(.collapsed) .sidebar-footer-links a {
        font-size: 13px;
        padding: 6px 0 6px 12px;
        gap: 6px;
    }

    /* Right sidebar content styling when expanded */
    .right-sidebar:not(.collapsed) .settings-header {
        margin-bottom: 16px;
    }

    .right-sidebar:not(.collapsed) .settings-header h2 {
        font-size: 14px;
    }

    .right-sidebar:not(.collapsed) .setting-group {
        padding-bottom: 24px;
        margin-top: 24px;
    }

    .right-sidebar:not(.collapsed) .setting-item {
        margin-bottom: 18px;
    }

    .right-sidebar:not(.collapsed) .setting-label {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .right-sidebar:not(.collapsed) .slider-container {
        gap: 12px;
    }

    .right-sidebar:not(.collapsed) .slider-container .value-box {
        width: 60px;
        padding: 6px 4px;
        font-size: 13px;
    }

    .right-sidebar:not(.collapsed) select {
        padding: 8px 12px;
        font-size: 14px;
        padding-right: 32px;
    }

    /* Compact auth overlay */
    .auth-box {
        padding: 32px 24px;
        width: 95%;
    }

    #auth-title {
        font-size: 24px;
        margin-bottom: 6px;
    }

    #auth-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .google-btn,
    .email-auth-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .auth-input-group {
        margin-bottom: 12px;
    }

    .auth-input-group input {
        padding: 10px 12px 10px 40px;
        font-size: 14px;
    }

    .auth-divider {
        margin: 20px 0;
        font-size: 12px;
    }

    .auth-switch {
        margin-top: 20px;
        font-size: 13px;
    }

    /* Compact modals */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        padding: 20px;
    }

    .privacy-section h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .privacy-section p {
        font-size: 14px;
        margin-bottom: 10px;
    }

    /* Compact custom dialogs */
    .custom-dialog-box {
        padding: 24px;
        width: 95%;
    }

    .custom-dialog-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }

    .alert-icon svg,
    .confirm-icon svg {
        width: 28px;
        height: 28px;
    }

    .custom-dialog-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .custom-dialog-message {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .custom-dialog-btn {
        padding: 8px 20px;
        font-size: 14px;
        min-width: 90px;
    }
    
    
    /* Compact follow-up badge in input area on mobile */
    .follow-up-badge-container {
        padding: 4px 6px 6px 6px;
        width: calc(100% - 4px);
        margin: 0 2px;
    }
    
    .follow-up-badge {
        padding: 6px 10px;
        gap: 8px;
        border-radius: 12px;
        min-height: 32px;
    }
    
    .follow-up-badge-text {
        font-size: 12px;
    }
    
    .follow-up-badge-remove {
        width: 20px;
        height: 20px;
    }
    
    .follow-up-badge-remove svg {
        width: 11px;
        height: 11px;
    }
    
    /* Compact follow-up context in message bubbles on mobile */
    .follow-up-context {
        padding: 8px 10px;
        font-size: 12px;
        border-radius: 12px;
    }
    
    .follow-up-context-text {
        font-size: 12px;
    }
    
    .follow-up-badge-text {
        font-size: 12px;
    }
}

/* Extra optimizations for very small screens */
@media (max-width: 480px) {
    /* Even more compact header */
    .main-header {
        padding: 4px 8px;
        min-height: 40px;
    }

    .icon-button {
        padding: 5px;
        width: 28px;
        height: 28px;
    }

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

    .main-header-icons {
        gap: 2px;
    }

    .model-selector-header {
        margin: 0 4px;
    }

    .model-selector-header select {
        font-size: 13px;
        padding: 3px 18px 3px 4px;
        min-width: 100px;
    }

    /* Ultra compact input */
    .chat-input-container {
        padding: 3px 8px 8px 8px;
    }

    .prompt-area {
        border-radius: 14px;
        padding: 2px;
    }

    .prompt-input {
        padding: 6px 10px;
        font-size: 14px;
        border-radius: 14px;
    }

    .prompt-buttons .run-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    /* Ultra compact follow-up badge */
    .follow-up-badge-container {
        padding: 3px 4px 5px 4px;
        width: calc(100% - 2px);
        margin: 0 1px;
    }
    
    .follow-up-badge {
        padding: 5px 8px;
        gap: 6px;
        border-radius: 10px;
        min-height: 28px;
    }
    
    .follow-up-badge-text {
        font-size: 11px;
    }
    
    .follow-up-badge-remove {
        width: 18px;
        height: 18px;
    }
    
    .follow-up-badge-remove svg {
        width: 10px;
        height: 10px;
    }
    
    /* Ultra compact queue indicator */
    .queued-message-indicator {
        padding: 6px 10px;
        margin: 0 8px 4px 8px;
        gap: 8px;
        border-radius: 10px;
    }
    
    .queued-label {
        font-size: 11px;
    }
    
    .queued-preview {
        font-size: 11px;
    }
    
    .clear-queue-btn {
        width: 18px;
        height: 18px;
    }
    
    .clear-queue-btn svg {
        width: 10px;
        height: 10px;
    }
    
    /* Ultra compact follow-up context in message bubbles */
    .follow-up-context {
        padding: 6px 8px;
        font-size: 11px;
        border-radius: 10px;
    }
    
    .follow-up-context-text {
        font-size: 11px;
    }

    /* Tighter message spacing */
    .chat-messages {
        padding: 8px;
        gap: 12px;
    }

    /* Avatar above bubble - extra compact */
    .message-wrapper {
        max-width: 98%;
        width: 100%;
    }

    .message {
        gap: 5px;
        width: 100%;
    }

    .message-content {
        padding: 6px 10px;
        border-radius: 10px;
        width: 100%;
        max-width: 100%;
        align-self: stretch;
    }

    .message-text {
        font-size: 14px;
        width: 100%;
    }

    /* Ultra compact avatar */
    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .model-label {
        margin-left: 0;
        font-size: 10px;
        width: 100%;
    }

    /* Smaller welcome screen */
    .welcome-screen {
        position: static;
        height: auto;
        min-height: 0;
        flex: none;
    }

    .welcome-screen h1 {
        font-size: 24px;
    }

    .welcome-screen p {
        font-size: 13px;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    /* Minimize vertical spacing in landscape */
    .main-header {
        padding: 4px 12px;
        min-height: 36px;
    }

    .chat-messages {
        padding: 8px 12px;
        gap: 12px;
    }

    .chat-input-container {
        padding: 3px 12px 8px 12px;
    }

    .prompt-input {
        max-height: 80px;
    }

    .message-content {
        padding: 6px 10px;
    }

    .welcome-screen {
        padding: 12px;
        position: static;
        height: auto;
        min-height: 0;
        flex: none;
    }

    .welcome-screen h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .welcome-screen p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .arena-panel-header {
        padding: 6px 12px;
        min-height: 36px;
    }
}

/* ============================================
   TEXT SELECTION CONTEXT MENU
   ============================================ */

.text-selection-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    z-index: 10000;
    display: none;
    min-width: 120px;
}

.text-selection-menu.show {
    display: block;
    animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-selection-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.15s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
}

.text-selection-menu-item:hover {
    background-color: var(--bg-hover);
}

.text-selection-menu-item:active {
    background-color: var(--bg-button);
}

.text-selection-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Follow-up context badge in input area - full width banner with quotation marks */
.follow-up-badge-container {
    padding: 6px 10px 8px 10px;
    width: calc(100% - 8px);
    margin: 0 4px;
}

.follow-up-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f1f5f9;
    border: none;
    border-radius: 16px;
    padding: 8px 14px;
    width: 100%;
    min-height: 36px;
    animation: badgeSlideIn 0.3s ease-out;
    overflow: hidden;
}

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

.follow-up-badge-text {
    flex: 1;
    font-size: 13px;
    color: #64748b;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
    min-width: 0;
}

.follow-up-badge-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: #94a3b8;
}

.follow-up-badge-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.follow-up-badge-remove svg {
    width: 13px;
    height: 13px;
}

/* Follow-up context badge in message bubbles - full width banner with quotation marks */
.follow-up-context {
    display: block;
    background: #f1f5f9;
    border: none;
    padding: 10px 14px;
    margin: 0 0 12px 0;
    border-radius: 14px;
    font-size: 13px;
    color: #64748b;
    font-style: italic;
    word-break: break-word;
    width: 100%;
    overflow-wrap: break-word;
    line-height: 1.5;
}

.follow-up-context-text {
    color: #64748b;
    font-style: italic;
    line-height: 1.5;
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
}

/* Follow-up context in user messages - slightly lighter for contrast */
.message.user .follow-up-context {
    background: rgba(255, 255, 255, 0.25);
    border: none;
}

.message.user .follow-up-context-text {
    color: rgba(255, 255, 255, 0.95);
}

/* ============================================
   SCROLL NAVIGATION CONTROLS
   ============================================ */

.scroll-controls {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
    max-width: 44px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scroll-controls.active {
    opacity: 1;
    pointer-events: auto;
}

.scroll-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    color: var(--text-secondary);
    opacity: 0;
    transform: scale(0.7);
    pointer-events: none;
}

.scroll-controls.active .scroll-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.scroll-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.scroll-btn:hover:not(:disabled) {
    background: rgba(239, 246, 255, 0.7);
    color: var(--blue-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--blue-accent);
}

.scroll-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.scroll-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Icon styles - icons are already oriented correctly */

/* Mobile adjustments */
@media (max-width: 768px) {
    .scroll-controls {
        right: 8px;
        gap: 6px;
        /* Prevent horizontal overflow */
        max-width: calc(100vw - 16px);
    }

    .scroll-btn {
        width: 36px;
        height: 36px;
    }

    .scroll-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .main-content {
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .scroll-controls {
        right: 4px;
        gap: 4px;
        /* Prevent horizontal overflow */
        max-width: calc(100vw - 8px);
    }

    .scroll-btn {
        width: 32px;
        height: 32px;
    }

    .scroll-btn svg {
        width: 16px;
        height: 16px;
    }
}

