 :root {
     --bg: #111;
     --card: #1c1c1c;
     --border: #333;
     --text: #f0f0f0;
     --muted: #999;
     --highlight: #666;
     --radius: 8px;
     --shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
     --gap-lg: 2.5rem;
     --gap-md: 1.5rem;
}
 html, body {
     height: 100%;
     margin: 0;
     padding: 0;
     overflow: hidden;
}
 body {
     font-family: "Inter", sans-serif;
     background-color: var(--bg);
     color: var(--text);
     display: grid;
     place-items: center;
     padding: var(--gap-lg);
     background-image: linear-gradient(to right, var(--border) 1px, transparent 1px), linear-gradient(to bottom, var(--border) 1px, transparent 1px);
     background-size: 40px 40px;
}
 * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
}
 .container {
     display: grid;
     gap: var(--gap-lg);
     width: 100%;
     height: 100%;
     z-index: 10;
     grid-template-columns: 1fr;
     grid-template-rows: auto 1fr;
}
 @media (min-width: 900px) {
     .container {
         grid-template-columns: 350px 1fr;
         grid-template-rows: 1fr;
    }
}
 .sidebar {
     display: flex;
     flex-direction: column;
     gap: var(--gap-lg);
     flex-shrink: 0;
     overflow-y: auto;
     padding-right: 10px;
     scrollbar-width: thin;
     scrollbar-color: var(--highlight) transparent;
}
 .sidebar::-webkit-scrollbar {
     width: 8px;
}
 .sidebar::-webkit-scrollbar-track {
     background: transparent;
}
 .sidebar::-webkit-scrollbar-thumb {
     background-color: var(--highlight);
     border-radius: 4px;
}
 .main-content {
     display: flex;
     flex-direction: column;
     height: 100%;
}
 .header {
     text-align: center;
}
 .header h1 {
     font-size: 2.5rem;
     font-weight: 700;
     color: var(--text);
     letter-spacing: -1px;
}
 .header p {
     font-size: 1rem;
     color: var(--muted);
     margin-top: 0.5rem;
}
 .card {
     background: var(--card);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: var(--gap-md);
     box-shadow: var(--shadow);
     display: flex;
     flex-direction: column;
     gap: var(--gap-md);
}
 .section-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
}
 .section-header h2 {
     font-size: 1.25rem;
     font-weight: 600;
     display: flex;
     align-items: center;
     gap: 0.5rem;
}
 .upload-area {
     border: 2px dashed var(--highlight);
     border-radius: var(--radius);
     padding: 3rem 1.5rem;
     text-align: center;
     cursor: pointer;
     transition: border-color 0.2s, background-color 0.2s;
}
 .upload-area:hover, .upload-area.drag-over {
     border-color: var(--text);
     background: rgba(255, 255, 255, 0.05);
}
 .upload-text {
     font-weight: 500;
     color: var(--text);
}
 .upload-subtext {
     font-size: 0.85rem;
     color: var(--muted);
}
 .upload-subtext a {
     color: var(--text);
     text-decoration: underline;
     transition: color 0.2s;
}
 .upload-subtext a:hover {
     color: var(--highlight);
}
 .upload-url-section {
     display: flex;
     flex-direction: column;
     gap: 0.75rem;
     margin-top: 0.5rem;
}
 .game-list {
     list-style: none;
     display: flex;
     flex-direction: column;
     gap: 0.5rem;
     max-height: 400px;
     overflow-y: auto;
     scrollbar-width: thin;
     scrollbar-color: var(--highlight) transparent;
}
 .game-list::-webkit-scrollbar {
     width: 8px;
}
 .game-list::-webkit-scrollbar-track {
     background: transparent;
}
 .game-list::-webkit-scrollbar-thumb {
     background-color: var(--highlight);
     border-radius: 4px;
}
 .game-item {
     display: flex;
     justify-content: space-between;
     align-items: center;
     padding: 0.75rem 1rem;
     background: #242424;
     border-radius: var(--radius);
     border: 1px solid transparent;
     cursor: pointer;
     transition: background-color 0.2s, border-color 0.2s;
}
 .game-item:hover {
     background: #2a2a2a;
}
 .game-item.active {
     border-color: var(--text);
     background: #2a2a2a;
}
 .game-info {
     display: flex;
     flex-direction: column;
     overflow: hidden;
     white-space: nowrap;
     text-overflow: ellipsis;
     gap: 0.25rem;
}
 .game-info .name {
     font-weight: 500;
     color: var(--text);
     overflow: hidden;
     text-overflow: ellipsis;
}
 .game-info .size {
     font-size: 0.8rem;
     color: var(--muted);
}
 .game-actions {
     display: flex;
     gap: 0.5rem;
     flex-shrink: 0;
}
 .search-container {
     margin-top: 0.5rem;
}
 .search-input {
     width: 100%;
     padding: 0.75rem 1rem;
     background: #242424;
     border: 1px solid var(--border);
     border-radius: var(--radius);
     color: var(--text);
     font-size: 0.9rem;
     transition: border-color 0.2s;
}
 .search-input::placeholder {
     color: var(--muted);
}
 .search-input:focus {
     outline: none;
     border-color: var(--text);
}
 .empty-state {
     text-align: center;
     padding: 2rem 0;
     color: var(--muted);
}
 .empty-state p {
     font-weight: 500;
     margin-bottom: 0.25rem;
}
 .empty-state span {
     font-size: 0.9rem;
}
 .game-viewport {
     background: #000;
     border: 1px solid var(--border);
     border-radius: var(--radius);
     flex-grow: 1;
     display: flex;
     flex-direction: column;
     overflow: hidden;
     box-shadow: var(--shadow);
     position: relative;
}
 .game-container {
     flex-grow: 1;
     display: flex;
     flex-direction: column;
     position: relative;
     overflow: hidden;
}
 .game-instance {
     width: 100%;
     height: 100%;
     display: flex;
     flex-direction: column;
     position: absolute;
     top: 0;
     left: 0;
     transition: transform 0.3s ease;
}
 .game-instance:not(.active) {
     transform: translateY(100%);
}
 .game-instance.active {
     transform: translateY(0);
     z-index: 10;
}
 .ruffle-player-wrapper {
     width: 100%;
     height: 100%;
     display: flex;
     justify-content: center;
     align-items: center;
     position: relative;
}
 .ruffle-player-wrapper > * {
     width: 100% !important;
     height: 100% !important;
}
 .ruffle-player-wrapper ruffle-player {
     width: 100% !important;
     height: 100% !important;
}
 .ruffle-player-wrapper ruffle-embed {
     width: 100% !important;
     height: 100% !important;
}
 .control-bar {
     position: absolute;
     bottom: 0;
     left: 0;
     width: 100%;
     background: rgba(0, 0, 0, 0.5);
     backdrop-filter: blur(5px);
     border-top: 1px solid var(--border);
     padding: 0.75rem 1.5rem;
     display: flex;
     justify-content: space-between;
     align-items: center;
     z-index: 2;
     transform: translateY(100%);
     transition: transform 0.3s ease;
     gap: 1rem;
}
 .game-instance.active .control-bar {
     transform: translateY(0);
}
 .game-info-bar {
     flex-grow: 1;
     overflow: hidden;
}
 .game-name {
     font-size: 0.9rem;
     font-weight: 500;
     color: var(--muted);
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
}
 .control-buttons {
     display: flex;
     align-items: center;
     gap: 1rem;
}
 .welcome-screen {
     text-align: center;
     color: var(--muted);
     padding: 2rem;
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
     width: 100%;
     height: 100%;
     z-index: 1;
     position: absolute;
     top: 0;
     left: 0;
}
 .welcome-screen h2 {
     font-size: 1.5rem;
     font-weight: 600;
     margin-top: 1rem;
}
 .welcome-screen p {
     margin-top: 0.5rem;
     font-size: 1rem;
}
 .stats {
     display: flex;
     justify-content: center;
     gap: 2rem;
     margin-top: 2rem;
     margin-bottom: 2rem;
}
 .stat-item {
     text-align: center;
}
 .stat-value {
     font-weight: 600;
     font-size: 1.5rem;
     color: var(--text);
}
 .stat-label {
     font-size: 0.85rem;
     color: var(--muted);
}
 .btn {
     padding: 0.6rem 1.2rem;
     border: none;
     border-radius: 6px;
     cursor: pointer;
     font-size: 0.9rem;
     font-weight: 500;
     display: inline-flex;
     align-items: center;
     gap: 0.5rem;
     transition: background-color 0.2s, transform 0.1s;
}
 .btn:active {
     transform: scale(0.98);
}
 .btn-full {
     width: 100%;
     justify-content: center;
}
 .btn-primary {
     background: var(--text);
     color: var(--bg);
}
 .btn-primary:hover {
     background: #ccc;
}
 .btn-secondary {
     background: #242424;
     color: var(--muted);
     border: 1px solid var(--border);
}
 .btn-secondary:hover {
     background: #2a2a2a;
}
 .btn-sm {
     padding: 0.4rem 0.8rem;
     font-size: 0.8rem;
     border-radius: 4px;
}
 .btn-danger {
     background: #545454;
     color: white;
}
 .btn-danger:hover {
     background: #7e7e7e;
}
 .notification {
     position: fixed;
     bottom: 20px;
     right: 20px;
     background: #242424;
     color: var(--text);
     padding: 1rem 1.5rem;
     border-radius: var(--radius);
     box-shadow: var(--shadow);
     z-index: 1000;
     opacity: 0;
     transform: translateY(100%);
     transition: all 0.3s ease;
}
 .notification.show {
     opacity: 1;
     transform: translateY(0);
}
 .notification.success {
     border-left: 4px solid #ffffff;
}
 .notification.error {
     border-left: 4px solid #000000;
}
 .notification.warning {
     border-left: 4px solid #676767;
}
 .game-viewport.fullscreen-active {
     position: fixed;
     top: 0;
     left: 0;
     width: 100vw;
     height: 100vh;
     max-width: none;
     border-radius: 0;
     z-index: 1000;
     padding: 0;
     background: #000;
}
 .game-viewport.fullscreen-active .game-container {
     width: 100%;
     height: 100%;
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
}
 .game-viewport.fullscreen-active .game-instance.active {
     width: 100%;
     height: 100%;
}
 .game-viewport.fullscreen-active .ruffle-player {
     width: 100%;
     height: 100%;
}
 .game-viewport.fullscreen-active .control-bar {
     display: none;
}
 .modal-overlay {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     background: rgba(0, 0, 0, 0.75);
     backdrop-filter: blur(5px);
     z-index: 1000;
     display: none;
     justify-content: center;
     align-items: center;
     opacity: 0;
     transition: opacity 0.3s ease;
}
 .modal-overlay.show {
     display: flex;
     opacity: 1;
}
 .modal-dialog {
     background: var(--card);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 1.5rem;
     box-shadow: var(--shadow);
     width: 90%;
     max-width: 400px;
     display: flex;
     flex-direction: column;
     gap: 1.5rem;
     transform: scale(0.95);
     transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.4, 1.2);
}
 .modal-overlay.show .modal-dialog {
     transform: scale(1);
}
 .modal-header h3 {
     font-size: 1.2rem;
     font-weight: 600;
     color: var(--text);
}
 .modal-body p {
     font-size: 1rem;
     color: var(--muted);
}
 .modal-footer {
     display: flex;
     justify-content: flex-end;
     gap: 1rem;
}
 @media (max-width: 899px) {
     body {
         padding: var(--gap-md);
    }
     .container {
         max-height: unset;
    }
     .header h1 {
         font-size: 2rem;
    }
     .header p {
         font-size: 0.9rem;
    }
     .card {
         padding: 1rem;
    }
     .section-header h2 {
         font-size: 1.1rem;
    }
     .upload-area {
         padding: 2rem 1rem;
    }
     .game-list {
         max-height: 300px;
    }
     .game-info .name {
         font-size: 0.9rem;
    }
     .game-info .size {
         font-size: 0.75rem;
    }
     .btn {
         padding: 0.5rem 1rem;
         font-size: 0.85rem;
    }
     .stats {
         flex-wrap: wrap;
         gap: 1rem;
    }
}
