/* ARCANUX OS - Pixel-Art Retro Styling */

/* Custom Pixel Font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    /* Color Palette - Fantasy Theme with High Contrast */
    --color-bg-dark: #1a0f2e;
    --color-bg-medium: #2d1b4e;
    --color-accent-purple: #6b4c9a;
    --color-accent-gold: #ffd700;
    --color-accent-teal: #00d4aa;
    --color-text-light: #f0e6ff;
    --color-text-dark: #1a0f2e;
    --color-glow: #9d7fe8;
    --color-shadow: #0a0515;

    /* Grid System */
    --grid-size: 16px;
    --icon-size: 32px;
}

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

body {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#os-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000000;
    overflow: hidden;
}

/* Canvas - Pixel Perfect Rendering */
#main-canvas {
    position: absolute;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    width: 640px;
    height: 480px;
    border: 4px solid var(--color-accent-purple);
    box-shadow: 0 0 32px rgba(157, 127, 232, 0.5);
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    width: 640px;
    height: 480px;
    transform-origin: center;
    pointer-events: none;
}

#ui-overlay * {
    pointer-events: auto;
}

/* Screen Management */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Boot Screen */
#boot-screen {
    background: var(--color-bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.summoning-circle {
    position: relative;
    width: 192px;
    height: 192px;
    margin-bottom: 32px;
}

.circle-outer, .circle-inner {
    position: absolute;
    border: 2px solid var(--color-accent-gold);
    border-radius: 50%;
    animation: rotate 3s linear infinite;
}

.circle-outer {
    width: 192px;
    height: 192px;
    border-style: dashed;
}

.circle-inner {
    width: 128px;
    height: 128px;
    top: 32px;
    left: 32px;
    animation-direction: reverse;
    box-shadow: 0 0 16px var(--color-glow);
}

.rune {
    position: absolute;
    font-size: 24px;
    color: var(--color-accent-gold);
    animation: pulse 2s ease-in-out infinite;
}

.rune-1 { top: 0; left: 50%; transform: translateX(-50%); }
.rune-2 { right: 0; top: 50%; transform: translateY(-50%); }
.rune-3 { bottom: 0; left: 50%; transform: translateX(-50%); }
.rune-4 { left: 0; top: 50%; transform: translateY(-50%); }

.boot-text {
    font-size: 12px;
    color: var(--color-accent-teal);
    text-align: center;
    animation: blink 1s step-start infinite;
}

/* Desktop Screen */
#desktop-screen {
    background: transparent;
}

#desktop-icons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.desktop-icon {
    width: 64px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    padding: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    pointer-events: auto;
    animation: iconFloat 3s ease-in-out infinite;
}

.desktop-icon:hover {
    border-color: var(--color-accent-gold);
    background: rgba(109, 76, 154, 0.3);
    box-shadow: 0 0 8px var(--color-glow);
}

.icon-sprite {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
    font-size: 24px;
    text-align: center;
    filter: drop-shadow(0 2px 4px var(--color-shadow));
}

.icon-label {
    font-size: 8px;
    text-align: center;
    color: var(--color-text-light);
    text-shadow: 1px 1px 2px var(--color-shadow);
    line-height: 12px;
}

/* Window System */
.window {
    position: absolute;
    background: var(--color-bg-medium);
    border: 4px solid var(--color-accent-purple);
    box-shadow: 0 4px 16px var(--color-shadow);
    min-width: 320px;
    min-height: 240px;
    display: flex;
    flex-direction: column;
}

.window-header {
    background: var(--color-accent-purple);
    color: var(--color-text-light);
    padding: 8px;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-bottom: 2px solid var(--color-accent-gold);
}

.window-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-close {
    width: 16px;
    height: 16px;
    background: var(--color-accent-gold);
    color: var(--color-text-dark);
    border: 2px solid var(--color-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.window-close:hover {
    background: var(--color-accent-teal);
}

.window-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    color: var(--color-text-light);
    font-size: 10px;
    line-height: 16px;
}

/* Spellbook Styles */
.spellbook-page {
    background: linear-gradient(to bottom, #f4e8d0 0%, #e6d4b8 100%);
    color: var(--color-text-dark);
    padding: 16px;
    border: 2px solid #8b7355;
    min-height: 320px;
}

.spellbook-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #8b7355;
}

.spell-nav-btn {
    background: var(--color-accent-purple);
    color: var(--color-text-light);
    border: 2px solid var(--color-accent-gold);
    padding: 8px 16px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
}

.spell-nav-btn:hover {
    background: var(--color-accent-gold);
    color: var(--color-text-dark);
}

.spell-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Archive Styles */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.archive-item {
    background: rgba(109, 76, 154, 0.2);
    border: 2px solid var(--color-accent-purple);
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: none;
}

.archive-item:hover {
    border-color: var(--color-accent-gold);
    background: rgba(109, 76, 154, 0.4);
    box-shadow: 0 0 8px var(--color-glow);
}

.archive-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

/* Settings Styles */
.settings-group {
    margin-bottom: 24px;
}

.settings-group h3 {
    font-size: 12px;
    color: var(--color-accent-gold);
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-accent-purple);
    padding-bottom: 8px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(109, 76, 154, 0.1);
}

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

.rune-toggle {
    width: 48px;
    height: 24px;
    background: var(--color-bg-dark);
    border: 2px solid var(--color-accent-purple);
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.rune-toggle.active {
    background: var(--color-accent-purple);
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 8px var(--color-glow);
}

.rune-toggle::after {
    content: '✦';
    position: absolute;
    left: 4px;
    color: var(--color-accent-gold);
    font-size: 16px;
    transition: transform 0.2s;
}

.rune-toggle.active::after {
    transform: translateX(20px);
}

.orb-slider {
    -webkit-appearance: none;
    width: 128px;
    height: 8px;
    background: var(--color-bg-dark);
    border: 2px solid var(--color-accent-purple);
    outline: none;
}

.orb-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-accent-gold);
    border: 2px solid var(--color-accent-teal);
    cursor: pointer;
    box-shadow: 0 0 8px var(--color-glow);
}

.orb-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-accent-gold);
    border: 2px solid var(--color-accent-teal);
    cursor: pointer;
    box-shadow: 0 0 8px var(--color-glow);
}

/* Notifications */
#notifications-container {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 256px;
}

.notification {
    background: var(--color-bg-medium);
    border: 2px solid var(--color-accent-gold);
    padding: 12px;
    font-size: 8px;
    line-height: 12px;
    box-shadow: 0 4px 8px var(--color-shadow);
    animation: slideIn 0.3s ease-out;
    position: relative;
}

.notification-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: var(--color-accent-gold);
    color: var(--color-text-dark);
    border: none;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Familiar Assistant */
#familiar-container {
    position: absolute;
    bottom: 16px;
    right: 16px;
    pointer-events: all;
}

#familiar-sprite {
    width: 64px;
    height: 64px;
    font-size: 44px;
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
    text-align: center;
    line-height: 64px;
    filter: drop-shadow(0 2px 8px var(--color-glow));
    position: relative;
}

#familiar-dialogue {
    position: absolute;
    bottom: 72px;
    right: 0;
    background: linear-gradient(to bottom, #f4e8d0 0%, #e6d4b8 100%);
    border: 3px solid #8b7355;
    padding: 12px;
    font-size: 8px;
    line-height: 12px;
    color: var(--color-text-dark);
    width: 280px;
    max-width: 280px;
    box-shadow: 0 4px 8px var(--color-shadow);
}

#familiar-dialogue.hidden {
    display: none;
}

#familiar-dialogue::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 16px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #8b7355;
}

/* Animations */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.05); }
}

.desktop-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(157, 127, 232, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.desktop-icon:hover::before {
    opacity: 1;
}

/* Launcher / Start Menu */
#launcher-button {
    position: absolute;
    bottom: 16px;
    left: 16px;
    width: 56px;
    height: 56px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    pointer-events: auto;
}

#launcher-button:hover {
    transform: scale(1.1);
}

#launcher-button.launcher-active {
    transform: scale(1.05);
}

.orb-outer {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 76, 154, 0.8), rgba(45, 27, 78, 0.9));
    border: 3px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(157, 127, 232, 0.4),
        inset 0 0 15px rgba(255, 215, 0, 0.2);
    animation: orbPulse 3s ease-in-out infinite;
}

.orb-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-rune {
    color: #ffd700;
    font-size: 24px;
    animation: rotate 6s linear infinite;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@keyframes orbPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(157, 127, 232, 0.4), inset 0 0 15px rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(157, 127, 232, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.3); }
}

#start-menu {
    position: absolute;
    bottom: 80px;
    left: 16px;
    width: 480px;
    max-height: 560px;
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.98), rgba(26, 15, 46, 0.98));
    border: 3px solid #6b4c9a;
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(107, 76, 154, 0.5);
    z-index: 99;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#start-menu.hidden {
    display: none !important;
}

.start-menu-header {
    background: linear-gradient(90deg, #6b4c9a, #4a3868);
    padding: 16px;
    border-bottom: 2px solid #ffd700;
    text-align: center;
}

.start-menu-title {
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    letter-spacing: 2px;
}

.start-menu-section {
    padding: 16px;
    border-bottom: 1px solid rgba(107, 76, 154, 0.3);
    overflow-y: auto;
    max-height: 320px;
}

.section-label {
    color: #00d4aa;
    font-size: 9px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.app-tile {
    background: rgba(107, 76, 154, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.app-tile:hover {
    background: rgba(107, 76, 154, 0.4);
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.app-tile-icon {
    font-size: 28px;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.app-tile-name {
    font-size: 7px;
    color: #f0e6ff;
    line-height: 10px;
}

.start-menu-footer {
    padding: 12px 16px;
    background: rgba(26, 15, 46, 0.8);
    border-top: 2px solid rgba(107, 76, 154, 0.5);
    display: flex;
    justify-content: space-around;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(107, 76, 154, 0.3);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 8px;
    color: #f0e6ff;
    transition: all 0.3s ease;
}

.footer-item:hover {
    background: rgba(107, 76, 154, 0.5);
    border-color: #00d4aa;
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.4);
}

/* Power Menu */
.power-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-menu {
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.98), rgba(26, 15, 46, 0.98));
    border: 3px solid #6b4c9a;
    border-radius: 12px;
    padding: 24px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.power-menu-title {
    color: #ffd700;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.power-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.power-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(107, 76, 154, 0.3);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.power-option:hover {
    background: rgba(107, 76, 154, 0.5);
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.power-icon {
    font-size: 24px;
}

.power-label {
    color: #f0e6ff;
    font-size: 10px;
}

.power-cancel {
    width: 100%;
    padding: 10px;
    background: rgba(107, 76, 154, 0.4);
    border: 2px solid #6b4c9a;
    border-radius: 6px;
    color: #f0e6ff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.power-cancel:hover {
    background: rgba(107, 76, 154, 0.6);
    border-color: #00d4aa;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Fixed Scaling - No responsive scaling, keep at 640x480 */
#ui-overlay {
    transform: none !important;
}

/* Scrollbar Styling */
.window-content::-webkit-scrollbar,
#familiar-chat-history::-webkit-scrollbar {
    width: 8px;
}

.window-content::-webkit-scrollbar-track,
#familiar-chat-history::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
}

.window-content::-webkit-scrollbar-thumb,
#familiar-chat-history::-webkit-scrollbar-thumb {
    background: var(--color-accent-purple);
    border: 1px solid var(--color-accent-gold);
}

#familiar-chat-history::-webkit-scrollbar {
    width: 6px;
}

#familiar-chat-history::-webkit-scrollbar-track {
    background: rgba(139, 115, 85, 0.3);
}

#familiar-chat-history::-webkit-scrollbar-thumb {
    background: #8b7355;
    border: 1px solid #6b4c9a;
}
