/**
 * Children's Lift Game - Styles
 * Fixed 1440x900px layout with child-friendly design
 */

/* ============== RESET & BASE ============== */

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

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    /*background: rgb(255, 255, 255);*/
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ============== SCREEN MANAGEMENT ============== */

.screen {
    display: none;
    width: 1440px;
    height: 840px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.screen.active {
    display: block;
}

/* ============== LOGIN SCREEN ============== */

#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 60px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
}

.game-title {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 40px;
    font-weight: bold;
}

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

.input-field {
    padding: 12px 16px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.game-header #admin-btn {
    Max-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 34px;
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
}

.success-message {
    color: #27ae60;
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
    font-weight: bold;
}

.password-requirements {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

.password-requirements p {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.password-requirements ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
}

.password-requirements li {
    margin: 5px 0;
    transition: color 0.3s ease;
}

.password-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.password-input-wrapper .input-field {
    padding-right: 70px;
    margin-bottom: 0;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.toggle-password:hover {
    background: #2980b9;
}

.toggle-password:active {
    background: #21618c;
}

.login-help {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
    color: #666;
    font-size: 14px;
}

.login-help p {
    margin: 5px 0;
}

/* ============== GAME SCREEN ============== */

.game-container {
    width: 100%;
    height: 100%;
    background: #000000;
    position: relative;
    overflow: hidden;
}

.screen.active .game-container {
    animation: fadeInGame 0.3s ease-in forwards;
}

@keyframes fadeInGame {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, var(--header-color, #2f7b74), var(--header-color-end, rgba(47, 123, 116, 0.6)));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.header-content-wrapper {
    width: 1440px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

.user-info {
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 18px;
}

#username-display {
    font-weight: bold;
}

.game-header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-link {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.header-link:hover {
    background: rgba(255, 255, 255, 0.15);
    text-decoration: underline;
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    display: inline-block;
    margin: 0 8px;
}

.custom-dropdown-button {
    padding: 8px 12px;
    font-size: 13px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    min-width: 180px;
    text-align: left;
    transition: border-color 0.3s;
}

.custom-dropdown-button:hover {
    border-color: #667eea;
}

.custom-dropdown-button.active {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 180px;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: width 0.3s ease;
}

.custom-dropdown-menu.active {
    display: block;
    width: auto;
    max-width: 600px;
    max-height: 500px;
}

.custom-dropdown-option {
    padding: 15px 12px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.custom-dropdown-option:hover {
    background-color: #f5f5f5;
}

.custom-dropdown-option:last-child {
    border-bottom: none;
}

/* ============== PIXI CANVAS ============== */

#pixi-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 1440px;
    height: 840px;
    font-size: 0;
    line-height: 0;
}

#pixi-container canvas {
    display: block;
    font-size: 16px;
    line-height: 1;
}

.screen:not(.active) #pixi-container,
.screen:not(.active) .keypad-container {
    display: none;
}

/* ============== KEYPAD ============== */

.keypad-container {
    position: absolute;
    bottom: 40px;
    left: 40px;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border: 3px solid #1a252f;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 50;
    cursor: default;
    transition: all 1.0s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1;
    transform: translateX(0) scaleX(1);
    pointer-events: auto;
    transform-origin: left bottom;
}

.keypad-container.dragging {
    cursor: grabbing;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    transform: scaleX(1.02);
}

.keypad-container.collapsed {
    /* Final state: smoothly slide left and compress */
    opacity: 0;
    transform: translateX(-100px) scaleX(0.2);
    pointer-events: none;
}

.keypad-container.collapsed .keypad-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.keypad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s;
    color: #ffffff;
    font-size: 24px;
}

.drag-handle:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #ecf0f1;
    font-size: 24px;
    font-weight: bold;
    width: 44px;
    height: 44px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.collapse-btn:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

.collapse-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 2px;
}

.keypad-content {
    display: block;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1;
    pointer-events: auto;
}

.keypad-content.hidden {
    opacity: 0;
    pointer-events: none;
}

.floor-display {
    text-align: center;
    margin-bottom: 15px;
}

#current-floor-display {
    font-size: 48px;
    font-weight: bold;
    color: #3498db;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 10px;
    min-width: 80px;
    display: inline-block;
}

.floor-label {
    color: #ecf0f1;
    font-size: 12px;
    margin-top: 5px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.keypad-btn {
    width: 70px;
    height: 70px;
    font-size: 24px;
    font-weight: bold;
    border: 2px solid #1a252f;
    border-radius: 10px;
    background: linear-gradient(145deg, #3d5a80, #2c4055);
    color: #ecf0f1;
    cursor: pointer;
    transition: all 0.2s;
}

.keypad-btn:hover {
    background: linear-gradient(145deg, #4a6fa5, #3d5a80);
    transform: scale(1.05);
}

.keypad-btn:active {
    transform: scale(0.95);
}

.keypad-btn.active {
    background: linear-gradient(145deg, #f39c12, #e67e22);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
}

.keypad-clear {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.keypad-go {
    background: linear-gradient(145deg, #27ae60, #229954);
}

.keypad-clear:hover {
    background: linear-gradient(145deg, #ec7063, #e74c3c);
}

.keypad-go:hover {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.target-display {
    text-align: center;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.target-label {
    color: #ecf0f1;
    font-size: 12px;
    margin-bottom: 5px;
}

#target-floor-display {
    font-size: 36px;
    font-weight: bold;
    color: #f39c12;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 5px 15px;
    display: inline-block;
    min-width: 60px;
}

/* ============== STORY LIST IN KEYPAD ============== */

.story-list-section {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.story-list-button {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 0;
    background: linear-gradient(145deg, #3d5a80, #2c4055);
    color: #ecf0f1;
    border: 2px solid #1a252f;
    border-radius: 10px 10px 0 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.story-list-button i {
    font-size: 16px;
}

.story-list-button:hover {
    background: linear-gradient(145deg, #4a6fa5, #3d5a80);
    transform: scale(1.02);
}

.story-list-button:active {
    transform: scale(0.98);
}

.story-list-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border: 2px solid #1a252f;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    max-height: 350px;
    overflow-y: auto;
    margin-top: 0;
}

.story-list-panel.active {
    display: block;
}

.story-list-items {
    display: flex;
    flex-direction: column;
}

.story-list-item {
    padding: 12px 15px;
    color: #ecf0f1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.story-list-item:hover {
    background: rgba(52, 152, 219, 0.3);
    padding-left: 20px;
}

.story-list-item.active {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: #fff;
    font-weight: 600;
}

/* Scrollbar styling for story list */
.story-list-panel::-webkit-scrollbar {
    width: 8px;
}

.story-list-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.story-list-panel::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 10px;
}

.story-list-panel::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Hide keypad controls when story list is open */
.keypad-controls {
    transition: opacity 0.3s, visibility 0.3s;
    opacity: 1;
    visibility: visible;
}

.keypad-controls.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Collapsed Keypad View - Left Side Panel */
.keypad-collapsed {
    display: flex;
    position: absolute;
    left: -90px;
    top: 60px;
    width: 90px;
    height: auto;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border: 3px solid #1a252f;
    border-left: none;
    border-radius: 0 20px 20px 0;
    padding: 10px;
    padding-right: 15px;
    box-shadow: 5px 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 50;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease;
    visibility: hidden;
    opacity: 0;
}

.keypad-collapsed.active {
    visibility: visible;
    opacity: 1;
    left: 0;
}

.collapsed-controls-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
}

.expand-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0;
    min-width: 50px;
    order: 1;
}

.expand-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.expand-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.arrow-btn-inline {
    width: 50px;
    height: 50px;
    font-size: 22px;
    font-weight: bold;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0;
    min-width: 50px;
}

#arrow-up {
    order: 2;
}

#arrow-down {
    order: 3;
}

.arrow-btn-inline:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.arrow-btn-inline:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.arrow-btn-inline:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.arrow-btn-inline:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

/* Collapsed Drag Handle Container */
.collapsed-drag-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* margin-top: 10px; */
    /* padding: 6px; */
    /* border-radius: 8px; */
    /* background: rgba(0, 0, 0, 0.2); */
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
    width: 50px;
    height: 50px;
}

.collapsed-drag-handle:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

.collapsed-drag-handle:active {
    cursor: grabbing;
    background: rgba(0, 0, 0, 0.4);
}

/* Grip icon for collapsed drag handle */
.grip-icon {
    width: 60%;
    height: 60%;
    fill: rgba(255, 255, 255, 0.1);
    transition: fill 0.2s;
}

.collapsed-drag-handle:hover .grip-icon {
    fill: rgba(255, 255, 255, 0.3);
}

/* ============== ADMIN SCREEN ============== */

.admin-container {
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.admin-header h2 {
    font-size: 24px;
    margin: 0;
}

.admin-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.admin-header-actions #back-to-game-btn {
    Max-width: 150px;
}

.admin-notification {
    min-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.admin-notification.show {
    animation: slideDown 0.3s ease;
}

.admin-notification-message {
    padding: 15px 30px;
    margin: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.admin-notification-message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.admin-notification-message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.admin-notification-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.admin-notification-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    margin-left: 15px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.admin-notification-close:hover {
    opacity: 1;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.admin-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Navigation Menu */
.admin-nav {
    width: 200px;
    background: #2c3e50;
    flex-shrink: 0;
    overflow-y: auto;
}

.admin-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-nav-link {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 25px;
}

.admin-nav-link.active {
    background: #667eea;
    border-left: 4px solid #fff;
    padding-left: 16px;
}

/* Admin parent menu styling */
.admin-nav-parent {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-nav-toggle {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background: #3a495f;
    color: #ecf0f1;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: all 0.3s;
}

.admin-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 25px;
}

.admin-nav-toggle.active {
    background: #667eea;
    color: #fff;
}

/* Submenu styling */
.admin-nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #1e2a38;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.admin-nav-submenu.active {
    max-height: 500px;
}

.admin-nav-submenu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-nav-submenu .admin-nav-link {
    padding-left: 40px;
    font-size: 13px;
    color: #bdc3c7;
}

.admin-nav-submenu .admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 45px;
}

.admin-nav-submenu .admin-nav-link.active {
    background: #667eea;
    border-left: 4px solid #fff;
    padding-left: 36px;
}

/* Main Content Area */
.admin-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f5f6fa;
}

.admin-section {
    display: none;
    background: white;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-section.active {
    display: block;
}

.admin-section h3 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 20px;
    margin-top: 0;
    font-weight: 600;
}

.admin-section h4 {
    color: #34495e;
    margin-bottom: 12px;
    font-size: 15px;
    margin-top: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #667eea;
}

/* Responsive Grid for Upload Media */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.admin-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e9ecef;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-input {
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.file-name-label {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    background-color: #e8f5e9;
    border-left: 3px solid #4caf50;
    border-radius: 4px;
    font-size: 13px;
    color: #2e7d32;
    word-break: break-word;
}

.sound-status {
    margin-top: 12px;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
    display: none;
}

.sound-status.uploaded {
    display: block;
}

.sound-status.uploaded::before {
    content: "";
    display: none;
}

/* File Selection UI */
.file-selection-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
}

.file-button-row {
    display: flex;
    width: 100%;
    gap: 8px;
}

.file-button-row .btn-option {
    flex: 1;
    padding: 10px 16px;
    background-color: #f3f4f6;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.2s ease;
    text-align: center;
}

.file-button-row .btn-option:hover {
    background-color: #e4e7eb;
}

.file-button-row .btn-option.active {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}

.file-selection-group.waiting-library {
    border: 2px dashed #0d6efd;
    border-radius: 8px;
    padding: 12px;
    background-color: rgba(13, 110, 253, 0.08);
}

.file-display-container {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #e8f5e9;
    border-left: 3px solid #4caf50;
    border-radius: 4px;
    flex: 1;
    width: 100%;
    min-width: 0;
}

.file-display-container.has-file {
    display: flex;
}

.file-display-container.has-no-file {
    display: flex;
    background-color: #ededed;
    border: 1px dashed #636363;
    padding: 8px 12px;
    justify-content: flex-start;
    align-items: center;
    min-height: 40px;
}

.file-display-container.has-no-file .file-name-display {
    display: none;
}

.no-file-text {
    font-size: 13px;
    color: #636363;
    font-style: italic;
    margin: 0;
    padding: 0;
}

.file-display-container.has-no-file .no-file-text {
    margin-left: 0;
    padding-left: 0;
}

.file-name-display {
    flex: 1;
    font-size: 13px;
    color: #2e7d32;
    word-break: break-word;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-display-container.has-no-file .btn-delete-file {
    display: none;
}

.btn-delete-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background-color: #ef5350;
    border: none;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-delete-file:hover {
    background-color: #e53935;
    transform: scale(1.1);
}

.btn-delete-file:active {
    background-color: #d32f2f;
}

/* Lift Background Thumbnail */
#lift-background-thumbnail-container {
    margin-top: 15px;
    text-align: center;
    display: none !important;
}

#lift-background-thumbnail-container[style*="display: block"],
#lift-background-thumbnail-container[style*="display:block"] {
    display: block !important;
}

.lift-background-thumbnail {
    display: inline-block;
    width: 150px;
    height: 150px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    object-fit: contain;
    background-color: #f0f0f0;
    image-rendering: high-quality;
}

.lift-background-thumbnail:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* Audio Volume Control */
.audio-volume-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background-color: #f0f4f8;
    border-radius: 6px;
    margin-top: 8px;
    min-height: 40px;
}

.audio-volume-control label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    margin: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.audio-volume-slider {
    flex: 1;
    min-width: 100px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    vertical-align: middle;
    align-self: center;
}

.audio-volume-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #0d6efd 0%, #0d6efd var(--slider-fill), #ddd var(--slider-fill), #ddd 100%);
}

.audio-volume-slider::-moz-range-track {
    background: transparent;
    border: none;
}

.audio-volume-slider::-moz-range-progress {
    background: #0d6efd;
    border-radius: 3px;
    height: 6px;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
    margin-top: -5px;
}

.audio-volume-slider::-webkit-slider-thumb:hover {
    background: #0b5ed7;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

.audio-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
    margin-top: -5px;
}

.audio-volume-slider::-moz-range-thumb:hover {
    background: #0b5ed7;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

.volume-value {
    font-size: 12px;
    font-weight: 600;
    color: #0d6efd;
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
    display: flex;
    align-items: center;
    height: 100%;
}

.admin-floor-list {
    display: grid;
    gap: 12px;
}

.admin-floor-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-floor-info {
    flex: 0 0 auto;
}

.admin-floor-info h4 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.admin-floor-info p {
    color: #7f8c8d;
    font-size: 13px;
    margin: 0;
}

.admin-floor-media {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.floor-media-column-left,
.floor-media-column-right {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex: 0 0 auto;
    align-self: flex-start;
}

.floor-media-section {
    display: flex;
    gap: 20px;
    flex: 0 1 auto;
    min-width: auto;
    flex-direction: column;
    align-items: center;
}

.floor-image-subsection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    align-self: flex-start;
}

.floor-sound-subsection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: auto;
    align-self: flex-start;
}

.floor-script-subsection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: auto;
    align-self: flex-start;
}

.floor-media-label {
    color: #2c3e50;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.floor-sound-name {
    color: #7f8c8d;
    font-size: 12px;
    margin: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 200px;
    text-align: center;
}

.floor-script-status {
    color: #7f8c8d;
    font-size: 12px;
    margin: 0;
    text-align: center;
}

.floor-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
}

.floor-thumbnail-placeholder {
    width: 80px;
    height: 80px;
    background: #e0e0e0;
    border: 2px dashed #999;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    text-align: center;
}

.admin-floor-actions {
    display: flex;
    gap: 8px;
    align-self: flex-start;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Media button group - container for upload and delete buttons */
.media-button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Delete media button - X icon */
.btn-delete-media {
    width: 34px;
    height: 34px;
    padding: 0;
    min-height: unset;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.btn-delete-media:hover {
    background: #c0392b;
}

/* ============== MANAGE FLOORS SECTION ============== */

.manage-floors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.manage-floors-header h3 {
    margin: 0;
}

.view-toggle-controls {
    display: flex;
    gap: 8px;
}

.view-toggle-btn {
    background: #e8eef5;
    color: #2c3e50;
    border: 2px solid #ddd;
}

.view-toggle-btn:hover {
    background: #d4dce8;
    border-color: #667eea;
}

.view-toggle-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.add-floor-card {
    background: white;
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.add-floor-card h4 {
    color: #2c3e50;
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.add-floor-inputs {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.add-floor-inputs .input-field {
    flex: 1;
    min-width: 150px;
}

.add-floor-inputs .btn {
    flex-shrink: 0;
}

/* Grid View Styles */
.admin-floor-list.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.admin-floor-list.grid-view .admin-floor-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-floor-list.grid-view .admin-floor-info {
    flex-shrink: 0;
}

.admin-floor-list.grid-view .admin-floor-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
}

.admin-floor-list.grid-view .admin-floor-media {
    flex-direction: column;
    gap: 20px;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.admin-floor-list.grid-view .floor-media-column-left,
.admin-floor-list.grid-view .floor-media-column-right {
    flex: 0 0 auto;
    gap: 16px;
    flex-direction: row;
    align-self: flex-start;
}

.admin-floor-list.grid-view .floor-media-section {
    flex-direction: column;
    gap: 20px;
    min-width: unset;
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Image subsections container */
.admin-floor-list.grid-view .floor-media-section > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.admin-floor-list.grid-view .floor-image-subsection {
    gap: 10px;
    align-items: center;
    width: auto;
    display: flex;
    flex-direction: column;
}

.admin-floor-list.grid-view .floor-media-label {
    font-size: 13px;
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
    text-align: center;
}

.admin-floor-list.grid-view .floor-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}

.admin-floor-list.grid-view .floor-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-floor-list.grid-view .floor-thumbnail-placeholder {
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
}

/* Buttons container for images and sounds */
.admin-floor-list.grid-view .floor-media-section .btn,
.admin-floor-list.grid-view .floor-sound-subsection .btn,
.admin-floor-list.grid-view .floor-script-subsection .btn {
    padding: 9px 18px;
    font-size: 13px;
    width: auto;
    height: auto;
    min-height: unset;
}

/* Sound section */
.admin-floor-list.grid-view .floor-sound-subsection {
    flex: 0 1 auto;
    align-items: center;
    gap: 10px;
    min-width: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: auto;
}

.admin-floor-list.grid-view .floor-sound-name {
    font-size: 12px;
    max-width: none;
    color: #7f8c8d;
    text-align: center;
}

/* Script section */
.admin-floor-list.grid-view .floor-script-subsection {
    flex: 0 1 auto;
    align-items: center;
    gap: 10px;
    min-width: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: auto;
}

.admin-floor-list.grid-view .floor-script-status {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
    margin: 0;
}

/* Actions at bottom */
.admin-floor-list.grid-view .admin-floor-actions {
    flex-shrink: 0;
    gap: 10px;
    display: flex;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.admin-floor-list.grid-view .admin-floor-actions .btn {
    padding: 10px 24px;
    font-size: 13px;
}

/* List View Styles */
.admin-floor-list.list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.admin-floor-list.list-view .admin-floor-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.admin-floor-list.list-view .admin-floor-item:last-child {
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
}

.admin-floor-list.list-view .admin-floor-item:first-child {
    border-radius: 8px 8px 0 0;
}

.admin-floor-list.list-view .admin-floor-item.collapsed {
    border-radius: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.admin-floor-list.list-view .admin-floor-item.collapsed:first-child {
    border-radius: 8px;
}

/* Collapsed List Item (single line) */
.admin-floor-list.list-view .admin-floor-item.collapsed .admin-floor-info {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .admin-floor-info:hover {
    background-color: #f5f5f5;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .admin-floor-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.admin-floor-list.list-view .floor-thumbnail-preview {
    display: none;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .floor-thumbnail-preview {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .floor-thumbnail-preview-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* List view expanded - larger image previews */
.admin-floor-list.list-view .admin-floor-item.expanded .floor-thumbnail-preview-img {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .floor-thumbnail-preview-placeholder {
    width: 50px;
    height: 50px;
    background: #e0e0e0;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
}

.admin-floor-list.list-view .admin-floor-item.collapsed .expand-indicator {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s;
}

/* Expanded List Item */
.admin-floor-list.list-view .admin-floor-item.expanded {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
    background: white;
}

.admin-floor-list.list-view .admin-floor-item.expanded .admin-floor-info {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-floor-list.list-view .admin-floor-item.expanded .admin-floor-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.admin-floor-list.list-view .admin-floor-item.expanded .expand-indicator {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s;
    transform: rotate(180deg);
}

.admin-floor-list.list-view .admin-floor-item.expanded .admin-floor-media {
    padding: 20px;
    flex-direction: column;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-media-column-left,
.admin-floor-list.list-view .admin-floor-item.expanded .floor-media-column-right {
    flex: 0 0 auto;
    gap: 16px;
    flex-direction: row;
    align-self: flex-start;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-media-section {
    min-width: auto;
    gap: 10px;
    flex-direction: column;
    align-items: center;
    display: flex;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-image-subsection {
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-media-label {
    font-size: 13px;
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-thumbnail-placeholder {
    width: 80px;
    height: 80px;
    background: #e0e0e0;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-sound-subsection {
    flex: 0 1 auto;
    gap: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-script-subsection {
    flex: 0 1 auto;
    gap: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-floor-list.list-view .admin-floor-item.expanded .floor-media-section .btn,
.admin-floor-list.list-view .admin-floor-item.expanded .floor-sound-subsection .btn,
.admin-floor-list.list-view .admin-floor-item.expanded .floor-script-subsection .btn {
    padding: 9px 18px;
    font-size: 13px;
    height: auto;
    min-height: unset;
}

.admin-floor-list.list-view .admin-floor-item.expanded .admin-floor-actions {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    align-self: stretch;
    gap: 10px;
    display: flex;
    justify-content: center;
}

/* ============== IMAGE PREVIEW POPUP ============== */

.image-preview-popup {
    position: fixed;
    display: none;
    z-index: 500;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 8px;
    max-width: 300px;
}

.image-preview-popup.active {
    display: block;
}

.image-preview-popup img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    border-radius: 4px;
}

/* ============== CONFIRMATION MODAL ============== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
    margin-top: 0;
}

.modal-content p {
    color: #7f8c8d;
    margin-bottom: 25px;
    font-size: 14px;
}

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

.modal-actions button {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* ============== LOADING INDICATOR ============== */

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-indicator.active {
    display: flex;
}

/* SK Folding Cube Spinner */
.spinner-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    position: relative;
    width: 100px;
    height: 100px;
}

.sk-folding-cube {
    margin: 0 auto;
    width: 40px;
    height: 40px;
    position: relative;
    transform: rotateZ(45deg);
}

.sk-folding-cube .sk-cube {
    float: left;
    width: 50%;
    height: 50%;
    position: relative;
    transform: scale(1.1);
}

.sk-folding-cube .sk-cube:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #001F3F;
    animation: sk-foldCubeAngle 2.4s infinite linear both;
    transform-origin: 100% 100%;
}

.sk-folding-cube .sk-cube2 {
    transform: scale(1.1) rotateZ(90deg);
}

.sk-folding-cube .sk-cube3 {
    transform: scale(1.1) rotateZ(180deg);
}

.sk-folding-cube .sk-cube4 {
    transform: scale(1.1) rotateZ(270deg);
}

.sk-folding-cube .sk-cube2:before {
    animation-delay: 0.3s;
}

.sk-folding-cube .sk-cube3:before {
    animation-delay: 0.6s;
}

.sk-folding-cube .sk-cube4:before {
    animation-delay: 0.9s;
}

@keyframes sk-foldCubeAngle {
    0%, 10% {
        transform: perspective(140px) rotateX(-180deg);
        opacity: 0;
    }
    25%, 75% {
        transform: perspective(140px) rotateX(0deg);
        opacity: 1;
    }
    90%, 100% {
        transform: perspective(140px) rotateY(180deg);
        opacity: 0;
    }
}

/* Initially hide game content while loading */
#game-screen {
    display: none;
}

#game-screen.loaded {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Enhanced loading screen */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    text-align: center;
}

.loading-text {
    color: white;
    font-size: 44px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 100px;
}

.loading-message {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    margin-top: 0;
    font-weight: 400;
    letter-spacing: 0.3px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* ============== SCROLLBAR STYLING ============== */

.admin-container::-webkit-scrollbar {
    width: 8px;
}

.admin-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.admin-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.admin-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* ============== LIFT STYLE CUSTOMIZATION ============== */

.lift-style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 13px;
    color: #34495e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.range-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.lift-preview-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.lift-preview-container h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.zoom-btn {
    padding: 8px 15px;
    font-size: 16px;
    font-weight: bold;
    min-width: 40px;
    background: #667eea;
    color: white;
}

.zoom-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.lift-preview {
    width: 200px;
    height: 250px;
    margin: 0 auto;
    position: relative;
    background: #87CEEB;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lift-preview::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 180px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============== RESPONSIVE ADJUSTMENTS ============== */

/* Game scaling is now handled dynamically by tablet-support.js */
/* Static media queries removed to allow JS to calculate optimal scale */

/* ============== RESPONSIVE KEYPAD FOR TABLETS/iPAD ============== */

/* iPad/Tablet viewport optimization - when height or width is limited */
@media (max-height: 800px) {
    .keypad-container {
        bottom: 20px;
        left: 20px;
        padding: 12px;
    }

    .keypad {
        gap: 8px;
        margin-bottom: 10px;
    }

    .keypad-btn {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }

    #current-floor-display {
        font-size: 40px;
        padding: 8px;
        min-width: 70px;
    }

    .floor-label {
        font-size: 10px;
    }
}

@media (max-width: 1000px) {
    .keypad-container {
        bottom: 20px;
        left: 20px;
        padding: 12px;
    }

    .keypad {
        gap: 8px;
        margin-bottom: 10px;
    }

    .keypad-btn {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }

    #current-floor-display {
        font-size: 40px;
        padding: 8px;
        min-width: 70px;
    }

    .floor-label {
        font-size: 10px;
    }
}

/* Small iPad/Tablet - further size reduction */
@media (max-height: 700px) {
    .keypad-container {
        bottom: 15px;
        left: 15px;
        padding: 10px;
    }

    .keypad {
        gap: 6px;
        margin-bottom: 8px;
    }

    .keypad-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    #current-floor-display {
        font-size: 32px;
        padding: 6px;
        min-width: 60px;
    }

    .floor-label {
        font-size: 9px;
        margin-top: 3px;
    }

    .drag-handle {
        font-size: 18px;
        padding: 4px;
    }

    .collapse-btn {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

@media (max-width: 800px) {
    .keypad-container {
        bottom: 15px;
        left: 15px;
        padding: 10px;
    }

    .keypad {
        gap: 6px;
        margin-bottom: 8px;
    }

    .keypad-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    #current-floor-display {
        font-size: 32px;
        padding: 6px;
        min-width: 60px;
    }

    .floor-label {
        font-size: 9px;
        margin-top: 3px;
    }

    .drag-handle {
        font-size: 18px;
        padding: 4px;
    }

    .collapse-btn {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

/* iPhone/Very small viewport */
@media (max-height: 600px) {
    .keypad-container {
        bottom: 10px;
        left: 10px;
        padding: 8px;
    }

    .keypad {
        gap: 5px;
        margin-bottom: 6px;
    }

    .keypad-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    #current-floor-display {
        font-size: 28px;
        padding: 5px;
        min-width: 50px;
    }
}

@media (max-width: 600px) {
    .keypad-container {
        bottom: 10px;
        left: 10px;
        padding: 8px;
    }

    .keypad {
        gap: 5px;
        margin-bottom: 6px;
    }

    .keypad-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    #current-floor-display {
        font-size: 28px;
        padding: 5px;
        min-width: 50px;
    }
}

/* ============== ADMIN LOGIN BUTTON ============== */

.admin-login-trigger {
    display: none;
}

/* ============== ADMIN LOGIN MODAL ============== */

#admin-login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

#admin-login-modal.active {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(2px);
}

.login-modal {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    padding: 0;
    animation: slideUp 0.3s ease;
}

#admin-login-modal.active .login-modal {
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #333;
}

.login-modal .login-form {
    padding: 20px;
    margin: 0;
}

.login-modal .input-field {
    margin-bottom: 15px;
}

.login-modal .btn {
    width: 100%;
    margin-top: 10px;
}

/* ============== LIFT INTERIOR ADMIN PANEL STYLES ============== */

#lift-interior .admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

#lift-interior .setting-group {
    margin-bottom: 15px;
}

#lift-interior .setting-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

#lift-interior .setting-group input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

#lift-interior .checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
}

#lift-interior .checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

#lift-interior .checkbox-label span {
    color: #555;
}

#lift-interior .theme-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

#lift-interior .theme-buttons button {
    padding: 8px 12px;
}

#lift-interior .color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#lift-interior .color-picker {
    width: 50px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

#lift-interior .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

#lift-interior .info-text {
    background: #f0f7ff;
    border-left: 3px solid #3498db;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
}

#lift-interior .info-text strong {
    color: #3498db;
    font-weight: 600;
}

#lift-interior-status-message {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
}

#lift-interior-status-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

#lift-interior-status-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

#lift-interior-status-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ============== GAME POPUP NOTIFICATION ============== */

.game-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: auto;
}

.game-popup-content {
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #FFD700;
    border-radius: 15px;
    padding: 30px 50px;
    text-align: center;
    min-width: 400px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.game-popup-content p {
    color: white;
    font-size: 20px;
    font-weight: bold;
    margin: 0;
    font-family: 'Arial', sans-serif;
}

/* ============== STORY PLAYER OVERLAY ============== */

.story-player-overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9500;
    max-width: 500px;
    width: 380px;
    aspect-ratio: 16 / 9;
}

.story-player-container {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8c 100%);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: slideInUp 0.3s ease-out;
    border: 1px solid rgba(100, 180, 255, 0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.story-player-header {
    background: linear-gradient(135deg, #0f2847 0%, #1a3f5a 100%);
    color: white;
    padding: 8px 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(100, 180, 255, 0.2);
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.story-player-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-player-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 11px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.story-player-close:hover {
    background: rgba(100, 180, 255, 0.2);
}

.story-player-close:active {
    background: rgba(100, 180, 255, 0.35);
    transform: scale(0.95);
}

.story-player-close:focus-visible {
    outline: 2px solid rgba(100, 180, 255, 0.6);
    outline-offset: 2px;
}

.story-player-content-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
}

.story-player-body {
    flex: 1;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: hidden;
}

.story-player-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.story-player-btn {
    background: rgba(100, 180, 255, 0.15);
    border: 1.5px solid rgba(100, 180, 255, 0.4);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.story-player-btn:hover {
    background: rgba(100, 180, 255, 0.25);
    transform: scale(1.08);
    border-color: rgba(100, 180, 255, 0.6);
}

.story-player-btn:active {
    transform: scale(0.95);
}

.story-player-play {
    width: 38px;
    height: 38px;
    font-size: 16px;
    background: rgba(100, 180, 255, 0.25);
    border-color: rgba(100, 180, 255, 0.5);
}

.story-player-play.paused {
    background: rgba(100, 180, 255, 0.2);
}

.story-player-progress-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.story-player-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 9px;
    font-weight: 600;
    min-width: 30px;
}

.story-player-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(100, 180, 255, 0.15);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.story-player-progress-fill {
    height: 100%;
    background: rgba(100, 180, 255, 0.7);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.story-player-seekbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
    -webkit-appearance: none;
    appearance: none;
}

.story-player-seekbar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64b4ff;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(100, 180, 255, 0.6);
}

.story-player-seekbar::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64b4ff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(100, 180, 255, 0.6);
}

/* Story player vertical volume control */
.story-player-volume-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    background: rgba(15, 40, 71, 0.3);
    border-left: 1px solid rgba(100, 180, 255, 0.15);
    flex-shrink: 0;
}

.story-player-volume-vertical > i {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.story-player-volume-vertical-slider {
    width: 3px;
    height: 80px;
    background: rgba(100, 180, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    writing-mode: vertical-lr;
    direction: rtl;
}

.story-player-volume-vertical-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64b4ff;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(100, 180, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.story-player-volume-vertical-slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64b4ff;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 4px rgba(100, 180, 255, 0.6);
}

.story-player-volume-vertical-slider::-moz-range-track {
    background: transparent;
    border: none;
}

/* ============== STORY PLAYER COLLAPSED STATE ============== */

.story-player-overlay.collapsed {
    width: 220px;
    aspect-ratio: auto;
}

.story-player-overlay.collapsed .story-player-content-wrapper {
    display: none;
}

/* ============== LIFT CONFIGURATION TABS ============== */

.tabs-container {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    background: #f5f5f5;
    border-radius: 6px 6px 0 0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.tab-btn.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
    background: white;
}

.tab-content {
    display: none;
    padding: 20px 0;
    animation: fadeIn 0.3s ease;
}

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

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

/* ============== HELP SYSTEM ============== */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background-color: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    vertical-align: middle;
    pointer-events: auto;
    position: relative;
    z-index: 100;
}

.help-icon:hover {
    background-color: #5568d3;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.help-modal.active {
    display: flex !important;
}

.help-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 1000000;
}

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

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.help-modal-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
}

.help-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-modal-close:hover {
    transform: rotate(90deg);
}

.help-modal-body {
    padding: 20px;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.help-modal-body p {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============== COOKIE CONSENT BANNER ============== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #f9f9f9;
    color: #333;
    padding: 20px;
    border-top: 1px solid #ccc;
    font-family: "Roboto", "Open Sans", sans-serif;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: none;
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-text-section {
    flex: 1;
    min-width: 250px;
}

.cookie-header {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.cookie-text {
    margin: 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#accept-all,
#reject-nonessential,
#manage-preferences {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#accept-all {
    background-color: #007bff;
    color: white;
}

#accept-all:hover {
    background-color: #0056b3;
}

#reject-nonessential {
    background-color: #ccc;
    color: #000;
}

#reject-nonessential:hover {
    background-color: #aaa;
}

#manage-preferences {
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ccc;
}

#manage-preferences:hover {
    background-color: #e0e0e0;
}

/* ============== COOKIE PREFERENCES MODAL ============== */

.cookie-modal {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    display: none;
}

.cookie-modal.show {
    display: block;
}

.cookie-modal-content {
    padding: 25px;
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.cookie-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex: 1;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.cookie-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.cookie-modal-content > p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
}

.cookie-option {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.cookie-option:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cookie-option label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.cookie-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cookie-option input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.cookie-description {
    margin: 8px 0 0 28px;
    font-size: 12px;
    color: #666;
}

.cookie-modal-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

#save-preferences {
    flex: 1;
    padding: 10px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

#save-preferences:hover {
    background-color: #0056b3;
}

.cookie-modal-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.cookie-modal-footer p {
    margin: 0;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-text {
        min-width: 100%;
    }

    .cookie-buttons {
        width: 100%;
    }

    .cookie-buttons button {
        flex: 1;
    }

    .cookie-modal {
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 95%;
        max-width: 90%;
    }
}

/* ============== STORY PLAYER AUTOPLAY TOGGLE ============== */

.story-player-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.autoplay-toggle-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 2px;
    padding: 0;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.autoplay-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    position: relative;
    z-index: 1;
}

.autoplay-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    cursor: pointer;
    z-index: 1;
    position: relative;
}

.autoplay-slider-wrapper {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.autoplay-checkbox {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
    margin: 0;
    top: 0;
    left: 0;
}

.autoplay-slider {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background-color: rgba(100, 180, 255, 0.2);
    border-radius: 34px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1;
    pointer-events: all;
    user-select: none;
    border: 1px solid rgba(100, 180, 255, 0.3);
}

.autoplay-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: left 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
    pointer-events: none;
}

.autoplay-checkbox:checked + .autoplay-slider {
    background-color: rgba(100, 180, 255, 0.5);
    border-color: rgba(100, 180, 255, 0.6);
}

.autoplay-checkbox:checked + .autoplay-slider::after {
    left: 14px;
}

.autoplay-checkbox:disabled + .autoplay-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============== LEGAL CONTENT ============== */

/* Only display as flex when the admin-section is active */
.admin-section.active.legal-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.legal-columns {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.legal-left-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.legal-right-column {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    padding: 20px;
}

.legal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.legal-tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.legal-tab-button:hover {
    color: #333;
}

.legal-tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.legal-tab-content {
    animation: fadeIn 0.3s ease;
}

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

.wysiwyg-editor {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    background-color: #f9f9f9;
}

.wysiwyg-editor:focus {
    outline: none;
    border-color: #007bff;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============== STORY SCRIPT EDITOR ============== */

.story-script-editor-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.story-script-editor-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-script-editor-left label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.story-script-editor-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-script-editor-right label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.story-script-preview-box {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #fafafa;
    overflow-y: auto;
    max-height: 400px;
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.story-script-preview-box p {
    margin: 10px 0;
}

.story-script-preview-box h2 {
    font-size: 18px;
    margin: 15px 0 10px 0;
    color: #2c3e50;
}

.story-script-preview-box h3 {
    font-size: 16px;
    margin: 12px 0 8px 0;
    color: #34495e;
}

.story-script-preview-box ul,
.story-script-preview-box ol {
    margin: 10px 0 10px 20px;
}

.story-script-preview-box li {
    margin: 5px 0;
}

.story-script-preview-box strong {
    font-weight: bold;
}

.story-script-preview-box em {
    font-style: italic;
}


.story-preview-content {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    margin: 15px 0;
    line-height: 1.8;
    color: #333;
    font-size: 15px;
}

.story-preview-content p {
    margin: 12px 0;
}

.story-preview-content h2 {
    font-size: 20px;
    margin: 20px 0 12px 0;
    color: #2c3e50;
}

.story-preview-content h3 {
    font-size: 17px;
    margin: 15px 0 10px 0;
    color: #34495e;
}

.story-preview-content ul,
.story-preview-content ol {
    margin: 12px 0 12px 25px;
}

.story-preview-content li {
    margin: 6px 0;
}

.story-preview-content strong {
    font-weight: bold;
}

.story-preview-content em {
    font-style: italic;
}

/* ============== STORY SCRIPT WINDOW (DRAGGABLE) ============== */

.story-script-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 500px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    touch-action: none;
    overflow: hidden;
}

.story-script-window-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    touch-action: none;
}

.story-script-window-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.story-script-window-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.story-script-window-close:hover {
    transform: scale(1.2);
}

.story-window-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.font-size-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.font-size-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
}

.font-size-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.font-size-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.font-size-small span:first-child {
    font-size: 14px;
}

.font-size-medium span:first-child {
    font-size: 18px;
}

.font-size-large span:first-child {
    font-size: 24px;
}

.font-size-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.font-size-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(calc(-50% - 5px));
    margin-right: 8px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10000;
}

.font-size-btn:hover .font-size-tooltip {
    opacity: 1;
}

.story-script-window-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

.story-script-window-content p {
    margin: 10px 0;
}

.story-script-window-content h2 {
    font-size: 18px;
    margin: 15px 0 10px 0;
    color: #667eea;
}

.story-script-window-content h3 {
    font-size: 16px;
    margin: 12px 0 8px 0;
    color: #764ba2;
}

.story-script-window-content ul,
.story-script-window-content ol {
    margin: 10px 0 10px 20px;
}

.story-script-window-content li {
    margin: 5px 0;
}

.story-script-window-content strong {
    font-weight: bold;
}

.story-script-window-content em {
    font-style: italic;
}

.story-script-window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 0%, transparent 60%, #667eea 60%, #667eea 100%);
    border-radius: 0 0 10px 0;
    touch-action: none;
}

.story-script-window-resize:hover {
    background: linear-gradient(135deg, transparent 0%, transparent 50%, #764ba2 50%, #764ba2 100%);
}

/* ============== FOOTER ============== */

.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    z-index: 100;
}

.footer-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-link {
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #007bff;
    text-decoration: underline;
}

.footer-separator {
    width: 1px;
    height: 16px;
    background-color: #ddd;
}

/* Adjust body margin when footer is present */
body.has-footer {
    padding-bottom: 50px;
}

/* ============== LEGAL CONTENT MODAL ============== */

.legal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.legal-modal.show {
    display: flex;
}

.legal-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.legal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.legal-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.legal-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.legal-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.legal-modal-body {
    padding: 20px;
    color: #333;
    line-height: 1.6;
}

.legal-modal-body p {
    margin: 0 0 15px 0;
}

.legal-modal-body ul,
.legal-modal-body ol {
    margin: 10px 0 15px 20px;
}

.legal-modal-body li {
    margin-bottom: 8px;
}

.legal-modal-body strong {
    color: #222;
    font-weight: 600;
}

.legal-modal-body em {
    color: #555;
}

.legal-modal-body h3 {
    margin: 20px 0 10px 0;
    color: #222;
    font-size: 16px;
}

.legal-modal-body h4 {
    margin: 15px 0 8px 0;
    color: #333;
    font-size: 14px;
}

/* Screen-reader-only utility for hidden labels/inputs required by autocomplete */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============== TABLET SUPPORT STYLES ============== */

/* Prevent rubber-band scrolling and unwanted gestures */
html, body {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

/* Safe area insets for notched devices (iPhone X+, iPad Pro) */
body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Dynamic viewport units - responsive to visualViewport */
:root {
    --viewport-width: 100vw;
    --viewport-height: 100vh;
    --viewport-width-dvw: 100dvw;
    --viewport-height-dvh: 100dvh;

    /* Fallback for DPR capping (default to 2) */
    --pixel-ratio: 1;
}

/* Canvas container optimized for tablets (preserves original positioning) */
#pixi-container canvas {
    display: block;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Prevent pinch-zoom and double-tap zoom on touch devices */
input, textarea {
    font-size: 16px; /* Prevents auto-zoom on iOS */
}

/* Rotation overlay for landscape requirement */
.rotation-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.rotation-overlay.active {
    display: flex;
}

.rotation-overlay-content {
    text-align: center;
    color: white;
}

.rotation-overlay-icon {
    font-size: 80px;
    margin-bottom: 30px;
    animation: rotate-pulse 2s ease-in-out infinite;
}

@keyframes rotate-pulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(90deg) scale(1.1);
        opacity: 0.8;
    }
}

.rotation-overlay-text {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
}

.rotation-overlay-subtext {
    font-size: 16px;
    opacity: 0.8;
    line-height: 1.6;
}

/* Tablet media query adjustments */
@media (max-width: 1440px) {
    .screen {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        transform: translate(0, 0);
        position: fixed;
        top: 0;
        left: 0;
    }
}

/* Safe area for notches on landscape iPad Pro */
@supports (padding: max(0px)) {
    body {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Hide admin button on tablet devices (768px to 1024px width) */
@media (min-width: 768px) and (max-width: 1024px) {
    #admin-btn {
        display: none !important;
    }
}

/* Disable highlight on touch */
::-webkit-tap-highlight-color {
    background-color: transparent;
}
