:root {
    /* Use container-relative units based on machine-container size */
    --reel-width: 18%;
    /* Percentage of container width */
    --reel-height: 35%;
    /* Percentage of container height */
    --text-color: #333;

    /* Prevent dark mode from being applied */
    color-scheme: only light;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #000 !important;
    /* Pure black background */
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

html {
    color-scheme: only light !important;
}

.main-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.machine-container {
    position: relative;
    /* Maintain aspect ratio of the slot machine image (1024:576 = 16:9) */
    aspect-ratio: 16 / 9;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    /* Enable container queries for button sizing */
    container-type: inline-size;
    container-name: machine;
}

/* Make container fit within viewport while maintaining aspect ratio */
@media (min-aspect-ratio: 16/9) {
    .machine-container {
        width: auto;
        height: 100vh;
    }
}

@media (max-aspect-ratio: 16/9) {
    .machine-container {
        width: 100vw;
        height: auto;
    }
}

.machine-bg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    /* Background should be behind the reels */
    filter: drop-shadow(0 0 50px rgba(0, 255, 255, 0.1));
    object-fit: contain;
    /* Maintain aspect ratio, fit within container */
}

/* Overlay image for spinning state */
.machine-overlay {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    /* Overlay should be above background but below reels */
    /* No filter to avoid double shadow effect when overlaying */
    opacity: 0;
    /* Initially hidden */
    transition: opacity 0.15s ease-in-out;
    /* Smooth transition */
    object-fit: contain;
    /* Maintain aspect ratio, fit within container */
}

/* Show overlay when spinning */
.machine-overlay.visible {
    opacity: 1;
}

.machine-title {
    display: none;
    /* Hide title if user wants full image focus, or adjust position */
}

.reels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.reel {
    position: absolute;
    width: var(--reel-width);
    height: var(--reel-height);
    background-color: transparent;
    overflow: hidden;
    border: none;
    box-shadow: none;
    /* Enable container queries for font-size scaling */
    container-type: size;
}

/* Position each reel at the exact center of the white slots */
#reel1 {
    left: 30%;
    top: 58%;
    transform: translate(-50%, -50%);
}

#reel2 {
    left: 49.5%;
    top: 58%;
    transform: translate(-50%, -50%);
}

#reel3 {
    left: 68.5%;
    top: 58%;
    transform: translate(-50%, -50%);
}

.reel-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    /* Font size scales with container height */
    font-size: 35cqh;
    /* Container query height units - increased for better visibility */
    color: #000;
    font-weight: 900;
    font-family: 'Noto Sans TC', sans-serif;
    /* Support for vertical text stacking (newline characters) */
    white-space: pre-line;
    text-align: center;
    line-height: 1.2;
    /* Increased line height for better spacing in stacked characters */
}

/* Animation classes */
.reel.spinning .reel-content {
    animation: blur-spin 0.08s infinite linear;
    /* Faster spin */
    filter: blur(15px);
    /* Stronger blur */
    opacity: 0.5;
    transform: scaleY(1.2);
    /* Stretch effect */
}

@keyframes blur-spin {
    0% {
        transform: translateY(-50px) scaleY(1.2);
    }

    100% {
        transform: translateY(50px) scaleY(1.2);
    }
}

/* Controls */
.controls {
    position: absolute;
    left: 49%;
    top: 88%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

.spin-button {
    /* Use container query units to scale with machine-container */
    padding: 1cqw 4cqw;
    font-size: 2.5cqw;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(to bottom, #ff0000, #aa0000);
    border: 2px solid #fff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    transition: transform 0.05s, box-shadow 0.1s;
    /* Only transition transform and shadow, not background */
    text-transform: uppercase;
    letter-spacing: 0.4cqw;
}

.spin-button:active {
    transform: scale(0.95);
    /* Shrink effect for press */
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5), inset 0 4px 8px rgba(0, 0, 0, 0.3);
    /* Reduced outer glow + inner shadow for depth */
    background: linear-gradient(to bottom, #cc0000, #880000);
    /* Darker gradient to simulate pressed state */
}

.spin-button:disabled {
    background: #333;
    border-color: #555;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
}

/* Spin trigger area - covers right 20% of machine-container */
.spin-trigger-area {
    position: fixed;
    /* Position relative to viewport, aligned with machine-container */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Calculate dimensions to match machine-container */
    width: 100vw;
    height: 100vh;
    /* Clip to show only rightmost 20% */
    clip-path: polygon(80% 0%, 100% 0%, 100% 100%, 80% 100%);
    z-index: 10;
    /* Above reels (z-index: 5) but below history panel (z-index: 1000) */
    cursor: pointer;
    background: transparent;
    /* Invisible by default */
    transition: background 0.2s;
    pointer-events: auto;
}

/* Adjust based on viewport aspect ratio */
@media (min-aspect-ratio: 16/9) {
    .spin-trigger-area {
        width: auto;
        height: 100vh;
        aspect-ratio: 16 / 9;
    }
}

@media (max-aspect-ratio: 16/9) {
    .spin-trigger-area {
        width: 100vw;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* Optional: Show subtle highlight on hover for user feedback */
.spin-trigger-area:hover:not(.disabled) {
    background: rgba(255, 0, 0, 0.05);
}

/* When spinning is active, disable the trigger area */
.spin-trigger-area.disabled {
    pointer-events: none;
    cursor: not-allowed;
}


/* ========================================
   HISTORY PANEL (Right Side)
   ======================================== */

.history-panel {
    position: fixed;
    right: 0;
    top: 0;
    /* Width includes tab (40px) + panel content (18vw, min 250px) */
    width: calc(18vw + 40px);
    min-width: 290px; /* 250px + 40px */
    height: 100vh;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-panel.collapsed {
    /* Only hide the panel content, leave the 40px tab visible */
    transform: translateX(calc(100% - 40px));
}

/* Panel Toggle Button - Rounded Rectangle Tab Style */
.panel-toggle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 100px;

    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;

    /* 低調背景 */
    background: linear-gradient(
        135deg,
        rgba(0, 255, 255, 0.3),
        rgba(0, 180, 255, 0.25)
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    /* 圓角（左側） */
    border-radius: 12px 0 0 12px;

    /* 外框 */
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-right: none;

    /* 柔和光暈 */
    box-shadow:
        -5px 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 15px rgba(0, 255, 255, 0.15),
        0 0 30px rgba(0, 255, 255, 0.25);

    transition: all 0.3s ease;
}

.panel-toggle:hover {
    background: linear-gradient(
        135deg,
        rgba(0, 255, 255, 0.5),
        rgba(0, 180, 255, 0.45)
    );
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow:
        -10px 0 40px rgba(0, 255, 255, 0.5),
        inset 0 0 25px rgba(0, 255, 255, 0.25),
        0 0 50px rgba(0, 255, 255, 0.4);
}

/* Menu Icon - Three Horizontal Lines */
.menu-icon {
    position: relative;
    width: 20px;
    height: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    transition: all 0.3s ease;
}

/* Middle line using gradient background */
.menu-icon {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 44%,
        rgba(255, 255, 255, 0.7) 44%,
        rgba(255, 255, 255, 0.7) 56%,
        transparent 56%,
        transparent 100%
    );
    background-clip: content-box;
}

.panel-toggle:hover .menu-icon::before,
.panel-toggle:hover .menu-icon::after {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.8);
}

.panel-toggle:hover .menu-icon {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 44%,
        rgba(255, 255, 255, 1) 44%,
        rgba(255, 255, 255, 1) 56%,
        transparent 56%,
        transparent 100%
    );
}

/* Panel Content (the actual visible panel part) */
.panel-content {
    position: absolute;
    left: 40px;
    top: 0;
    width: 18vw;
    min-width: 250px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(10, 10, 30, 0.9));
    border-left: 2px solid rgba(0, 255, 255, 0.5);
    box-shadow: -5px 0 30px rgba(0, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.5) rgba(0, 0, 0, 0.3);
}

.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.panel-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}

/* Panel Header */
.panel-header {
    padding: 2vmin 2.5vmin;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 255, 255, 0.05);
}

.panel-header h2 {
    margin: 0;
    font-size: 2.5vmin;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    font-weight: 900;
    letter-spacing: 0.2vmin;
}

/* History List */
.history-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2vmin;
    min-height: 0; /* Important for flex child to enable scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.5) rgba(0, 0, 0, 0.3);
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}

/* Empty State */
.empty-state {
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    padding: 3vmin;
    font-size: 1.8vmin;
    font-style: italic;
}

/* History Item */
.history-item {
    padding: 1.5vmin 2vmin;
    margin-bottom: 1vmin;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 2vmin;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1.5vmin;
}

.history-item:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.4);
    transform: translateX(-5px);
}

.history-item .item-number {
    color: #00ffff;
    font-weight: bold;
    font-size: 2.2vmin;
    min-width: 4vmin;
}

.history-item .item-name {
    flex: 1;
    font-weight: 700;
    letter-spacing: 0.1vmin;
}

/* Panel Actions */
.panel-actions {
    padding: 2vmin;
    border-top: 1px solid rgba(0, 255, 255, 0.3);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.action-button {
    width: 100%;
    padding: 1.5vmin 2vmin;
    font-size: 2vmin;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(to bottom, #00aaff, #0077cc);
    border: 2px solid #00ffff;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.2vmin;
}

.action-button:hover:not(:disabled) {
    background: linear-gradient(to bottom, #00ccff, #0099ee);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
    transform: translateY(-2px);
}

.action-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.action-button:disabled {
    background: rgba(50, 50, 50, 0.5);
    border-color: rgba(100, 100, 100, 0.5);
    color: rgba(150, 150, 150, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

/* Panel Settings */
.panel-settings {
    padding: 2vmin 2.5vmin;
    background: rgba(0, 0, 0, 0.3);
}

.panel-settings h3 {
    margin: 0 0 1.5vmin 0;
    font-size: 2vmin;
    color: #00ffff;
    font-weight: 700;
    letter-spacing: 0.1vmin;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 1.5vmin;
    cursor: pointer;
    user-select: none;
}

.toggle-container input[type="checkbox"] {
    appearance: none;
    width: 5vmin;
    height: 2.5vmin;
    background: rgba(100, 100, 100, 0.5);
    border: 2px solid rgba(150, 150, 150, 0.5);
    border-radius: 2.5vmin;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-container input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 2vmin;
    height: 2vmin;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 0.2vmin;
    transform: translateY(-50%);
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-container input[type="checkbox"]:checked {
    background: linear-gradient(to right, #00ff88, #00ccff);
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.toggle-container input[type="checkbox"]:checked::before {
    left: calc(100% - 2.2vmin);
}

.toggle-label {
    color: #fff;
    font-size: 1.8vmin;
    font-weight: 500;
}

/* Duration Settings */
.duration-settings {
    margin-top: 2.5vmin;
    padding-top: 2vmin;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
}

.duration-settings h4 {
    margin: 0 0 1.5vmin 0;
    font-size: 1.8vmin;
    color: rgba(0, 255, 255, 0.8);
    font-weight: 700;
    letter-spacing: 0.1vmin;
}

.duration-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2vmin;
}

.duration-input-group label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6vmin;
    font-weight: 500;
}

.duration-input-group input[type="number"] {
    width: 8vmin;
    padding: 0.5vmin 1vmin;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: #00ffff;
    font-size: 1.6vmin;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
}

.duration-input-group input[type="number"]:focus {
    outline: none;
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.duration-input-group input[type="number"]:hover {
    border-color: rgba(0, 255, 255, 0.5);
}

/* ========================================
   ERROR BANNER
   ======================================== */

.error-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    max-width: 600px;
    width: 90%;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.error-content {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.95), rgba(200, 0, 50, 0.9));
    border: 2px solid rgba(255, 0, 0, 0.6);
    border-radius: 12px;
    padding: 2.5vmin;
    box-shadow:
        0 0 30px rgba(255, 0, 0, 0.5),
        inset 0 0 20px rgba(255, 100, 100, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.error-content h3 {
    margin: 0 0 1.5vmin 0;
    font-size: 2.5vmin;
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    letter-spacing: 0.1vmin;
}

.error-content p {
    margin: 0 0 2vmin 0;
    font-size: 1.8vmin;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.error-content button {
    padding: 1vmin 2.5vmin;
    font-size: 1.8vmin;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.error-content button:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

/* ========================================
   URL INPUT MODAL
   ======================================== */

.url-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    z-index: 10;
    max-width: 600px;
    width: 90%;
    background: linear-gradient(135deg, rgba(0, 30, 60, 0.95), rgba(0, 50, 80, 0.9));
    border: 2px solid rgba(0, 180, 255, 0.6);
    border-radius: 16px;
    padding: 4vmin;
    box-shadow:
        0 0 50px rgba(0, 180, 255, 0.5),
        inset 0 0 30px rgba(0, 180, 255, 0.15);
    animation: modalFadeIn 0.4s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 3vmin;
}

.modal-header h2 {
    margin: 0 0 1vmin 0;
    font-size: 3.5vmin;
    color: #00ccff;
    text-shadow: 0 0 15px rgba(0, 180, 255, 0.8);
    font-weight: 900;
    letter-spacing: 0.2vmin;
}

.modal-header p {
    margin: 0;
    font-size: 2vmin;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.modal-body {
    margin-bottom: 3vmin;
}

.input-section {
    margin-bottom: 2vmin;
}

.input-section:last-of-type {
    margin-bottom: 0;
}

.modal-body .input-label {
    display: block;
    margin-bottom: 1vmin;
    font-size: 1.8vmin;
    color: rgba(0, 200, 255, 0.9) !important;
    font-weight: 600;
    letter-spacing: 0.05vmin;
}

/* Divider */
.input-divider {
    display: flex;
    align-items: center;
    margin: 3vmin 0;
    text-align: center;
}

.input-divider::before,
.input-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(0, 180, 255, 0.3),
        transparent
    );
}

.input-divider span {
    padding: 0 2vmin;
    font-size: 1.8vmin;
    color: rgba(0, 180, 255, 0.6) !important;
    font-weight: 600;
}

/* File Input Styling */
.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5vmin;
    width: 100%;
    padding: 2vmin;
    background: rgba(0, 50, 80, 0.3);
    border: 2px dashed rgba(0, 180, 255, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.file-input-label:hover {
    background: rgba(0, 50, 80, 0.5);
    border-color: rgba(0, 180, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.3);
}

.file-input-label:active {
    transform: scale(0.98);
}

.file-icon {
    font-size: 3vmin;
}

.file-input-label .file-text {
    font-size: 2vmin;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
}

.file-input-label.file-selected {
    border-style: solid;
    border-color: rgba(0, 255, 100, 0.6);
    background: rgba(0, 80, 50, 0.3);
}

.file-input-label.file-selected .file-text {
    color: rgba(0, 255, 100, 0.9) !important;
}

.url-input {
    width: 100%;
    padding: 1.5vmin 2vmin;
    background: rgba(0, 50, 80, 0.3);
    border: 2px solid rgba(0, 180, 255, 0.4);
    border-radius: 8px;
    color: #ffffff;
    font-size: 2vmin;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 500;
    transition: all 0.3s;
    outline: none;
}

.url-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.url-input:focus {
    background: rgba(0, 50, 80, 0.5);
    border-color: rgba(0, 180, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.4);
}

.url-input.valid {
    border-color: rgba(0, 255, 100, 0.6);
    box-shadow: 0 0 10px rgba(0, 255, 100, 0.3);
}

.url-input.invalid {
    border-color: rgba(255, 50, 50, 0.6);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
}

.validation-message {
    margin-top: 1vmin;
    font-size: 1.6vmin;
    min-height: 2.5vmin;
    font-weight: 500;
    transition: all 0.2s;
}

.validation-message.valid {
    color: rgba(0, 255, 100, 0.9);
}

.validation-message.invalid {
    color: rgba(255, 100, 100, 0.9);
}

.modal-footer {
    display: flex;
    justify-content: center;
}

.submit-button {
    padding: 2vmin 6vmin;
    font-size: 2.2vmin;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(to bottom, #00aaff, #0077cc);
    border: 2px solid #00ccff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.6);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.3vmin;
}

.submit-button:hover:not(:disabled) {
    background: linear-gradient(to bottom, #00ccff, #0099ee);
    box-shadow: 0 0 30px rgba(0, 180, 255, 0.9);
    transform: translateY(-2px);
}

.submit-button:active:not(:disabled) {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.6);
}

.submit-button:disabled {
    background: rgba(50, 50, 50, 0.5);
    border-color: rgba(100, 100, 100, 0.5);
    color: rgba(150, 150, 150, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

/* ========================================
   MOBILE RESPONSIVE DESIGN
   ======================================== */

/* Mobile: URL Input Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 6vmin;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h2 {
        font-size: 6vmin;
    }

    .modal-header p {
        font-size: 3.5vmin;
    }

    .modal-body .input-label {
        font-size: 3.5vmin;
        margin-bottom: 2vmin;
    }

    .input-divider {
        margin: 4vmin 0;
    }

    .input-divider span {
        font-size: 3.5vmin;
        padding: 0 3vmin;
    }

    .file-input-label {
        padding: 4vmin;
        gap: 2vmin;
    }

    .file-icon {
        font-size: 6vmin;
    }

    .file-input-label .file-text {
        font-size: 3.5vmin;
    }

    .url-input {
        padding: 3vmin 3.5vmin;
        font-size: 3.5vmin;
        border-radius: 12px;
    }

    .validation-message {
        font-size: 3vmin;
        margin-top: 2vmin;
        min-height: 4vmin;
    }

    .submit-button {
        padding: 3.5vmin 8vmin;
        font-size: 4vmin;
        letter-spacing: 0.5vmin;
    }
}

/* Mobile: History Panel */
@media (max-width: 768px) {
    .history-panel {
        width: calc(70vw + 50px);
        min-width: auto; /* Remove fixed min-width to prevent overflow */
        max-width: calc(100vw - 20px); /* Ensure it doesn't exceed viewport */
    }

    .panel-content {
        left: 50px; /* Match toggle width */
        width: 70vw;
        min-width: auto; /* Remove fixed min-width */
        max-width: calc(100vw - 70px); /* Leave space for tab + margin */
    }

    .panel-toggle {
        width: 50px;
        height: 120px;
    }

    .history-panel.collapsed {
        transform: translateX(calc(100% - 50px)); /* Adjust for wider tab */
    }

    .menu-icon {
        width: 24px;
        height: 18px;
    }

    .menu-icon::before,
    .menu-icon::after {
        height: 3px;
    }

    .panel-header {
        padding: 3vmin 3.5vmin;
    }

    .panel-header h2 {
        font-size: 4.5vmin;
    }

    .history-list {
        padding: 3vmin;
    }

    .history-item {
        padding: 3vmin 3.5vmin;
        margin-bottom: 2vmin;
        font-size: 3.5vmin;
        gap: 2.5vmin;
    }

    .history-item .item-number {
        font-size: 4vmin;
        min-width: 6vmin;
    }

    .empty-state {
        font-size: 3.5vmin;
        padding: 5vmin;
    }

    .panel-actions {
        padding: 3vmin;
    }

    .action-button {
        padding: 3vmin 3.5vmin;
        font-size: 3.5vmin;
    }

    .panel-settings {
        padding: 3vmin 3.5vmin;
    }

    .panel-settings h3 {
        font-size: 3.5vmin;
        margin-bottom: 2.5vmin;
    }

    .toggle-container {
        gap: 2.5vmin;
    }

    .toggle-container input[type="checkbox"] {
        width: 8vmin;
        height: 4vmin;
        border-radius: 4vmin;
    }

    .toggle-container input[type="checkbox"]::before {
        width: 3.5vmin;
        height: 3.5vmin;
        left: 0.3vmin;
    }

    .toggle-container input[type="checkbox"]:checked::before {
        left: calc(100% - 3.8vmin);
    }

    .toggle-label {
        font-size: 3.5vmin;
    }

    .duration-settings {
        margin-top: 3.5vmin;
        padding-top: 3vmin;
    }

    .duration-settings h4 {
        font-size: 3.5vmin;
        margin-bottom: 2.5vmin;
    }

    .duration-input-group {
        margin-bottom: 2.5vmin;
    }

    .duration-input-group label {
        font-size: 3.5vmin;
    }

    .duration-input-group input[type="number"] {
        width: 12vmin;
        padding: 1.5vmin 2vmin;
        font-size: 3.5vmin;
        border-radius: 6px;
    }
}

/* Mobile: Error Banner */
@media (max-width: 768px) {
    .error-banner {
        width: 95%;
        top: 15px;
    }

    .error-content {
        padding: 4vmin;
    }

    .error-content h3 {
        font-size: 4.5vmin;
        margin-bottom: 2.5vmin;
    }

    .error-content p {
        font-size: 3.5vmin;
        margin-bottom: 3vmin;
    }

    .error-content button {
        padding: 2.5vmin 4vmin;
        font-size: 3.5vmin;
    }
}

/* Small Mobile: iPhone SE and similar */
@media (max-width: 430px) {
    .history-panel {
        width: calc(80vw + 50px);
    }

    .panel-content {
        width: 80vw;
    }
}

/* Very Small Mobile: Smaller devices like iPhone SE (375px) */
@media (max-width: 390px) {
    .history-panel {
        width: calc(85vw + 45px);
    }

    .panel-content {
        left: 45px; /* Match toggle width */
        width: 85vw;
    }

    .panel-toggle {
        width: 45px;
        height: 110px;
    }

    .history-panel.collapsed {
        transform: translateX(calc(100% - 45px));
    }
}

/* Mobile Landscape: Ensure panel content is scrollable */
@media (max-width: 896px) and (max-height: 414px) {
    .panel-content {
        overflow-y: auto;
    }

    .panel-header {
        flex-shrink: 0;
    }

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

    .panel-settings {
        flex-shrink: 0;
    }

    .history-list {
        flex-shrink: 1;
        min-height: 100px;
    }
}