* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, sans-serif;
}

html, body {
    height: 100%;
}

/* UI scale variables */
:root {
    --ui-scale: 1;
    --icon-size: 64px;
    --desktop-padding: 20px;
    --window-font-size: 14px;
    --window-padding: 10px;
    --taskbar-width: 260px;
}

body.ui-scale-small {
    --ui-scale: 0.7;
    --icon-size: 50px;
    --window-font-size: 10px;
}

body.ui-scale-medium {
    --ui-scale: 1.15;
}

body.ui-scale-large {
    --ui-scale: 1.4;
    --icon-size: 76px;
    --window-font-size: 18px;
}

/* Background layer */
body {
    color: #fff;
    overflow: hidden;
    position: relative;
}

#bg-layer {
    position: fixed;
    inset: 0;
    background: url("https://srmorality.neocities.org/Images/Aero%20Orange.webp") center/cover no-repeat fixed;
    animation: bg-zoom 40s ease-in-out infinite alternate;
    z-index: -2;
}

/* Optional parallax will adjust transform; when disabled, stays centered */
body.no-parallax #bg-layer {
    transform: none !important;
}

/* star overlay (kept for visual texture) */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.7;
    z-index: -1;
}

/* bubble particles */
#bubble-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

body.no-bubbles #bubble-container {
    display: none;
}

.bubble {
    position: absolute;
    background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255,255,255,0.15));
    border-radius: 50%;
    opacity: 0.8;
    animation: bubble-rise linear forwards;
}

@keyframes bubble-rise {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    100% { transform: translateY(-120vh) scale(0.6); opacity: 0; }
}

/* Ripple layer */
#ripple-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.8;
    animation: ripple-anim 0.6s ease-out forwards;
}

@keyframes ripple-anim {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Desktop */
.desktop {
    position: absolute;
    inset: 0;
    padding: calc(var(--desktop-padding) * var(--ui-scale));
    padding-right: calc((var(--taskbar-width) + 20px) * 1);
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: calc(20px * var(--ui-scale));
    z-index: 2;
}

/* Desktop icons */
.desktop-icon {
    transform-origin: bottom center;
    width: calc(80px * var(--ui-scale));
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.18s ease-out;
    position: relative;
}

.desktop-icon:hover {
    animation:
        dc-start 0.25s ease-out forwards,
        dc-loop 1.4s ease-in-out 0.25s infinite;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.7));
}

body.no-bounce .desktop-icon:hover {
    animation: none;
    filter: none;
}

/* Icon container keeps the original gradient background */
.icon-image {
    width: var(--icon-size);
    height: var(--icon-size);
    margin: 0 auto 4px;
    border-radius: 16px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #ffcc80 40%, #ff9800 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Image sizing and stacking for idle/hover states */
.icon-image img.icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
}

/* Idle visible by default, hover hidden */
.icon-image img.icon-img.hover {
    display: none;
}

/* Swap images on hover using pure CSS */
.desktop-icon:hover .icon-img.idle {
    display: none;
}

.desktop-icon:hover .icon-img.hover {
    display: block;
}

.icon-label {
    font-size: 13px;
    text-shadow: 0 0 4px rgba(0,0,0,0.7);
}

/* Dreamcast-ish bounce */
@keyframes dc-start {
    0%   { transform: rotate(0deg) scale(1); }
    60%  { transform: rotate(-32deg) scale(1.03, 0.97); }
    100% { transform: rotate(-30deg) scale(1); }
}

@keyframes dc-loop {
    0%   { transform: rotate(-30deg) translateY(-2px); }
    50%  { transform: rotate(30deg) translateY(-2px); }
    100% { transform: rotate(-30deg) translateY(-2px); }
}

/* Right-side taskbar */
.taskbar-vertical {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--taskbar-width);
    height: 100%;
    background: rgba(5,10,20,0.9);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255,255,255,0.25);
    display: flex;
    flex-direction: column;
    z-index: 3;
    transition: width 0.2s ease-out;
}

.taskbar-vertical.collapsed {
    width: 64px;
}

.taskbar-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 10px;
    border-bottom: 1px solid rgba(255,255,255,0.25);
}

.os-title {
    font-weight: 600;
    text-shadow: 0 0 4px rgba(255,255,255,0.6);
    margin-right: auto;
}

.taskbar-vertical.collapsed .os-title,
.taskbar-vertical.collapsed #taskbar-hide {
    display: none;
}

#start-button,
#taskbar-hide {
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}

#start-button:hover,
#taskbar-hide:hover {
    background: rgba(255,152,0,0.85);
    color: #1b1305;
}

.taskbar-items {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.taskbar-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    cursor: pointer;
    font-size: 13px;
    gap: 6px;
}

.taskbar-item.active {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
    color: #1b1305;
    box-shadow: 0 0 10px rgba(255,152,0,0.9);
}

.taskbar-item-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.taskbar-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.taskbar-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taskbar-item button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.taskbar-vertical.collapsed .taskbar-item-label,
.taskbar-vertical.collapsed .taskbar-item button {
    display: none;
}

/* Hotzone for expanding collapsed taskbar */
#taskbar-expand-hotzone {
    position: fixed;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    z-index: 9999;
    pointer-events: auto;
}

/* Start Menu Panel */
.start-panel {
    position: fixed;
    top: 50px;
    right: var(--taskbar-width);
    width: 320px;
    max-width: 90vw;
    max-height: calc(100% - 80px);
    background: rgba(15,25,45,0.96);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 0 24px rgba(0,0,0,0.7);
    z-index: 4;
    overflow: auto;
    animation: start-panel-pop 0.25s ease-out;
}

.start-panel-inner {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.start-panel-title {
    font-size: 18px;
    color: #ffcc80;
    text-shadow: 0 0 6px rgba(255,152,0,0.8);
}

.start-panel-text {
    font-size: 14px;
}

.start-panel-list {
    margin-left: 18px;
    font-size: 14px;
}

@keyframes start-panel-pop {
    0% { transform: translateX(20px); opacity: 0; }
    60% { transform: translateX(-4px); opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Windows */
.window {
    position: absolute;
    top: 80px;
    left: 80px;
    width: 520px;
    max-width: calc(100% - var(--taskbar-width) - 40px);
    max-height: calc(100% - 120px);
    display: flex;
    flex-direction: column;
    background: rgba(10, 20, 40, 0.95);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 0 24px rgba(0,0,0,0.7);
    overflow: hidden;
    z-index: 4;
    resize: both;
    font-size: var(--window-font-size);
}

.window-titlebar {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    background: linear-gradient(135deg, rgba(30,50,90,0.95), rgba(60,90,140,0.95));
    cursor: move;
}

.window-title-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    display: inline-block;
    overflow: hidden;
}

.window-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.window-title {
    font-size: 14px;
}

.window-controls button {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    margin-left: 4px;
}

.window-controls button:hover {
    color: #ffcc80;
}

.window-body {
    padding: var(--window-padding);
    overflow: auto;
}

/* Hidden */
.hidden {
    display: none;
}

/* Calendar */
#calendar-container {
    margin-top: 10px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-header button {
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 6px;
}

.calendar-day-name,
.calendar-day {
    text-align: center;
    padding: 4px;
    border-radius: 6px;
    font-size: 13px;
}

.calendar-day-name {
    font-weight: bold;
    opacity: 0.8;
}

.calendar-day {
    cursor: pointer;
    background: rgba(0,0,0,0.35);
}

.calendar-day:hover {
    background: rgba(255,255,255,0.2);
}

.calendar-day.has-note {
    background: rgba(0, 200, 140, 0.8);
}

/* Note list */
.note-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(0,0,0,0.35);
    padding: 6px;
    font-size: 13px;
}

.note-entry {
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(0,0,0,0.5);
    margin-bottom: 4px;
}

.note-entry-header {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 2px;
}

textarea {
    width: 100%;
    border-radius: 8px;
    border: none;
    outline: none;
    padding: 6px;
    background: rgba(0,0,0,0.35);
    color: #fff;
}

.note-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.note-buttons {
    display: flex;
    gap: 6px;
}

/* Photos */
.photo-gallery {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.photo-gallery img {
    width: 100%;
    border-radius: 10px;
    object-fit: cover;
}

.photo-wrapper {
    position: relative;
    cursor: pointer;
}

/* Dog profiles */
.dog-empty {
    text-align: center;
    margin-top: 20px;
}

.dog-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.dog-card {
    text-align: center;
    padding: 10px;
    border-radius: 16px;
    background: rgba(0,0,0,0.35);
    cursor: pointer;
    transition: 0.2s;
}

.dog-card:hover {
    background: rgba(255,152,0,0.8);
    color: #1b1305;
}

.dog-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 6px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #ffcc80 40%, #ff9800 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.dog-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.dog-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin: 10px auto;
    display: block;
}

.dog-name {
    font-weight: 600;
    font-size: 14px;
}

/* Dog form */
.dog-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dog-form label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.dog-form input,
.dog-form textarea {
    margin-top: 4px;
    padding: 6px;
    border-radius: 8px;
    border: none;
    outline: none;
    background: rgba(0,0,0,0.35);
    color: #fff;
}

.dog-form textarea {
    min-height: 60px;
}

/* Notebook */
.notebook-app {
    display: flex;
    height: 100%;
}

.notebook-sidebar {
    width: 160px;
    background: rgba(0,0,0,0.35);
    border-right: 1px solid rgba(255,255,255,0.2);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notebook-tabs {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notebook-tab {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    cursor: pointer;
}

.notebook-tab.active {
    background: rgba(255,193,7,0.9);
    color: #1b1305;
}

.notebook-editor {
    flex: 1;
    padding: 10px;
}

#notebook-textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    background: rgba(0,0,0,0.35);
    color: #fff;
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
}

/* Settings app */
.settings-app {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-section {
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
}

.settings-section h2 {
    margin-bottom: 6px;
    font-size: 15px;
}

/* Views */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.view.active {
    display: block;
    opacity: 1;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.view-back {
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.small-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
}

.primary-btn {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
    color: #1b1305;
}

.secondary-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.small-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Rings */
#ring-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

body.no-rings #ring-container {
    display: none;
}

.ring {
    position: absolute;
    border-radius: 50%;
    opacity: 0.35;
    filter: blur(8px);
    transition: transform 6s linear, width 6s linear, height 6s linear, opacity 1s linear;
}

/* Responsive tweak */
@media (max-width: 900px) {
    .window {
        width: calc(100% - var(--taskbar-width) - 20px);
        left: 10px;
    }

    .start-panel {
        right: var(--taskbar-width);
        width: calc(100% - var(--taskbar-width) - 20px);
    }
}

@media (max-width: 700px) {
    :root {
        --taskbar-width: 220px;
    }

    .window {
        top: 60px;
        left: 10px;
        max-width: calc(100% - var(--taskbar-width) - 20px);
    }

    .desktop {
        padding-right: calc(var(--taskbar-width) + 10px);
    }
}

@keyframes bg-zoom {
    0% { transform: scale(1.02); }
    100% { transform: scale(1.08); }
}
