:root {
    --bg-dark: #0a0e27;
    --neon-cyan: #00f0ff;
    --neon-purple: #b026ff;
    --text-main: #e0e0e0;
    --cat-work: #ff6644;
    --cat-personal: #00ccff;
    --cat-health: #ff4488;
    --cat-learning: #44ff88;
    --priority-low: #44ff88;
    --priority-medium: #ffcc00;
    --priority-high: #ff4444;
}

* { box-sizing: border-box; }

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    margin: 0; min-height: 100vh; overflow-x: hidden;
    display: flex; flex-direction: column;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; height: auto; }

/* ==================== SCANLINES ==================== */
.scanlines {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px; pointer-events: none; z-index: 100;
}

.scanline-beam {
    position: fixed; top: 0; left: 0; width: 100%; height: 100px;
    background: linear-gradient(0deg, rgba(0,0,0,0) 0%, rgba(0,240,255,0.04) 50%, rgba(0,0,0,0) 100%);
    pointer-events: none; z-index: 101;
    animation: scanlineBeam 10s linear infinite;
}

@keyframes scanlineBeam {
    0% { top: -100px; }
    100% { top: calc(100vh + 100px); }
}

/* ==================== INIT SCREEN ==================== */
.init-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 30px;
}

.init-logo {
    font-family: 'Orbitron', sans-serif; font-size: clamp(1.8rem, 8vw, 3rem);
    color: var(--neon-cyan); text-shadow: 0 0 20px var(--neon-cyan);
    margin-bottom: 15px;
}

.init-sub {
    font-size: clamp(0.65rem, 2.5vw, 0.8rem); color: #666; margin-bottom: 40px;
    letter-spacing: 2px; padding: 0 10px;
}

.color-grid {
    display: flex; gap: 25px; margin-bottom: 40px; flex-wrap: wrap; justify-content: center;
}

.color-opt {
    width: 60px; height: 60px; border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer; transition: all 0.3s ease; border-radius: 8px;
    min-width: 44px; min-height: 44px;
}

.color-opt:hover {
    transform: scale(1.2); border-color: #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
}

.init-hint {
    font-size: 0.65rem; color: #444; letter-spacing: 3px;
}

/* ==================== HEADER ==================== */
.cyber-header {
    padding: 12px 16px; display: flex; justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--neon-cyan); box-shadow: 0 0 10px var(--neon-cyan);
    z-index: 50; flex-shrink: 0;
    flex-wrap: wrap; gap: 8px;
}

.logo {
    font-family: 'Orbitron', sans-serif; font-size: clamp(0.9rem, 3vw, 1.4rem);
    color: var(--neon-cyan); text-shadow: 0 0 10px var(--neon-cyan);
    letter-spacing: 2px; white-space: nowrap;
}

.header-right {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

.system-status {
    display: flex; align-items: center; gap: 8px;
}

.status-label {
    font-size: 0.6rem; color: #666; letter-spacing: 1px; display: none;
}

.status-bar {
    width: 80px; height: 6px; background: #111; border: 1px solid #333;
    border-radius: 3px; overflow: hidden;
}

.status-fill {
    height: 100%; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 3px; transition: width 0.5s ease;
}

.header-clock {
    font-family: 'Orbitron', sans-serif;
    color: var(--neon-cyan); font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    text-shadow: 0 0 8px var(--neon-cyan); white-space: nowrap;
}

/* ==================== GLITCH EFFECT ==================== */
.glitch {
    position: relative;
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}
.glitch::before {
    color: var(--neon-purple);
    text-shadow: 2px 0 var(--neon-purple);
    clip-path: inset(0 0 65% 0);
    animation: glitch-top 2s ease-in-out infinite alternate;
}
.glitch::after {
    color: var(--neon-cyan);
    text-shadow: -2px 0 var(--neon-cyan);
    clip-path: inset(65% 0 0 0);
    animation: glitch-bottom 1.5s ease-in-out infinite alternate;
}
@keyframes glitch-top {
    0% { clip-path: inset(0 0 65% 0); transform: translate(0); }
    20% { clip-path: inset(10% 0 60% 0); transform: translate(-3px, 1px); }
    40% { clip-path: inset(0 0 55% 0); transform: translate(2px, -1px); }
    60% { clip-path: inset(5% 0 65% 0); transform: translate(-1px, 2px); }
    80% { clip-path: inset(15% 0 50% 0); transform: translate(3px, -2px); }
    100% { clip-path: inset(0 0 65% 0); transform: translate(0); }
}
@keyframes glitch-bottom {
    0% { clip-path: inset(65% 0 0 0); transform: translate(0); }
    20% { clip-path: inset(70% 0 5% 0); transform: translate(2px, 1px); }
    40% { clip-path: inset(60% 0 0 0); transform: translate(-3px, -1px); }
    60% { clip-path: inset(75% 0 5% 0); transform: translate(1px, 2px); }
    80% { clip-path: inset(65% 0 0 0); transform: translate(-2px, -2px); }
    100% { clip-path: inset(65% 0 0 0); transform: translate(0); }
}

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
    flex: 1; display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 12px; padding: 12px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.widget {
    background: rgba(10, 14, 39, 0.9); border: 1px solid var(--neon-cyan);
    padding: 12px; box-shadow: inset 0 0 5px var(--neon-cyan);
    border-radius: 4px; overflow: hidden;
}

.widget-title {
    color: var(--neon-cyan); font-size: clamp(0.6rem, 2.5vw, 0.7rem); margin-bottom: 10px;
    border-left: 3px solid var(--neon-cyan); padding-left: 8px;
    letter-spacing: 1px;
}

.neon-text {
    font-size: clamp(1.8rem, 8vw, 3rem); color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
}

.neon-cyan { color: var(--neon-cyan); }
.neon-purple { color: var(--neon-purple); }

.input-group { display: flex; gap: 5px; margin-bottom: 10px; }
input, textarea {
    background: #000; border: 1px solid var(--neon-cyan); color: #fff;
    padding: 10px; flex: 1; font-family: 'Fira Code', monospace;
    font-size: 16px; outline: none; min-width: 0;
    -webkit-appearance: none; border-radius: 3px;
}
input:focus, textarea:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}
button {
    background: var(--neon-cyan); border: none; padding: 10px 16px;
    cursor: pointer; font-weight: bold; color: #000;
    font-family: 'Fira Code', monospace; font-size: 0.8rem;
    transition: all 0.2s ease; min-height: 44px; min-width: 44px;
    border-radius: 3px; touch-action: manipulation;
    -webkit-user-select: none; user-select: none;
}
button:hover {
    box-shadow: 0 0 12px var(--neon-cyan);
    transform: translateY(-1px);
}

select {
    background: #000; border: 1px solid var(--neon-cyan); color: #fff;
    padding: 10px 8px; font-family: 'Fira Code', monospace;
    font-size: 16px; cursor: pointer; outline: none;
    min-height: 44px; -webkit-appearance: none; border-radius: 3px;
}

/* ==================== STATS WIDGET ==================== */
.stats-widget {
    border-color: var(--neon-purple) !important;
    box-shadow: inset 0 0 8px var(--neon-purple) !important;
}

.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 15px;
}

.stat-card {
    background: rgba(5, 5, 15, 0.8); border: 1px solid #333;
    padding: 10px 8px; text-align: center; position: relative;
    border-radius: 3px;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 3px; height: 100%; background: var(--neon-purple);
}
.stat-value {
    font-size: clamp(1rem, 4vw, 1.4rem); color: var(--neon-cyan);
    font-family: 'Orbitron', sans-serif;
}
.stat-label {
    font-size: 0.6rem; color: #888; margin-top: 4px;
    letter-spacing: 1px;
}

.btn-history {
    width: 100%; padding: 12px; margin-bottom: 8px;
    background: rgba(176, 38, 255, 0.15); border: 1px solid var(--neon-purple);
    color: var(--neon-cyan); font-size: 0.75rem; border-radius: 3px;
    min-height: 44px;
}
.btn-history:hover {
    background: rgba(176, 38, 255, 0.35);
    box-shadow: 0 0 12px rgba(176, 38, 255, 0.3);
}
.btn-export {
    background: rgba(0, 240, 255, 0.1); border-color: var(--neon-cyan);
}

/* ==================== TASK WIDGET ==================== */
.task-widget {
    border-color: var(--neon-purple) !important;
    box-shadow: inset 0 0 8px var(--neon-purple) !important;
}

.task-input-row {
    display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap;
}
.task-input-row input {
    flex: 1; min-width: 0;
}
.task-input-row select {
    flex: 0 0 auto;
}
.task-input-row .btn-add {
    flex: 0 0 auto; padding: 10px 20px; font-size: 1rem;
    font-weight: bold; min-width: 48px; min-height: 44px;
}

.btn-add {
    background: var(--neon-cyan); color: #000;
    font-family: 'Orbitron', sans-serif; font-weight: 700;
}

.task-filters {
    display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255,255,255,0.05); border: 1px solid #333;
    color: #888; padding: 8px 12px; font-size: 0.75rem;
    border-radius: 3px; cursor: pointer; transition: all 0.2s;
    min-height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center;
}
.filter-btn:hover {
    border-color: var(--neon-cyan); color: var(--neon-cyan);
}
.filter-btn.active {
    background: rgba(0, 240, 255, 0.15); border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.task-item {
    background: rgba(5, 5, 15, 0.7); border: 1px solid #222;
    margin-bottom: 8px; padding: 12px; display: flex; align-items: center;
    gap: 10px; transition: all 0.3s ease; cursor: pointer;
    border-radius: 3px; min-height: 44px;
}
.task-item:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.1);
}
.task-item.completed {
    opacity: 0.5; border-color: #333;
}
.task-item.completed .task-text {
    text-decoration: line-through; color: #666;
}

.checkbox {
    width: 22px; height: 22px; border: 2px solid var(--neon-cyan);
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; border-radius: 3px;
}
.checkbox.checked {
    background: var(--neon-purple); border-color: var(--neon-purple);
}
.checkbox.checked::after {
    content: '✓'; color: #fff; font-size: 0.8rem; font-weight: bold;
}

.task-content {
    flex: 1; min-width: 0; overflow: hidden;
}
.task-text {
    font-size: 0.85rem; display: block; margin-bottom: 4px;
    word-wrap: break-word; overflow-wrap: break-word;
}
.task-meta {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}

.task-category-badge, .task-priority-badge {
    font-size: 0.6rem; padding: 3px 6px; border-radius: 2px;
    letter-spacing: 0.5px;
}
.task-deadline {
    font-size: 0.6rem; color: var(--neon-cyan);
}
.task-completed-at {
    font-size: 0.6rem; color: #666;
}

/* Category Colors */
.cat-work { background: rgba(255,102,68,0.2); color: var(--cat-work); border: 1px solid rgba(255,102,68,0.3); }
.cat-personal { background: rgba(0,204,255,0.2); color: var(--cat-personal); border: 1px solid rgba(0,204,255,0.3); }
.cat-health { background: rgba(255,68,136,0.2); color: var(--cat-health); border: 1px solid rgba(255,68,136,0.3); }
.cat-learning { background: rgba(68,255,136,0.2); color: var(--cat-learning); border: 1px solid rgba(68,255,136,0.3); }

/* Priority Colors */
.priority-low { border-left: 2px solid var(--priority-low); }
.priority-medium { border-left: 2px solid var(--priority-medium); }
.priority-high { border-left: 2px solid var(--priority-high); }

.task-actions {
    display: flex; gap: 5px; flex-shrink: 0;
}

.task-btn {
    background: transparent; border: 1px solid #333; color: #888;
    padding: 8px; font-size: 0.8rem; cursor: pointer;
    transition: all 0.2s; min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.task-btn:hover {
    border-color: var(--priority-high); color: var(--priority-high);
}

.task-completed {
    animation: taskGlow 0.6s ease;
}

@keyframes taskGlow {
    0% { background: rgba(0, 255, 136, 0.3); box-shadow: 0 0 15px rgba(0,255,136,0.3); }
    100% { background: transparent; box-shadow: none; }
}

.btn-clear {
    width: 100%; background: transparent; border: 1px solid #ff4444;
    color: #ff4444; padding: 12px; font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem; margin-top: 10px; cursor: pointer;
    transition: 0.3s; letter-spacing: 1px; border-radius: 3px;
    min-height: 44px;
}
.btn-clear:hover {
    background: #ff4444; color: #fff;
}

/* ==================== CALENDAR WIDGET ==================== */
.calendar-widget {
    border-color: var(--neon-cyan) !important;
}

.calendar-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}

.cal-nav {
    background: rgba(0, 240, 255, 0.1); border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan); padding: 10px 16px; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.cal-nav:hover {
    background: rgba(0, 240, 255, 0.25);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.cal-month-year {
    font-family: 'Orbitron', sans-serif; font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    color: var(--neon-cyan); letter-spacing: 1px;
}

.calendar-day-names {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px; margin-bottom: 5px;
}
.calendar-day-names span {
    text-align: center; font-size: 0.6rem; color: #888;
    padding: 6px 0; letter-spacing: 1px;
}

.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 3px; margin-bottom: 12px;
}

.cal-day {
    background: rgba(5, 5, 15, 0.6); border: 1px solid #1a1a2e;
    padding: 6px 3px; min-height: 44px; text-align: center;
    cursor: pointer; transition: all 0.2s; border-radius: 2px;
    position: relative;
}
.cal-day:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.15);
}
.cal-day.empty {
    background: transparent; border: none; cursor: default;
}
.cal-day.today {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.1);
}
.cal-day.today .cal-day-num {
    color: var(--neon-cyan); font-weight: bold;
}

.cal-day-num {
    font-size: clamp(0.55rem, 2vw, 0.65rem); color: #aaa; display: block;
}

.cal-indicators {
    display: flex; gap: 2px; justify-content: center; margin-top: 2px;
}

.cal-indicator {
    width: 5px; height: 5px; border-radius: 50%;
}
.cal-indicator.cal-deadline {
    width: 5px; height: 5px; border-radius: 50%;
    animation: deadlinePulse 2s ease infinite;
}

@keyframes deadlinePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.cal-event-section {
    border-top: 1px solid #222; padding-top: 10px;
}

.section-label {
    font-size: 0.65rem; color: var(--neon-purple); margin-bottom: 8px;
    display: block; font-weight: bold; letter-spacing: 1px;
}

.cal-event-input {
    display: flex; gap: 5px; flex-wrap: wrap;
}
.cal-event-input input, .cal-event-input select {
    font-size: 0.85rem;
}
.cal-event-input input[type="date"] {
    flex: 0 0 auto;
}

/* ==================== NOTES WIDGET ==================== */
.notes-widget {
    border-color: var(--neon-purple) !important;
}
.notes-widget textarea {
    width: 100%; height: 100px; resize: none;
    border-left: 4px solid var(--neon-purple);
    background: rgba(0,0,0,0.3); padding: 10px;
    font-size: 0.85rem;
}

/* ==================== SEARCH ITEM ==================== */
.search-item {
    margin-top: 10px; padding: 10px; border: 1px dashed var(--neon-cyan);
    font-size: 0.8rem; border-radius: 3px;
}

/* ==================== TASK HISTORY MODAL ==================== */
.history-content {
    width: 95%; max-width: 550px; padding: 20px;
}

.history-filter-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}

.history-count {
    font-size: 0.7rem; color: #666;
}

.history-list {
    max-height: 400px; overflow-y: auto; margin-bottom: 15px;
}

.history-item {
    background: rgba(5, 5, 15, 0.8); border: 1px solid #222;
    padding: 12px; margin-bottom: 8px; border-radius: 3px;
    transition: border-color 0.2s;
}
.history-item:hover {
    border-color: var(--neon-purple);
}

.history-item-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 6px; gap: 8px;
}

.history-task-text {
    font-size: 0.85rem; color: var(--text-main); flex: 1;
    word-wrap: break-word; overflow-wrap: break-word;
}

.history-item-date {
    font-size: 0.6rem; color: #666; white-space: nowrap;
}

.history-item-meta {
    display: flex; gap: 6px; flex-wrap: wrap;
}

.history-empty {
    text-align: center; color: #444; padding: 30px;
    font-size: 0.8rem; letter-spacing: 1px;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); display: flex; justify-content: center;
    align-items: center; z-index: 1000;
    padding: 16px;
}
.modal-content {
    background: var(--bg-dark); border: 2px solid var(--neon-purple);
    padding: 20px; width: 95%; max-width: 420px;
    box-shadow: 0 0 30px var(--neon-purple);
    max-height: 90vh; overflow-y: auto; border-radius: 6px;
}
.hidden { display: none; }

/* ==================== PET STYLES ==================== */
.pet-selection-content {
    width: 95%; max-width: 700px; text-align: center;
}
.select-desc {
    color: #888; font-size: 0.85rem; margin-bottom: 20px;
}
.pet-select-grid {
    display: flex; gap: 12px; justify-content: center; margin-bottom: 25px;
    flex-wrap: wrap;
}
.pet-select-card {
    background: rgba(10, 14, 39, 0.95); border: 2px solid #333;
    padding: 16px; cursor: pointer; transition: all 0.3s ease;
    flex: 0 1 180px; border-radius: 8px;
    min-height: 44px;
}
.pet-select-card:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    transform: translateY(-5px);
}
.pet-select-card.selected {
    border-color: var(--neon-purple);
    box-shadow: 0 0 30px rgba(176, 38, 255, 0.5);
    background: rgba(176, 38, 255, 0.1);
}
.pet-select-emoji { font-size: 2.5rem; margin-bottom: 10px; }
.pet-select-name {
    font-size: 1rem; font-weight: bold; color: var(--neon-cyan);
    margin-bottom: 8px; font-family: 'Orbitron', sans-serif;
}
.pet-select-desc { font-size: 0.7rem; color: #aaa; margin-bottom: 10px; line-height: 1.4; }
.pet-select-stats {
    display: flex; justify-content: space-around; font-size: 0.65rem;
}
.pet-name-row { margin-bottom: 20px; }
.pet-name-row label { display: block; margin-bottom: 8px; font-size: 0.8rem; }
.pet-name-row input { width: 100%; padding: 12px; font-size: 1rem; text-align: center; }

.confirm-btn {
    background: var(--neon-purple); color: #fff; padding: 14px 30px;
    font-size: 1rem; border: none; cursor: pointer; font-weight: bold;
    border-radius: 4px; transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    min-height: 48px; width: 100%;
}
.confirm-btn:hover {
    box-shadow: 0 0 20px var(--neon-purple);
    transform: scale(1.05);
}

/* Pet Widget */
.pet-widget {
    border-color: var(--neon-purple) !important;
    box-shadow: inset 0 0 8px var(--neon-purple) !important;
}
.pet-container {
    display: flex; flex-direction: column; align-items: center;
}
.pet-header {
    display: flex; gap: 8px; align-items: center; width: 100%;
    justify-content: space-between; margin-bottom: 5px; font-size: 0.8rem;
    flex-wrap: wrap;
}
.pet-name { font-family: 'Orbitron', sans-serif; font-weight: bold; color: var(--neon-cyan); font-size: clamp(0.8rem, 2.5vw, 1rem); }
.pet-level { color: var(--neon-purple); font-weight: bold; }
.pet-stage { color: #ffaa00; font-size: 0.7rem; border: 1px solid #ffaa00; padding: 2px 6px; border-radius: 3px; }
.pet-mood { font-size: 1.2rem; }
#pet-canvas {
    background: transparent; border: 1px solid rgba(176, 38, 255, 0.3);
    margin: 5px 0; border-radius: 4px; image-rendering: pixelated;
    max-width: 100%; height: auto;
}
.pet-message {
    min-height: 20px; font-size: 0.75rem; color: var(--neon-cyan);
    text-align: center; padding: 5px; font-style: italic;
    opacity: 0; transition: opacity 0.3s ease; max-width: 280px;
    word-wrap: break-word;
}
.pet-message.show { opacity: 1; }
.pet-stats { width: 100%; margin: 8px 0; }
.stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.stat-label { font-size: 0.65rem; color: #888; min-width: 80px; }
.stat-bar {
    flex: 1; height: 8px; background: #111; border: 1px solid #333;
    border-radius: 4px; overflow: hidden;
}
.stat-fill { height: 100%; transition: width 0.5s ease, background-color 0.5s ease; border-radius: 4px; }
#hunger-fill { background: linear-gradient(90deg, #ff4444, #ff8800); }
#happiness-fill { background: linear-gradient(90deg, #00ff88, #00ccff); }
#energy-fill { background: linear-gradient(90deg, #ffaa00, #ffff00); }
.xp-bar { height: 6px; }
.xp-fill { background: linear-gradient(90deg, var(--neon-purple), #ff44ff) !important; }
.pet-info-row { display: flex; justify-content: space-between; width: 100%; margin: 5px 0; font-size: 0.8rem; }
.pet-credits { color: #ffaa00; }
.pet-streak { color: #ff6600; }
.pet-actions { display: flex; gap: 8px; width: 100%; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.pet-btn {
    background: rgba(176, 38, 255, 0.2); border: 1px solid var(--neon-purple);
    color: var(--neon-cyan); padding: 10px 16px; cursor: pointer;
    font-size: 0.8rem; transition: all 0.2s ease; border-radius: 4px;
    font-family: 'Fira Code', monospace;
    min-height: 44px; flex: 1 1 auto;
}
.pet-btn:hover {
    background: rgba(176, 38, 255, 0.4);
    box-shadow: 0 0 10px rgba(176, 38, 255, 0.3);
}
.pet-btn:active { transform: scale(0.95); }
.pet-btn.small { padding: 8px 12px; font-size: 0.7rem; min-height: 44px; }
.pet-utils { display: flex; gap: 8px; width: 100%; justify-content: center; flex-wrap: wrap; }
.pet-widget.anim-happy { animation: petHappy 0.5s ease; }
.pet-widget.anim-sad { animation: petSad 0.5s ease; }
@keyframes petHappy {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-8px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-4px); }
}
@keyframes petSad {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Inventory */
.inventory-content { width: 95%; max-width: 350px; }
.inventory-list { max-height: 300px; overflow-y: auto; margin: 15px 0; }
.inv-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #222; font-size: 0.85rem; min-height: 44px; }
.inv-count { color: var(--neon-cyan); font-weight: bold; }
.close-btn {
    background: #333; color: #fff; padding: 12px 20px;
    border: 1px solid #555; cursor: pointer; width: 100%;
    margin-top: 10px; border-radius: 4px;
    min-height: 44px;
}
.close-btn:hover { background: #444; }

/* Shop */
.shop-content { width: 95%; max-width: 450px; }
.shop-balance {
    font-size: 1rem; margin-bottom: 15px; padding: 12px;
    background: rgba(0, 240, 255, 0.1); border: 1px solid var(--neon-cyan);
    border-radius: 4px; text-align: center;
}
.shop-section { margin-bottom: 20px; }
.shop-section-title {
    color: var(--neon-cyan); font-size: 0.85rem; margin-bottom: 10px;
    border-left: 3px solid var(--neon-cyan); padding-left: 8px;
}
.shop-items { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: rgba(10, 14, 39, 0.8);
    border: 1px solid #333; cursor: pointer; transition: all 0.2s ease;
    border-radius: 4px; min-height: 44px; gap: 8px;
}
.shop-item:hover {
    border-color: var(--neon-purple);
    background: rgba(176, 38, 255, 0.1);
}
.shop-item-name { color: var(--neon-cyan); font-weight: bold; min-width: 80px; font-size: 0.8rem; }
.shop-item-desc { color: #888; font-size: 0.7rem; flex: 1; padding: 0 8px; }
.shop-item-price { color: #ffaa00; font-weight: bold; white-space: nowrap; }

/* Setting items */
.setting-item { margin-bottom: 20px; display: flex; flex-direction: column; gap: 5px; }
.setting-item label { font-size: 0.75rem; color: #888; }
.setting-item input[type="text"] { width: 100%; }

/* Weather Widget */
.weather-widget .temp {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-family: 'Orbitron', sans-serif;
}
.weather-widget .desc {
    font-size: 0.8rem; color: #aaa;
}

/* Music/Audio Widget */
.music-widget audio {
    width: 100%;
}

/* Footer */
.cyber-footer {
    padding: 10px 16px; display: flex; justify-content: space-between;
    align-items: center; border-top: 1px solid #222; font-size: 0.6rem;
    color: #444; flex-shrink: 0; flex-wrap: wrap; gap: 8px;
}
.cyber-footer button {
    background: transparent; border: 1px solid #333; color: #888;
    padding: 8px 14px; font-size: 0.7rem;
    min-height: 44px; min-width: 44px;
}

/* ==================== RESPONSIVE — TABLET (768px–1024px) ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px; padding: 16px;
    }
    .header-clock { font-size: 1rem; }
}

/* ==================== RESPONSIVE — MOBILE (≤ 768px) ==================== */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; padding: 10px; gap: 10px;
    }
    .cyber-header {
        padding: 10px 12px;
    }
    .status-label { display: none; }
    .status-bar { width: 60px; }

    /* Pet Selection */
    .pet-select-grid {
        flex-direction: column; align-items: center;
    }
    .pet-select-card { width: 100%; max-width: 280px; }
    .pet-selection-content,
    .inventory-content,
    .shop-content,
    .history-content { width: 95%; padding: 16px; }

    /* Task Input */
    .task-input-row { flex-direction: column; }
    .task-input-row select { width: 100%; }
    .task-input-row .btn-add { width: 100%; }

    /* Calendar Event Input */
    .cal-event-input { flex-direction: column; }
    .cal-event-input select { width: 100%; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

    .header-clock { display: block; font-size: 0.85rem; }

    /* Pet actions stack on narrow screens */
    .pet-actions { flex-direction: column; }
    .pet-actions .pet-btn { width: 100%; }

    .pet-utils { flex-direction: column; }
    .pet-utils .pet-btn { width: 100%; }

    /* Modal adjustments */
    .modal-content { max-height: 85vh; padding: 16px; }

    /* History */
    .history-item-header { flex-direction: column; gap: 4px; }
}

/* ==================== RESPONSIVE — SMALL MOBILE (≤ 414px) ==================== */
@media (max-width: 414px) {
    body { font-size: 14px; }

    .cyber-header { padding: 8px 10px; }
    .logo { font-size: 0.9rem; letter-spacing: 1px; }
    .header-right { gap: 8px; }
    .header-clock { font-size: 0.8rem; }

    .dashboard-grid { padding: 8px; gap: 8px; }

    .widget { padding: 10px; }
    .widget-title { font-size: 0.6rem; }

    .neon-text { font-size: 1.6rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-value { font-size: 1rem; }
    .stat-card { padding: 8px 6px; }

    .task-text { font-size: 0.8rem; }
    .task-meta { gap: 4px; }
    .task-category-badge, .task-priority-badge { font-size: 0.55rem; padding: 2px 4px; }

    .cal-day { min-height: 40px; padding: 4px 2px; }
    .cal-day-num { font-size: 0.55rem; }
    .cal-month-year { font-size: 0.7rem; }
    .calendar-day-names span { font-size: 0.5rem; }

    .pet-name { font-size: 0.8rem; }
    .pet-header { gap: 6px; }
    .pet-stage { font-size: 0.6rem; padding: 1px 4px; }

    .shop-item { flex-direction: column; align-items: flex-start; gap: 4px; }
    .shop-item-desc { padding: 4px 0; }

    .footer { font-size: 0.5rem; }
    .cyber-footer { font-size: 0.5rem; padding: 8px 10px; }
}

/* ==================== RESPONSIVE — TINY MOBILE (≤ 375px) ==================== */
@media (max-width: 375px) {
    .cyber-header { padding: 8px; }
    .logo { font-size: 0.8rem; }
    .header-right { gap: 6px; }

    .widget { padding: 8px; }
    .widget-title { font-size: 0.55rem; padding-left: 6px; }

    .stats-grid { gap: 5px; }
    .stat-value { font-size: 0.9rem; }
    .stat-label { font-size: 0.5rem; }

    .btn-history { font-size: 0.65rem; padding: 10px; }

    .filter-btn { padding: 8px 8px; font-size: 0.65rem; }

    .cal-day { min-height: 36px; }
    .cal-day-num { font-size: 0.5rem; }

    .pet-btn { padding: 8px 10px; font-size: 0.7rem; }

    .cal-nav { padding: 8px 12px; }
}

/* ==================== RESPONSIVE — VERY TINY (≤ 320px) ==================== */
@media (max-width: 320px) {
    .cyber-header { padding: 6px 8px; flex-wrap: wrap; }
    .logo { font-size: 0.75rem; }
    .header-clock { font-size: 0.75rem; }

    .dashboard-grid { padding: 6px; gap: 6px; }

    .widget { padding: 6px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
    .stat-card { padding: 6px 4px; }
    .stat-value { font-size: 0.85rem; }
    .stat-label { font-size: 0.45rem; }

    .cal-day { min-height: 32px; }
    .cal-day-num { font-size: 0.45rem; }

    .cal-nav { padding: 6px 10px; font-size: 0.7rem; min-width: 40px; min-height: 40px; }

    .pet-select-card { padding: 12px; }
    .pet-select-emoji { font-size: 2rem; }
    .pet-select-name { font-size: 0.85rem; }

    .task-input-row .btn-add { font-size: 0.9rem; }

    .input-group { flex-direction: column; gap: 6px; }
    .input-group button { width: 100%; }

    .weather-widget .temp { font-size: 1.5rem; }
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .cyber-header { padding: 6px 12px; }
    .widget { padding: 8px; }
    .dashboard-grid { gap: 8px; padding: 8px; }
    .pet-container { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 12px; }
    #pet-canvas { max-width: 120px; }
}

/* ==================== TOUCH DEVICE ENHANCEMENTS ==================== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets for touch devices */
    button { min-height: 44px; }
    .filter-btn { min-height: 44px; min-width: 44px; }
    .cal-day { min-height: 44px; }
    .task-btn { min-height: 44px; min-width: 44px; }
    .checkbox { width: 24px; height: 24px; }
    .cal-nav { min-height: 44px; }
    .color-opt { min-height: 50px; min-width: 50px; }

    /* Disable hover effects on touch */
    .task-item:hover { box-shadow: none; border-color: #222; }
    .pet-btn:hover { box-shadow: none; }
    button:hover { transform: none; }
}

/* ==================== DARK MODE SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0e27; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: #333 #0a0e27; }
