@font-face {
    font-family: 'EmotionEngine';
    src: url('EmotionEngine-8ynA.ttf') format('truetype');
}

:root {
    --ps2-blue: #00aaff;
    --ps2-blue-glow: rgba(0, 170, 255, 0.4);
    --ps2-bg-top: #000c22;
    --ps2-bg-bottom: #000000;
    --ps2-modal-bg: rgba(0, 12, 34, 0.85);
}

* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background: var(--ps2-bg-bottom);
    color: white;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* PS2 Background & Floating Towers */
#ps2-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--ps2-bg-top), var(--ps2-bg-bottom));
    z-index: -1;
}

#bg-canvas {
    width: 100%;
    height: 100%;
}

/* Toolbar & Icon Samples */
.toolbar-bottom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 1000;
}

.performance-toggle {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.performance-toggle:hover {
    color: white;
    background: rgba(0, 170, 255, 0.2);
    border-color: var(--ps2-blue);
}

.performance-toggle.active {
    color: var(--ps2-blue);
    border-color: var(--ps2-blue);
}

/* PS2 Header Styles */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--ps2-blue);
    box-shadow: 0 5px 20px var(--ps2-blue-glow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 2000;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-main {
    font-size: 2.2rem !important;
    margin-bottom: 0 !important;
}

.logo-sub {
    font-family: 'EmotionEngine', sans-serif;
    font-size: 1.1rem;
    color: white;
    letter-spacing: 2px;
    opacity: 0.9;
    border-left: 2px solid var(--ps2-blue);
    padding-left: 15px;
    height: 1.2rem;
    display: flex;
    align-items: center;
}

.header-center {
    display: flex;
    gap: 40px;
}

.header-link {
    color: #ccc;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.header-link:hover {
    color: var(--ps2-blue);
    text-shadow: 0 0 10px var(--ps2-blue-glow);
    transform: translateY(-2px);
}

#live-clock {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.help-btn {
    cursor: pointer;
    color: var(--ps2-blue);
    transition: all 0.2s;
}

.help-btn:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--ps2-blue-glow));
}

/* Adjust app container for header */
#app {
    margin-top: 70px;
    width: 90%;
    max-width: 1000px;
    height: calc(80% - 70px);
}

.screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

.glow-text {
    font-family: 'EmotionEngine', sans-serif;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--ps2-blue);
    text-shadow: 0 0 10px var(--ps2-blue-glow);
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

/* Slot Select Styles */
.slots-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 50px;
}

.slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
    width: 300px;
    height: 367px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid transparent;
}

.slot.drag-over {
    background: rgba(0, 170, 255, 0.1);
    border: 1px dashed var(--ps2-blue);
    transform: scale(1.02);
}

#browser-grid.drag-over .grid-view {
    background: rgba(0, 170, 255, 0.1);
    border: 2px dashed var(--ps2-blue);
}

.slot-clickable-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    flex-grow: 1;
}

.slot-clickable-area:hover, .slot-clickable-area.focused {
    transform: scale(1.05);
}

.card-icon-container {
    transition: all 0.2s;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon-container .mini-mc {
    width: 120px;
    height: 156px;
}

.card-icon-container .mini-mc {
    width: 130px;
    height: 169px;
}

.create-btn {
    position: relative;
    z-index: 10;
    margin-top: 10px;
    background: rgba(0, 170, 255, 0.1);
    border: 1px solid var(--ps2-blue);
    color: var(--ps2-blue);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: bold;
    transition: all 0.2s;
}

.create-btn:hover, .create-btn.focused {
    background: var(--ps2-blue);
    color: black;
    box-shadow: 0 0 15px var(--ps2-blue-glow);
}

.slot-label {
    font-size: 1.3rem;
    margin-top: 10px;
    color: #ccc;
}

.status-label {
    font-size: 1rem;
    color: #888;
    margin-top: 5px;
}

.neon-blue {
    color: var(--ps2-blue);
    text-shadow: 0 0 5px var(--ps2-blue-glow);
}

/* Browser Grid Styles */
.browser-header {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    gap: 30px;
}

.browser-actions {
    display: flex;
    gap: 10px;
}

.back-btn {
    background: none;
    border: 2px solid #ff4444;
    color: #ff4444;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}

.header-info {
    flex-grow: 1;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px);
    justify-content: center;
    gap: 30px;
    overflow-y: auto;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
}

/* Mini PS2 Memory Card Save Items */
.save-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    width: 180px;
    height: 260px;
    flex-shrink: 0;
}

.save-card:hover, .save-card.focused {
    background: rgba(0, 170, 255, 0.1);
    border-color: var(--ps2-blue);
    transform: translateY(-10px) scale(1.05);
}

.mini-mc {
    width: 110px;
    height: 145px;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
    transition: all 0.2s;
}

.save-card:hover .mini-mc, .save-card.focused .mini-mc {
    filter: drop-shadow(0 0 20px var(--ps2-blue-glow));
}

.save-card .save-title {
    margin-top: auto;
    font-size: 0.9rem;
    font-weight: bold;
    color: #eee;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    height: 2.4rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
}

.save-card .save-dir {
    font-size: 0.7rem;
    color: #888;
    margin-top: 5px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

#ps2-modal {
    background: var(--ps2-modal-bg);
    width: 450px;
    border: 2px solid var(--ps2-blue);
    border-radius: 10px;
    box-shadow: 0 0 30px var(--ps2-blue-glow);
    padding: 30px;
    animation: scaleUp 0.3s ease-out;
}

@keyframes scaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
    text-align: center;
    text-transform: uppercase;
    color: var(--ps2-blue);
    margin-top: 0;
}

.modal-content p {
    text-align: center;
    margin: 20px 0;
    color: #ccc;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px;
    cursor: pointer;
    text-align: left;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.modal-btn:hover, .modal-btn.focused {
    background: var(--ps2-blue);
    color: black;
}

.modal-footer {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.nav-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
    cursor: pointer;
}

.btn-icon { width: 20px; height: 20px; }
.btn-icon-small { width: 16px; height: 16px; }

.card-info {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.capacity-bar-container {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.capacity-bar-container.hidden { display: none; }

.capacity-bar-fill {
    height: 100%;
    background: var(--ps2-blue);
    box-shadow: 0 0 10px var(--ps2-blue-glow);
    width: 0%;
    transition: width 0.5s ease-out;
}

.capacity-text {
    font-size: 0.8rem;
    color: var(--ps2-blue);
    text-shadow: 0 0 5px var(--ps2-blue-glow);
    font-family: 'Courier New', Courier, monospace;
}

.capacity-text.hidden { display: none; }

/* Pulsing Focus Animation */
@keyframes focusPulse {
    0% { box-shadow: 0 0 10px var(--ps2-blue-glow); border-color: var(--ps2-blue); }
    50% { box-shadow: 0 0 25px var(--ps2-blue), 0 0 40px var(--ps2-blue-glow); border-color: #fff; }
    100% { box-shadow: 0 0 10px var(--ps2-blue-glow); border-color: var(--ps2-blue); }
}

.focused {
    outline: none !important;
    position: relative;
    z-index: 100 !important;
}

/* Specific Focus Treatments */
.slot-clickable-area.focused {
    transform: scale(1.08);
}

.card-icon-container {
    transition: all 0.2s;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon-container .mini-mc {
    width: 120px;
    height: 156px;
}

.card-icon-container .mini-mc {
    width: 130px;
    height: 169px;
}

.save-card.focused {
    transform: translateY(-15px) scale(1.1);
}

.save-card.focused .mini-mc {
    filter: drop-shadow(0 0 30px var(--ps2-blue));
}

.modal-btn.focused, .create-btn.focused, .performance-toggle.focused {
    background: var(--ps2-blue) !important;
    color: black !important;
    animation: focusPulse 1.5s infinite;
    border: 2px solid white !important;
}

.header-link.focused {
    color: var(--ps2-blue) !important;
    text-shadow: 0 0 15px var(--ps2-blue);
    transform: translateY(-3px);
}

#themes-toggle {
    display: none;
}

.help-btn.focused {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px var(--ps2-blue));
}

/* PS2 Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--ps2-blue);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--ps2-blue-glow);
    border: 2px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: #55ccff;
    box-shadow: 0 0 15px var(--ps2-blue);
}

/* Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--ps2-blue) rgba(0, 0, 0, 0.3);
}

.icon-sample-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 20px;
    justify-items: center;
}

.sample-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.sample-item span {
    font-size: 0.8rem;
    color: var(--ps2-blue);
    text-transform: uppercase;
    font-weight: bold;
}
