:root {
    --bg-device: #0d1117;
    --bg-app: #161b22;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: #21262d;
    --file-hover: #1c2128;
    --chat-me: #1a3a24;
    --chat-other: #1c2128;
    --shadow-light: rgba(0,0,0,0.4);
    --shadow-medium: rgba(0,0,0,0.7);
}

.status-bar {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 8px 18px 4px;
    font-family: monospace;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: all 0.5s ease;
    box-sizing: border-box;
    gap: 4px;
}


body.dark-mode {
    --bg-device: #121212;
    --bg-app: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --border-color: #333333;
    --file-hover: #2c2c2c;
    --chat-me: #2a5233;
    --chat-other: #2c2c2c;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-medium: rgba(0,0,0,0.5);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-device);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: background 1.5s ease, filter 0.3s ease;
}

body.dark-mode {
    background: var(--bg-device);
}

/* Smooth fade-in on load */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.device-container {
    width: 100%;
    max-width: 400px;
    height: 100dvh;
    background: var(--bg-device);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: none;
    border-radius: 0;
    box-shadow: 0 20px 60px var(--shadow-medium);
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transition: background 0.5s ease;
}

/* ===================================================
   INTRO SCREEN
   =================================================== */
.intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-top: calc(20px + constant(safe-area-inset-top));
    box-sizing: border-box;
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 1s ease;
}

.intro-text {
    line-height: 1.8;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.btn-start {
    background: #0f0;
    color: #000;
    border: none;
    padding: 12px 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 30px;
    display: none;
    align-self: flex-start;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
}

.btn-start:hover {
    background: #00cc00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 0, 0.5);
}

.btn-start:active {
    transform: translateY(0);
}

/* ===================================================
   HOME SCREEN
   =================================================== */
.home-screen {
    flex-grow: 1;
    padding: 40px 20px;
    padding-top: calc(40px + env(safe-area-inset-top));
    padding-top: calc(40px + constant(safe-area-inset-top));
    /* Prevent bottom icons from hiding under iOS home indicator */
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    padding-bottom: calc(24px + constant(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.8s ease 0.3s both;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.clock {
    font-size: 3.5rem;
    font-weight: 200;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--text-main) 0%, #3498db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.location {
    font-size: 0.8rem;
    color: #3498db;
    font-weight: bold;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

/* ===================================================
   APP GRID WITH STAGGER ANIMATION
   =================================================== */
.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    width: 100%;
}

.app-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    opacity: 0;
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger animation for each app */
.app-icon-wrapper:nth-child(1) { animation-delay: 0.1s; }
.app-icon-wrapper:nth-child(2) { animation-delay: 0.2s; }
.app-icon-wrapper:nth-child(3) { animation-delay: 0.3s; }
.app-icon-wrapper:nth-child(4) { animation-delay: 0.4s; }
.app-icon-wrapper:nth-child(5) { animation-delay: 0.5s; }
.app-icon-wrapper:nth-child(6) { animation-delay: 0.6s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 15px var(--shadow-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

/* Hover effect with ripple */
.app-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.app-icon-wrapper:active .app-icon::before {
    width: 100px;
    height: 100px;
}

.app-icon-wrapper:hover .app-icon {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.app-icon-wrapper:active .app-icon {
    transform: translateY(-2px) scale(0.98);
}

.app-label {
    font-size: 0.75rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-device);
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.5);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* App Icon Colors */
.app-mail { background: linear-gradient(135deg, #1abc9c, #16a085); }
.app-files { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.app-messenger { background: linear-gradient(135deg, #3498db, #2980b9); }
.app-admin { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.app-cmd {
    background: #2c3e50;
    border: 2px solid #0f0;
    color: #0f0;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.8), 0 0 30px rgba(0, 255, 0, 0.4); }
}

/* ===================================================
   PUSH NOTIFICATION
   =================================================== */
.push-notification {
    position: absolute;
    top: 15px;
    left: 5%;
    width: 90%;
    background: rgba(22, 27, 34, 0.98);
    backdrop-filter: blur(10px);
    border-left: 4px solid #3498db;
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 8px 30px var(--shadow-medium);
    transform: translateY(-150%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 150;
    box-sizing: border-box;
    color: #c9d1d9;
}

body.dark-mode .push-notification {
    background: rgba(30, 30, 30, 0.98);
    color: white;
    border-left-color: #e74c3c;
}

.push-notification.show {
    transform: translateY(0);
    animation: slideInBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInBounce {
    0% { transform: translateY(-150%); }
    60% { transform: translateY(10px); }
    80% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.notif-title {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.notif-body {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ===================================================
   APP WINDOW WITH SMOOTH TRANSITIONS
   =================================================== */
.app-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: 0 -4px 20px var(--shadow-medium);
}

.app-window.active {
    transform: translateY(0);
}

.app-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.02), transparent);
    backdrop-filter: blur(5px);
}


.close-btn {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 400;
    transition: all 0.18s ease;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.close-btn:hover {
    background: rgba(231, 76, 60, 0.18);
    border-color: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    transform: scale(1.08);
}

.close-btn:active {
    transform: scale(0.92);
}

.back-btn {
    color: #3498db;
    cursor: pointer;
    font-size: 0.8rem;
    display: none;
    transition: all 0.18s ease;
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(52,152,219,0.08);
    border: 1px solid rgba(52,152,219,0.15);
    white-space: nowrap;
}

.back-btn:hover {
    background: rgba(52, 152, 219, 0.15);
    transform: scale(1.03);
}

.back-btn:active {
    transform: scale(0.96);
}

.app-content {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    /* Prevent bottom content from hiding under iOS home indicator */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-bottom: calc(20px + constant(safe-area-inset-bottom));
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar */
.app-content::-webkit-scrollbar {
    width: 6px;
}

.app-content::-webkit-scrollbar-track {
    background: var(--bg-app);
}

.app-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.app-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===================================================
   LIST ITEMS (Mail, Files, Contacts)
   =================================================== */
.list-container {
    display: flex;
    flex-direction: column;
}

.contact-item,
.file-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* Ripple effect on tap */
.contact-item::before,
.file-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.contact-item:active::before,
.file-item:active::before {
    width: 100%;
    height: 100%;
}

.contact-item:hover,
.file-item:hover {
    background: var(--file-hover);
    transform: translateX(5px);
}

.contact-item:active,
.file-item:active {
    background: var(--border-color);
    transform: scale(0.98);
}

.contact-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: transform 0.2s ease;
}

.contact-item:hover .contact-avatar {
    transform: scale(1.1) rotate(5deg);
}

.contact-info,
.file-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.contact-name,
.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.contact-preview,
.file-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================================================
   READER/CONTENT VIEW
   =================================================== */
.reader-container {
    padding: 20px;
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.8;
    animation: fadeIn 0.4s ease;
}

.reader-container h2 {
    margin-top: 0;
    color: var(--text-main);
    font-weight: 600;
}

/* ===================================================
   CHAT SYSTEM — IMMERSIVE v2
   =================================================== */
.chat-room-container {
    background: linear-gradient(to bottom, #0a0f1a, #050a12);
    padding: 15px;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
}

body.dark-mode .chat-room-container {
    background: linear-gradient(to bottom, #0a0a0a, #050505);
}

.chat-room-container::-webkit-scrollbar { display: none; }

/* Contact list tweaks */
.contact-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2px solid var(--bg-app);
    animation: pulse 2s infinite;
}

.contact-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.contact-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.unread-badge {
    min-width: 22px;
    height: 22px;
    background: #25D366;
    color: white;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

/* Immersive chat header */
.chat-header-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.chat-header-status {
    font-size: 0.72rem;
}

.status-online  { color: #2ecc71; }
.status-offline { color: var(--text-muted); }

/* System / glitch messages */
.bubble-system {
    align-self: center;
    background: rgba(0,0,0,0.08);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    padding: 5px 12px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    border: 1px solid rgba(0,0,0,0.1);
    margin: 4px 0;
}

body.dark-mode .bubble-system {
    background: rgba(255,0,0,0.05);
    color: #e74c3c;
    border-color: rgba(231,76,60,0.2);
}

.bubble-system.glitch-text {
    color: #e74c3c;
    animation: glitchText 0.8s infinite;
    background: rgba(231,76,60,0.06);
    border-color: rgba(231,76,60,0.3);
}

.glitch-bubble {
    border-left: 3px solid #e74c3c !important;
    animation: subtleGlitch 4s infinite;
}

@keyframes subtleGlitch {
    0%,90%,100% { opacity:1; transform: translateX(0); }
    91% { opacity:0.8; transform: translateX(-2px); }
    93% { opacity:1; transform: translateX(1px); }
    95% { opacity:0.9; transform: translateX(0); }
}

.past-bubble {
    opacity: 0.75;
    filter: sepia(0.4) saturate(0.8);
    border-left: 2px solid #f39c12 !important;
}

.chat-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 40px 20px;
}

.bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 85%;
    position: relative;
    animation: bubbleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    word-wrap: break-word;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.bubble.other {
    background: var(--chat-other);
    align-self: flex-start;
    border-top-left-radius: 2px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-light);
}

.bubble.me {
    background: var(--chat-me);
    align-self: flex-end;
    border-top-right-radius: 2px;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.bubble-name {
    font-weight: bold;
    font-size: 0.75rem;
    color: #8e44ad;
    margin-bottom: 3px;
}

.bubble-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 5px;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ===================================================
   CHOICE BUTTONS — IMMERSIVE
   =================================================== */
.choice-container {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 12px 15px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-bottom: calc(12px + constant(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-app);
    box-shadow: 0 -4px 15px var(--shadow-light);
    z-index: 10;
    animation: slideUpSmooth 0.4s ease;
}

.choice-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 2px;
    margin-bottom: 2px;
}

.alaska-note {
    font-size: 0.78rem;
    color: #e74c3c;
    font-family: 'Courier New', monospace;
    background: rgba(231,76,60,0.06);
    border: 1px dashed rgba(231,76,60,0.3);
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.5;
    animation: subtleGlitch 5s infinite;
}

.choice-made {
    font-size: 0.78rem;
    color: #2ecc71;
    font-family: 'Courier New', monospace;
    background: rgba(46,204,113,0.08);
    border: 1px dashed rgba(46,204,113,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    line-height: 1.5;
    margin-bottom: 6px;
}

@keyframes slideUpSmooth {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.dark-mode .choice-container {
    background: #111111;
    border-color: #333;
}

.choice-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #ffffff;
    border: none;
    padding: 13px 16px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-size: 0.88rem;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.choice-btn.choice-red {
    background: linear-gradient(135deg, #c0392b, #a93226);
    box-shadow: 0 4px 15px rgba(192,57,43,0.3);
}

.choice-btn.choice-red:hover {
    background: linear-gradient(135deg, #a93226, #922b21);
    box-shadow: 0 6px 20px rgba(192,57,43,0.5);
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.choice-btn:active::before {
    width: 300px;
    height: 300px;
}

.choice-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.choice-btn:active {
    transform: translateY(0);
}

/* Glitch Button */
.glitch-btn {
    background: #1a0000;
    color: red;
    border: 2px dashed red;
    padding: 14px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    width: 100%;
    border-radius: 8px;
    margin-top: 15px;
    animation: shake 2s infinite, glitchText 0.5s infinite;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.glitch-btn:hover {
    background: #2a0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
}

@keyframes glitchText {
    0%, 90%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, -2px); }
    80% { transform: translate(1px, 2px); }
}

/* CMD Terminal Button */
.cmd-btn {
    background: transparent;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 12px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    text-align: left;
    margin-bottom: 10px;
    display: block;
    width: 100%;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.cmd-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
    transform: translateX(5px);
}

.cmd-btn:active {
    transform: translateX(2px);
}

/* ===================================================
   ADMIN PANEL
   =================================================== */
.admin-wrap {
    padding: 20px;
}

.order-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.01), rgba(0,0,0,0.03));
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: all 0.3s ease;
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.order-status-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.order-done-label {
    font-weight: 700;
    font-size: 0.88rem;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    border: 1px dashed currentColor;
}

.flower-display {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    transition: transform 0.3s ease;
}

.order-card:hover .flower-display {
    transform: scale(1.05) rotate(2deg);
}

.action-btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.action-btn:active {
    transform: translateY(0);
}

/* ===================================================
   SPORTS APP
   =================================================== */
#app-sports .app-content {
    padding: 0;
    background: linear-gradient(135deg, #0d1117, #1a1f2e);
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

.sports-container {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.scoreboard-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 25px;
    width: 100%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease;
}

.scoreboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}

.live-title {
    color: #f1c40f;
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    animation: pulse 2s infinite;
}

.score-area {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 15px 0;
    width: 100%;
}

.team-name {
    font-size: 1rem;
    font-weight: 800;
    flex: 1;
    transition: color 0.3s ease;
}

.score-box {
    font-size: 2rem;
    font-weight: 800;
    background: #000;
    padding: 8px 18px;
    border-radius: 10px;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    white-space: nowrap;
    margin: 0 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.match-minute {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

.scorer-list {
    text-align: left;
    font-size: 0.9rem;
    color: #8b949e;
    line-height: 1.8;
    border-top: 1px solid #30363d;
    padding-top: 15px;
    width: 100%;
}

.sports-refresh-btn {
    background: linear-gradient(135deg, #238636, #2ea043);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(35, 134, 54, 0.3);
}

.sports-refresh-btn:hover {
    background: linear-gradient(135deg, #2ea043, #3fb950);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(35, 134, 54, 0.5);
}

.sports-refresh-btn:active {
    transform: translateY(0);
}

/* ===================================================
   TERMINAL OVERLAY
   =================================================== */
.terminal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 1);
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 20px;
    box-sizing: border-box;
    font-size: 0.85rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transform: translateY(100%);
    transition: transform 0.5s ease;
    z-index: 300;
    overflow-y: auto;
}

.terminal-overlay.active {
    transform: translateY(0);
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 100%;
    }
}

#terminal-text {
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

/* ===================================================
   ANIMATIONS & EFFECTS
   =================================================== */
@keyframes shake {
    0% { transform: translate(1px, 1px); }
    25% { transform: translate(-1px, -1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, 1px); }
    100% { transform: translate(1px, -1px); }
}

/* Glitch effect for dark mode transition */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

body.dark-mode .device-container {
    animation: glitch 0.3s ease-in-out;
}

/* ===================================================
   UTILITY CLASSES
   =================================================== */
.hidden {
    display: none !important;
}

/* ===================================================
   RESPONSIVE ADJUSTMENTS
   =================================================== */
@media (max-height: 700px) {
    .clock {
        font-size: 2.5rem;
    }
    
    .app-grid {
        gap: 15px;
    }
    
    .app-icon {
        width: 50px;
        height: 50px;
    }
}

/* ===================================================
   ACCESSIBILITY
   =================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for keyboard navigation */
button:focus,
.choice-btn:focus,
.action-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}
/* ===================================================
   CRACK SCREEN OVERLAY — State 3+
   =================================================== */
#crack-screen {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9990;
    opacity: 0;
    transition: opacity 0.5s;
}
#crack-screen.active {
    opacity: 1;
}
#crack-screen svg {
    width: 100%;
    height: 100%;
}

/* ===================================================
   FAKE LOW-BATTERY SHUTDOWN OVERLAY
   =================================================== */
#battery-shutdown {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s;
}
#battery-shutdown.active {
    opacity: 1;
    pointer-events: all;
}
#battery-shutdown .bat-icon {
    font-size: 3.5rem;
    animation: pulse 1s infinite;
}
#battery-shutdown .bat-msg {
    color: #e74c3c;
    font-family: monospace;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.8;
}
#battery-shutdown .bat-sub {
    color: #2ecc71;
    font-family: monospace;
    font-size: 0.75rem;
    text-align: center;
    opacity: 0;
    transition: opacity 1s 2s;
}
#battery-shutdown.active .bat-sub {
    opacity: 1;
}

/* ===================================================
   SYSTEM UPDATE DIALOG
   =================================================== */
#system-update-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    backdrop-filter: blur(4px);
}
#system-update-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.update-dialog {
    background: #111;
    border: 1px solid #333;
    border-radius: 16px;
    width: min(340px, 90vw);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.update-dialog-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 16px 18px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 10px;
}
.update-dialog-header .upd-icon {
    font-size: 1.4rem;
}
.update-dialog-header .upd-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #eee;
}
.update-dialog-header .upd-sub {
    font-size: 0.68rem;
    color: #888;
    margin-top: 2px;
}
.update-dialog-body {
    padding: 16px 18px;
}
.update-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.78rem;
    color: #aaa;
    border-bottom: 1px solid #1a1a1a;
}
.update-item:last-child { border-bottom: none; }
.update-item .upd-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e74c3c;
    flex-shrink: 0;
    margin-top: 5px;
}
.update-dialog-actions {
    display: flex;
    gap: 0;
    border-top: 1px solid #222;
}
.upd-btn {
    flex: 1;
    padding: 14px;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: monospace;
    letter-spacing: 0.5px;
}
.upd-btn-install {
    background: rgba(46,204,113,0.12);
    color: #2ecc71;
    border-right: 1px solid #222;
}
.upd-btn-install:hover { background: rgba(46,204,113,0.22); }
.upd-btn-decline {
    background: rgba(231,76,60,0.08);
    color: #e74c3c;
}
.upd-btn-decline:hover { background: rgba(231,76,60,0.16); }

/* ===================================================
   ALASKA READ RECEIPT (double blue tick)
   =================================================== */
.read-receipt {
    font-size: 0.62rem;
    color: #3498db;
    margin-left: 4px;
    display: inline;
    opacity: 0;
    transition: opacity 0.8s;
}
.read-receipt.visible { opacity: 1; }
