* {
    font-family: "Unna", serif;
}

body {
    background-color: #f7f5f2;
    /* Off-white background */
    color: #333;
    font-family: "Unna", serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Prevent horizontal scroll from bouncing icons */
}

.center-text {
    text-align: center;
}

.flex-container {
    display: flex;
    justify-content: center;
    /* Centers horizontally */
    align-items: center;
    /* Centers vertically */
    align-items: center;
    /* Centers vertically */
    height: 100vh;
    /* Or any height */
}

#changing-text {
    font-size: 2rem;
    /* Make the changing text larger */
}

/* Icons */
.floating-icon {
    position: absolute;
    width: 60px;
    /* Adjust size as needed */
    height: 60px;
    opacity: 0.8;
    pointer-events: auto;
    /* Ensure clickable */
    /* Remove default border/outline from links if any */
    border: none;
    outline: none;
}

.floating-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.floating-icon:hover {
    transform: scale(1.1);
    opacity: 1;
    cursor: pointer;
}

/* Tooltip Styles */
.tooltip-text {
    visibility: hidden;
    width: 100px;
    background-color: rgba(50, 50, 50, 0.9);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;

    /* Position the tooltip */
    position: absolute;
    top: 100%;
    /* Below the icon */
    left: 50%;
    margin-left: -50px;
    /* Center it */
    margin-top: 10px;

    /* Fade in */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    pointer-events: none;
    /* Don't interfere with hover */
    z-index: 10;
}

.floating-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

#changing-text {
    font-size: 2rem;
    /* Make the changing text larger */
}

/* --- Avatar Page Styles --- */

.avatar-page {
    padding: 100px 50px;
    /* Spacing from edges */
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    /* Keep folders inside */
}

.content-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 80px;
    align-items: flex-start;
    position: relative;
    z-index: 2;
    /* Above folders */
}

.text-column {
    flex: 1;
    max-width: 600px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #4a4a4a;
}

.profile-column {
    flex: 0 0 300px;
    /* Fixed width for profile sidebar */
    text-align: left;
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 20px;
    /* Rounded corners like reference */
    object-fit: cover;
    margin-bottom: 20px;
}

.profile-column h2 {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    color: #333;
}

.description {
    font-size: 1.4rem;
    color: #999;
    /* Light grey for description */
    margin: 0;
}

.description+.description {
    margin-top: 24px;
    /* Gap between multiple description paragraphs */
}

.back-link {
    display: inline-block;
    /* margin-top removed */
    text-decoration: none;
    color: #333;
    font-size: 1rem;
    position: fixed;
    /* Fixed relative to viewport */
    bottom: 40px;
    left: 40px;
    z-index: 100;
    /* Ensure on top */
}

.back-link:hover {
    text-decoration: underline;
}

/* Static Folders */
.folders-container {
    margin-top: 60px;
    display: flex;
    gap: 40px;
    /* Space between folders */
    align-items: flex-start;
    /* Align to top so text doesn't mess up icon alignment */
}

.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.8;
    width: 80px;
    /* Fixed width for text wrapping consistency */
    text-decoration: none;
    /* Ensure no underline for links */
}

.folder-icon {
    width: 60px;
    height: auto;
    /* Removed opacity/transition from here as it moved to parent */
}

.folder-name {
    font-size: 0.9rem;
    color: #4a4a4a;
    text-align: center;
    font-weight: 500;
}

.folder-item:hover {
    transform: scale(1.05);
    opacity: 1;
    cursor: pointer;
}

.unna-regular {
    font-family: "Unna", serif;
    font-weight: 400;
    font-style: normal;
}

.unna-bold {
    font-family: "Unna", serif;
    font-weight: 700;
    font-style: normal;
}

.unna-regular-italic {
    font-family: "Unna", serif;
    font-weight: 400;
    font-style: italic;
}

.unna-bold-italic {
    font-family: "Unna", serif;
    font-weight: 700;
    font-style: italic;
}

/* --- PDF Page Styles --- */

.pdf-page {
    padding: 80px 20px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.pdf-description {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #4a4a4a;
    max-width: 700px;
    margin: 0 auto 60px auto;
}

.pdf-viewer {
    width: 100%;
    height: 600px;
    background-color: #e5e5e5;
    /* Placeholder grey */
    margin-bottom: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pdf-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn {
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: "Unna", serif;
}

.btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.btn-dark {
    background-color: #333;
    color: #fff;
}

.btn-grey {
    background-color: #888;
    color: #fff;
}

/* --- Responsive Design --- */

@media (max-width: 768px) {

    /* General */
    #changing-text {
        font-size: 1.5rem;
        /* Smaller text on mobile */
        padding: 0 10px;
    }

    /* Avatar Page */
    .avatar-page {
        padding: 30px 20px;
    }

    .content-wrapper {
        flex-direction: column-reverse;
        /* Stack: Profile top, Content bottom */
        gap: 30px;
    }

    /* Mobile Header Layout: Title/Desc (Left) | Avatar (Right) */
    .profile-column {
        flex: 0 0 auto;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        margin-bottom: 0;
    }

    .profile-text {
        flex: 1;
        padding-right: 20px;
    }

    .profile-img {
        width: 100px;
        height: 100px;
        margin-bottom: 0;
        order: 2;
        /* Ensure image is on right */
    }

    .profile-column h2 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .description {
        font-size: 1rem;
    }

    .text-column {
        width: 100%;
    }

    .folders-container {
        justify-content: space-around;
        /* Distribute evenly */
        margin-top: 30px;
        gap: 10px;
    }

    .folder-icon {
        width: 50px;
    }

    .back-link {
        position: static;
        display: block;
        margin-top: 40px;
        text-align: left;
        /* Image 1 shows it left alignedish? or just standard */
    }

    /* PDF Page */
    .pdf-page {
        padding: 40px 20px;
    }

    .pdf-viewer {
        height: 350px;
        margin-bottom: 40px;
    }

    .pdf-actions {
        flex-direction: row;
        /* Keep side-by-side if possible */
        gap: 10px;
    }

    .btn {
        width: auto;
        flex: 1;
        padding: 12px 10px;
        /* Tighter padding */
        font-size: 0.9rem;
    }
}

/* --- Experience Page Styles (xp.html) --- */

.xp-page {
    padding: 100px 50px;
    max-width: 800px;
    margin: 0 auto;
}

/* Sticky Nav Square */
.nav-square {
    position: fixed;
    top: 54px;
    /* Align with theme toggle (54px) and visual center of T */
    left: 40px;
    width: 12px;
    height: 12px;
    border: 1.5px solid #333;
    /* Slightly thinner border for smaller size */
    border-radius: 1px;
    /* Slight rounding */
    cursor: pointer;
    z-index: 100;
    transition: background-color 0.2s;
}

.nav-square:hover {
    background-color: #333;
}

.xp-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 60px;
    color: #333;
}

/* List Items */
.xp-item {
    margin-bottom: 30px;
}

.xp-header {
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px 0;
    user-select: none;
}

.xp-header:hover {
    opacity: 0.7;
}

/* Arrow */
.xp-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    display: inline-block;
    width: 15px;
    /* Fixed width for alignment */
}

.xp-arrow.open {
    transform: none;
    /* No rotation for +/- */
}

.xp-date {
    font-family: "Unna", serif;
    min-width: 80px;
    /* Helper alignment */
}

.xp-role-title {
    text-decoration: none;
    /* Remove default underline */
    font-weight: 500;
    color: inherit;
    position: relative;
    display: inline-block;
    /* Required for width calculation */
}

.xp-role-title::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    /* Thickness of the underline */
    bottom: 0;
    left: 0;
    background-color: currentColor;
    /* Matches text color (dark or light) */
    transition: width 0.3s ease-in-out;
}

.xp-role-title:hover::after {
    width: 100%;
}

/* Details Accordion */
.xp-details {
    list-style-type: none;
    /* remove default bullets? Ref shows bullets, likely default UL */
    margin: 0;
    padding-left: 140px;
    /* Align with text, skipping arrow + date width visually */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.xp-details li {
    margin-bottom: 8px;
    color: #555;
    position: relative;
    padding-left: 10px;
}

/* Custom bullet styling if needed, or stick to default. 
   Ref shows small bullets. Let's use default but indented properly. */
.xp-details {
    list-style-type: disc;
}

.xp-details.open {
    max-height: 500px;
    /* Arbitrary large enough height */
    opacity: 1;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Mobile responsive for XP page */
@media (max-width: 768px) {
    .nav-square {
        top: 20px;
        left: 20px;
    }

    .xp-page {
        padding: 80px 20px;
    }

    .xp-details {
        padding-left: 40px;
        /* Less indent on mobile */
    }

    .xp-header {
        gap: 15px;
    }
}


/* --- Case Toggle Styles --- */

.lowercase-mode {
    text-transform: lowercase !important;
}

/* Ensure icons/images don't get messed up if they have text inside, though text-transform usually safe */

#case-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    background-color: transparent;
    color: #333;
    border: 1px solid #333;
    border-radius: 4px;
    /* Slight rounding */
    cursor: pointer;
    font-family: "Unna", serif;
    z-index: 1000;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.5);
    /* Semi-transparent bg for readability */
}

#case-toggle-btn:hover {
    background-color: #333;
    color: #fff;
}

.case-btn-top {
    top: 40px !important;
    bottom: auto !important;
    right: 40px !important;
    background-color: transparent !important;
    border: none !important;
    font-size: 1.2rem !important;
    /* Slight size adjustment */
}

/* Hover state for the text-only button */
.case-btn-top:hover {
    background-color: transparent !important;
    color: #000 !important;
    /* Ensure it stays dark or goes darker? */
    opacity: 0.6;
}

/* --- Dark Mode Styles --- */

body.dark-mode {
    background-color: #1a1a1a;
    color: #f0f0f0;
}

body.dark-mode a {
    color: #dcdcdc;
    /* Lighter links */
}

body.dark-mode .nav-square {
    border-color: #f0f0f0;
}

body.dark-mode .nav-square:hover {
    background-color: #f0f0f0;
}

body.dark-mode .xp-title,
body.dark-mode .xp-role-title,
body.dark-mode .folder-name,
body.dark-mode .description,
body.dark-mode .pdf-description,
body.dark-mode .profile-column h2,
body.dark-mode .text-column {
    color: #f0f0f0;
}

body.dark-mode .xp-details li {
    color: #ccc;
}

/* Invert icons in dark mode so they are visible */
body.dark-mode .floating-icon img,
body.dark-mode #audio-toggle-btn img {
    filter: invert(1);
}

/* Exclude Avatar/Profile image from inversion if it's a photo */
body.dark-mode #icon-avatar,
body.dark-mode .profile-img {
    filter: none;
}

/* --- Theme Toggle Button --- */

#theme-toggle-btn {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.3s ease;

    /* Default (Light Mode) -> Button is Dark */
    background-color: #333;

    /* Positioning for Index (Bottom Right, next to Aa) */
    bottom: 30px;
    /* Aligned roughly with text center of Aa */
    right: 80px;
    /* Adjusted gap */
}

/* Top positioning for other pages */
.theme-btn-top {
    top: 54px !important;
    /* Visual center alignment with T - pushed down to match text baseline */
    bottom: auto !important;
    right: 90px !important;
    /* Maintain the gap requested previously */
}

/* Dark Mode State -> Button becomes Light */
body.dark-mode #case-toggle-btn {
    color: #f0f0f0;
    border-color: #f0f0f0;
}

/* Specific override for the top transparent button if needed, but color inherit should work */
body.dark-mode .case-btn-top {
    color: #f0f0f0 !important;
}

/* Dark Mode State -> Button becomes Light */
body.dark-mode #theme-toggle-btn {
    background-color: #f0f0f0;
}

/* Hover effects */
#theme-toggle-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* --- Custom Cursor --- */

body,
a,
button,
.floating-icon,
.nav-square,
.xp-header,
.folder-item,
.xp-role-title,
.mac-window,
.mac-titlebar,
.mac-light,
.mac-btn,
.mac-item,
.textedit-window,
textarea {
    cursor: none !important;
}

#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #333;
    /* Default Light Mode Color */
    transform: translate(-50%, -50%);
    /* Center cursor */
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 9999;
    transition: background-color 0.3s ease, transform 0.1s ease-out, width 0.2s, height 0.2s, border-radius 0.2s;
}

#custom-cursor.text-cursor {
    width: 2px;
    height: 20px;
    border-radius: 0;
}

/* Dark Mode Cursor */
/* --- Fixed Header (Sub-pages) --- */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background-color: #f7f5f2;
    /* Match body bg */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-sizing: border-box;
    z-index: 900;
    /* Behind custom cursor (9999) but above content */
    transition: background-color 0.3s ease;
}

body.dark-mode .fixed-header {
    background-color: #1a1a1a;
}

/* Header Controls Container */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Adjust sticky nav square for header */
.nav-square {
    position: static;
    /* Remove fixed */
    /* Dimensions maintained from previous rule */
}

/* Adjust toggle buttons for header usage */
.header-btn {
    position: static !important;
    /* Override fixed */
    background-color: transparent;
    border: 1px solid #333;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-btn:hover {
    background-color: #333;
    color: #fff;
}

/* Dark mode adjustments for header buttons */
body.dark-mode .header-btn {
    border-color: #f0f0f0;
    color: #f0f0f0;
}

body.dark-mode .header-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Specific styling for the circle theme toggle in header if needed, 
   or just use generic .header-btn style if we change HTML. 
   Let's keep the circle look for consistency if possible, or adapt. */
#theme-toggle-btn.header-ver {
    position: static;
    margin: 0;
}

#audio-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

#audio-toggle-btn img {
    width: 14px;
    /* Match text size roughly */
    height: 14px;
    display: block;
}


/* --- Page Padding Adjustments --- */
.xp-page,
.avatar-page,
.pdf-page,
.projects-page {
    padding-top: 120px !important;
    /* Push content down below header */
}

/* --- Responsive Header --- */
@media (max-width: 768px) {
    .fixed-header {
        height: 60px;
        padding: 0 20px;
    }

    .xp-page,
    .avatar-page,
    .pdf-page,
    .projects-page {
        padding-top: 100px !important;
    }
}

/* --- Projects Page Styles --- */

.projects-page {
    padding: 100px 50px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.projects-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: #333;
    position: absolute;
    top: 100px;
    /* Aligned with XP title */
    left: 50px;
}

.projects-carousel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-top: 60px;
    /* Space for title */
    gap: 40px;
}

.project-content-area {
    flex: 1;
    max-width: 1000px;
    text-align: center;
}

.project-headline {
    font-size: 1.5rem;
    color: #4a4a4a;
    margin-bottom: 40px;
    font-weight: 500;
}

.project-details {
    display: flex;
    align-items: center;
    /* Center vertically */
    gap: 60px;
    text-align: left;
}

.project-image-container {
    flex: 1;
    aspect-ratio: 16 / 9;
    /* Standard video/image ratio */
    background-color: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    /* Centering placeholder content if any */
    align-items: center;
    justify-content: center;
}

.img-placeholder {
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    position: relative;
}

/* Pseudo element for the placeholder icon loop look */
.img-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 4px solid #ccc;
    border-radius: 8px;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-info {
    flex: 1;
    color: #4a4a4a;
}

#project-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 40px;
}

.project-buttons {
    display: flex;
    gap: 20px;
}

/* Nav Arrows */
.nav-arrow {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #333;
    padding: 10px;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: "Unna", serif;
}

.nav-arrow:hover {
    transform: scale(1.2);
}

.nav-arrow:active {
    transform: scale(0.9);
}

/* Indicators - Vertical Lines */
.project-indicators {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
    height: 60px;
    /* Accommodate taller active line */
    align-items: flex-end;
    /* Align to bottom so they grow up? Or center? User said "lines bellow", typically center or bottom aligned. Center is safest. */
    align-items: center;
}

.indicator-line {
    display: block;
    width: 2px;
    /* Thin vertical line */
    height: 20px;
    /* Short inactive height */
    background-color: #ccc;
    border-radius: 2px;
    transition: height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.4s;
}

.indicator-line.active {
    background-color: #333;
    height: 60px;
    /* Long active height */
    width: 2px;
}

/* Slide Animations */
.slide-out-left {
    animation: slideOutLeft 0.4s forwards cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

.slide-in-right {
    animation: slideInRight 0.4s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-out-right {
    animation: slideOutRight 0.4s forwards cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

.slide-in-left {
    animation: slideInLeft 0.4s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-50px);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(50px);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dark Mode Overrides for Projects */
body.dark-mode .projects-title,
body.dark-mode .project-headline,
body.dark-mode .project-info,
body.dark-mode .nav-arrow {
    color: #f0f0f0;
}

/* Dark Mode Overrides for Indicators */
body.dark-mode .indicator-line {
    background-color: #555;
}

body.dark-mode .indicator-line.active {
    background-color: #f0f0f0;
}

/* Image Placeholder - Landscape Icon */
.img-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 40px;
    /* Rectangular landscape */
    border: 3px solid #b0b0b0;
    border-radius: 4px;
    /* Drawing the 'mountain' and 'sun' with gradients or box-shadow is complex, keeping it abstract but polished */
    /* Using a simple geometric shape to represent an image */
    background:
        linear-gradient(to top right, #b0b0b0 50%, transparent 51%) no-repeat bottom left / 20px 20px,
        linear-gradient(to top right, #b0b0b0 50%, transparent 51%) no-repeat bottom center / 30px 30px;
    background-size: 20px 15px, 25px 25px;
    background-position: 5px 22px, 20px 12px;
}

/* Refined circle sun */
.img-placeholder::before {
    content: '';
    position: absolute;
    top: calc(50% - 15px);
    left: calc(50% + 15px);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #b0b0b0;
    z-index: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .projects-title {
        position: static;
        margin-bottom: 20px;
        text-align: center;
    }

    .project-details {
        flex-direction: column;
        gap: 30px;
    }

    .projects-carousel {
        position: relative;
    }

    .nav-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        background-color: rgba(255, 255, 255, 0.5);
        /* Background for visibility over image */
        border-radius: 50%;
    }

    .nav-arrow.left {
        left: 0;
    }

    .nav-arrow.right {
        right: 0;
    }
}

/* Dark Mode Cursor Override (Restored) */
body.dark-mode #custom-cursor {
    background-color: #f0f0f0;
}

/* --- macOS Window Styles --- */
.mac-window {
    position: fixed;
    /* Allow dragging over fixed headers if needed, or absolute relative to page */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Initial center */
    width: 600px;
    height: 400px;
    background-color: rgba(255, 255, 255, 0.85);
    /* Light Mode Glass */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    /* Above everything */
    overflow: hidden;
    transition: transform 0.1s ease-out, opacity 0.2s ease;
}

body.dark-mode .mac-window {
    background-color: rgba(40, 40, 40, 0.85);
    /* Dark Mode Glass */
    border-color: rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
}

.mac-titlebar {
    height: 38px;
    /* Standard Big Sur height roughly */
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: transparent;
    /* Seamless */
    cursor: default;
    user-select: none;
}

.mac-traffic-lights {
    display: flex;
    gap: 8px;
}

.mac-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.mac-close {
    background-color: #ff5f57;
    border: 1px solid #e0443e;
}

.mac-minimize {
    background-color: #febc2e;
    border: 1px solid #dba526;
}

.mac-maximize {
    background-color: #28c840;
    border: 1px solid #1aab29;
}

/* Show symbols on hover */
.mac-traffic-lights:hover .mac-close::after {
    content: 'x';
    color: #4a0002;
    font-size: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    opacity: 0.5;
}

.mac-traffic-lights:hover .mac-minimize::after {
    content: '-';
    color: #5c3b00;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    opacity: 0.5;
}

.mac-traffic-lights:hover .mac-maximize::after {
    content: '+';
    color: #004d0f;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    opacity: 0.5;
}

.mac-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: inherit;
    font-size: 0.95rem;
    opacity: 0.8;
    margin-right: 12px;
    /* Balance the left spacing of lights (1 button = ~12px) */
}

.mac-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 20px 20px 20px;
    overflow-y: auto;
}

.mac-toolbar {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

.mac-btn {
    background: rgba(128, 128, 128, 0.1);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: inherit;
    transition: background 0.2s;
}

.mac-btn:hover {
    background: rgba(128, 128, 128, 0.2);
}

.mac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 20px;
}

.mac-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 4px;
    padding: 5px;
    transition: background-color 0.2s;
}

.mac-item:hover {
    background-color: rgba(128, 128, 128, 0.1);
    /* Selection highlight */
}

.mac-item img {
    width: 48px;
    height: auto;
}

.mac-item span {
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

/* Mobile responsive adjustments */
@media (max-width: 650px) {
    .mac-window {
        width: 90%;
        height: 60%;
    }
}

/* --- TextEdit Window Specifics --- */
.textedit-window {
    width: 600px;
    /* Match system window or custom */
    height: 400px;
    background-color: #ffffff !important;
    /* Force white like TextEdit */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #333 !important;
}

body.dark-mode .textedit-window {
    background-color: #1e1e1e !important;
    /* Dark text editor */
    color: #f0f0f0 !important;
    border-color: #555;
}

.textedit-window .mac-content {
    padding: 0;
    /* Remove default padding for full-bleed editor */
    display: flex;
    flex-direction: column;
}

#textedit-area {
    flex: 1;
    /* Fill remaining height */
    width: 100%;
    border: none;
    resize: none;
    outline: none;
    padding: 15px;
    /* Internal text padding */
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: transparent;
    /* Use window background */
    color: inherit;
    /* Use window text color */
    box-sizing: border-box;
    display: block;
}

/* --- Image Viewer Window Specifics --- */
.image-viewer-window {
    width: 500px;
    height: 500px;
    background-color: #f0f0f0;
}

body.dark-mode .image-viewer-window {
    background-color: #222;
}

.image-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background-color: transparent;
    overflow: hidden;
}

#image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
    /* Prevent dragging image itself */
}