:root {
    /* Light Theme (Default) */
    --bg-gradient-light: linear-gradient(180deg, #FAF3E0 0%, #FAF3E0 100%); /* Playful gradient: yellow, red-pink, teal, blue */
    --bg-color-light-fallback: #FAF3E0; /* Fallback solid color */
    --text-color-primary-light: #1A1A1A; /* Near Black for main text/letters */
    --text-color-secondary-light: #4A4A4A; /* Dark Gray for details */
    --text-color-tertiary-light: #303030; /* Medium Gray for corner text - 50% darker -> Darker for light mode */
    --grid-color-light: rgba(0, 0, 0, 0.04); /* Very faint black grid */
    --details-border-light: rgba(0, 0, 0, 0.1);
    --details-bg-light: rgba(250, 243, 224, 0.85); /* Slightly more opaque warm white */


    /* Dark Theme */
    --bg-color-dark: #1A1A1A; /* Near Black */
    --text-color-primary-dark: #FAF3E0; /* Warm Off-White for main text/letters */
    --text-color-secondary-dark: #D1CFC0; /* Lighter warm gray for details */
    --text-color-tertiary-dark: #B0AE9F; /* Medium warm gray for corner text - 50% darker -> Lighter for dark mode */
    --grid-color-dark: rgba(250, 243, 224, 0.05); /* Very faint warm white grid */
    --details-border-dark: rgba(250, 243, 224, 0.1);
    --details-bg-dark: rgba(30, 30, 30, 0.85); /* Slightly more opaque dark */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color-primary-light);
    transition: background 0.3s ease-in-out, color 0.3s ease-in-out; /* Changed background-color to background */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden; 
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%; 
    width: 100%;
    margin: 0;
    padding: 0;
    /* Light mode background: Grid on top of gradient */
    background-image:
        linear-gradient(var(--grid-color-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color-light) 1px, transparent 1px),
        var(--bg-gradient-light);
    background-size: 30px 30px, 30px 30px, cover;
    background-attachment: fixed; /* Apply fixed to all layers */
    background-color: var(--bg-color-light-fallback); /* Fallback if gradient isn't supported */
    animation: fadeIn 0.8s ease-out;
}

html.dark body {
    background-color: var(--bg-color-dark); /* Base dark color */
    color: var(--text-color-primary-dark);
    /* Dark mode background: Grid on top of solid color */
    background-image:
        linear-gradient(var(--grid-color-dark) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color-dark) 1px, transparent 1px);
    background-size: 30px 30px; /* Grid size */
    background-attachment: fixed; 
    /* Ensure no light mode gradient is lingering */
}

.homan-interface-wrapper {
    position: relative;
    width: 100%; /* Takes full width of body */
    height: 100%; /* Takes full height of body */
    display: flex;
    align-items: center;
    justify-content: center;
}

.homan-interface {
    display: flex;
    align-items: center; /* Changed from stretch to center for better control of letter block height */
    justify-content: center;
    gap: 1.5vw; /* Gap between letters */
    padding: 2rem;
    width: 100%;
    max-width: 1500px; 
    position: relative; /* For details panel positioning reference if needed */
}

.homan-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    flex-grow: 1; 
    min-width: 120px; 
    transition: opacity 0.4s ease;
    cursor: pointer;
    padding: 1rem 0; 
}

.letter-container {
    position: relative;
    display: inline-block; 
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.main-letter {
    font-family: 'Archivo Black', sans-serif; /* New font for letters */
    font-weight: 400; /* Adjust if needed, Archivo Black is inherently bold */
    font-size: clamp(4rem, 18vw, 16rem);
    line-height: 0.9;
    color: transparent; /* Initial: transparent fill */
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: var(--text-color-primary-light);
    transition: color 0.3s ease, -webkit-text-stroke-color 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
html.dark .main-letter {
    -webkit-text-stroke-color: var(--text-color-primary-dark);
}

/* Desktop hover/active state for letter fill - Desktop only */
@media (min-width: 769px) {
    .homan-item:hover .main-letter,
    .homan-item.active .main-letter {
        color: var(--text-color-primary-light); /* Fill color */
        -webkit-text-stroke-color: var(--text-color-primary-light); /* Stroke matches fill or transparent */
        /* Or use: -webkit-text-stroke-color: transparent; if you want no stroke on hover */
    }
    html.dark .homan-item:hover .main-letter,
    html.dark .homan-item.active .main-letter {
        color: var(--text-color-primary-dark);
        -webkit-text-stroke-color: var(--text-color-primary-dark);
    }
}

.details-panel {
    /* Removed position: fixed; left: 50%; transform: translateX(-50%); from general rule */
    /* Desktop: positioned naturally in flex flow, centered by homan-item's align-items: center */
    text-align: center;
    margin-top: 10px; /* Space below letter container */
    width: auto; 
    min-width: 220px;
    max-width: 320px;
    padding: 0.85rem 1.25rem;
    background-color: var(--details-bg-light);
    border: 1px solid var(--details-border-light);
    border-radius: 4px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    color: var(--text-color-secondary-light);
    z-index: 20; 

    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scaleY(0.9); /* Start slightly up and scaled, will animate down */
    transform-origin: top center;
    transition: opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 0.3s;
}
html.dark .details-panel {
    background-color: var(--details-bg-dark);
    border-color: var(--details-border-dark);
    color: var(--text-color-secondary-dark);
}

/* Desktop: Show details panel on hover/active of .homan-item - Desktop only */
@media (min-width: 769px) {
    .homan-item:hover .details-panel,
    .homan-item.active .details-panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scaleY(1); /* Animate to natural position and full scale */
        transition-delay: 0s; /* Apply active state transition immediately */
        pointer-events: auto; /* Allow interaction */
    }
}


.full-word {
    display: block;
    font-weight: 700;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    color: var(--text-color-primary-light); 
    margin-bottom: 0.2rem;
    letter-spacing: 0.02em;
}
html.dark .full-word {
    color: var(--text-color-primary-dark);
}

.description {
    display: block;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.6vw, 0.9rem);
}

/* Hover/Active states - Desktop only */
@media (min-width: 769px) {
    .homan-interface-wrapper:hover .homan-item:not(.active):not(:hover) {
        opacity: 0.5; 
    }

    .homan-item:hover .letter-container,
    .homan-item.active .letter-container {
        transform: scale(1.03); 
    }
}
/* Removed .letter-container::before hover styles as it's removed */


/* .homan-item:hover .details-panel, NO LONGER CSS DRIVEN FOR VISIBILITY
.homan-item.active .details-panel {
        opacity: 1;
    visibility: visible;
} */

/* Corner/Edge Typography */
.corner-info {
    font-family: 'Roboto Mono', monospace;
    font-size: clamp(0.6rem, 1vw, 0.7rem);
    color: var(--text-color-tertiary-light);
    position: fixed;
    opacity: 0.7;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 10;
}
html.dark .corner-info {
    color: var(--text-color-tertiary-dark);
}

.top-left { top: 1.5rem; left: 1.5rem; }
.top-right { top: 1.5rem; right: 1.5rem; text-align: right;}
.bottom-left { bottom: 1.5rem; left: 1.5rem; }
.bottom-right { bottom: 1.5rem; right: 1.5rem; text-align: right;}

.corner-info hr {
    border: none;
    height: 0.5px;
    background-color: var(--text-color-tertiary-light);
    opacity: 0.5;
    margin: 0.3rem 0;
}
html.dark .corner-info hr {
    background-color: var(--text-color-tertiary-dark);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    html, body {
        height: 100vh; /* Ensure full viewport height */
        overflow: hidden; /* Prevent scrolling */
    }

    /* Added to override desktop grid for mobile */
    body {
        background-image:
            linear-gradient(var(--grid-color-light) 1.5px, transparent 1.5px), /* Thicker grid */
            linear-gradient(90deg, var(--grid-color-light) 1.5px, transparent 1.5px), /* Thicker grid */
            var(--bg-gradient-light);
        background-size: 30px 30px, 30px 30px, cover;
    }

    html.dark body {
        background-image:
            linear-gradient(var(--grid-color-dark) 1.5px, transparent 1.5px), /* Thicker grid */
            linear-gradient(90deg, var(--grid-color-dark) 1.5px, transparent 1.5px); /* Thicker grid */
        background-size: 30px 30px;
    }    .homan-interface-wrapper {
        display: flex; 
        align-items: center;
        justify-content: center; 
        height: 100vh; /* Use viewport height explicitly */
        width: 100vw; /* Use viewport width explicitly */
        padding: 1rem;
        box-sizing: border-box;
        overflow: hidden; /* Prevent any overflow */
    }    .homan-interface {
        display: flex; 
        align-items: center;
        justify-content: center;
        gap: clamp(2.2px, 1.1vw, 1.65rem); /* Increased by 10%: 2px->2.2px, 1vw->1.1vw, 1.5rem->1.65rem */
        padding: clamp(0.55rem, 2.2vw, 1.1rem); /* Increased by 10%: 0.5rem->0.55rem, 2vw->2.2vw, 1rem->1.1rem */
        margin-top: -8vh;
        width: 100%; 
        height: 100%;
        max-width: 100vw;
        box-sizing: border-box; 
    }    .homan-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center; 
        flex: 1 1 0;
        min-width: 0;
        max-width: calc((100% - 8.8px) / 5); /* Updated for new gap calculation: 8px->8.8px (10% increase) */
        height: 100%;
        transition: opacity 0.4s ease;
        cursor: default;
        padding: 0;
        overflow: visible;
        pointer-events: none;
    }/* Show letter containers on mobile with mobile-specific sizing */
    .homan-item .letter-container {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: auto;
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        cursor: pointer;
        pointer-events: auto;
    }    /* Unified mobile letter sizing for all mobile viewports */
    .homan-item .main-letter {
        font-size: clamp(3.4rem, min(18vw, 22vh), 22rem); /* Decreased by 20%: 4.5rem->3.6rem, 25vw->20vw, 30vh->24vh, 30rem->24rem */
        line-height: 0.9;
        width: 100%;
        text-align: center;
        max-width: 100%;
        overflow: hidden;
        -webkit-text-stroke-width: 1.5px;
    }/* Mobile: Only keep active states for letter fill, no hover effects */
    .homan-item.active .main-letter {
        color: var(--text-color-primary-light); /* Fill color on active */
        -webkit-text-stroke-color: var(--text-color-primary-light);
    }
    html.dark .homan-item.active .main-letter {
        color: var(--text-color-primary-dark);
        -webkit-text-stroke-color: var(--text-color-primary-dark);
    }

    /* Mobile: Only keep active states for letter scaling, no hover effects */
    .homan-item.active .letter-container {
        transform: scale(1.03);
    }.details-panel {
        /* Hide the original details panel on mobile */
        display: none;
    }    /* New mobile-specific details panel */
    .mobile-details-panel {
        position: fixed;
        bottom: 25%;
        left: 50%;
        transform: translateX(-50%);
        width: 85vw;
        max-width: 400px;
        padding: 1.5rem 2rem;
        background-color: var(--details-bg-light);
        border: 2px solid var(--details-border-light);
        border-radius: 8px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        color: var(--text-color-secondary-light);
        z-index: 100;
        text-align: center;
        cursor: pointer;
        
        /* Enhanced visual feedback for tappability */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        transition: opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                    visibility 0s 0.3s, box-shadow 0.2s ease, border-color 0.2s ease;
        
        opacity: 0;
        visibility: hidden;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }

    html.dark .mobile-details-panel {
        background-color: var(--details-bg-dark);
        border-color: var(--details-border-dark);
        color: var(--text-color-secondary-dark);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    /* Show mobile details panel when item is active */
    .mobile-details-panel.visible {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0) scale(1);
        transition-delay: 0s;
    }

    /* Active/tap state for mobile details panel */
    .mobile-details-panel:active {
        transform: translateX(-50%) translateY(0) scale(0.98);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        border-color: var(--text-color-primary-light);
    }

    html.dark .mobile-details-panel:active {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
        border-color: var(--text-color-primary-dark);
    }

    .mobile-details-panel .full-word {
        display: block;
        font-weight: 700;
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        color: var(--text-color-primary-light);
        margin-bottom: 0.5rem;
        letter-spacing: 0.02em;
        line-height: 1.2;
    }

    html.dark .mobile-details-panel .full-word {
        color: var(--text-color-primary-dark);
    }    .mobile-details-panel .description {
        display: block;
        font-weight: 400;
        font-size: clamp(0.9rem, 3vw, 1.1rem);
        line-height: 1.3;
        opacity: 0.9;
        margin-bottom: 0.8rem; /* Add space for tap indicator */
    }

    /* Add tap indicator */
    .mobile-details-panel::after {
        content: "TAP HERE";
        display: block;
        font-size: clamp(0.7rem, 2.5vw, 0.85rem);
        font-weight: 500;
        color: var(--text-color-primary-light);
        opacity: 0.6;
        margin-top: 0.5rem;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    html.dark .mobile-details-panel::after {
        color: var(--text-color-primary-dark);
    }.full-word {
        display: block;
        font-weight: 700;
        font-size: clamp(0.8rem, 3vw, 1.2rem); /* Mobile-optimized sizing */
        color: var(--text-color-primary-light); 
        margin-bottom: 0.15rem; /* Slightly reduced margin */
        letter-spacing: 0.02em;
        line-height: 1.1; /* Tighter line height for mobile */
    }

    .description {
        display: block;
        font-weight: 400;
        font-size: clamp(0.6rem, 2.5vw, 0.8rem); /* Mobile-optimized sizing */
        line-height: 1.2;
        opacity: 0.9; /* Slightly more transparent on mobile */
    }/* Corner Info display and styling for mobile - FIXED POSITIONING */
    .corner-info {
        display: block; 
        position: fixed; /* Fixed positioning */
        width: auto; /* Fit content */
        padding: 0.8rem; 
        font-size: clamp(0.8rem, 2.8vw, 1rem); /* Scaled up from 0.55rem-0.65rem to 0.8rem-1rem */
        opacity: 0.9; /* Increased opacity from 0.85 to 0.9 */
        z-index: 100; /* Ensure it's above other content */
        letter-spacing: 0.05em; /* Increased letter spacing */
        line-height: 1.2; /* Added line height for better readability */
    }    .corner-info.top-left { top: 0.8rem; left: 0.8rem; text-align: left; }
    .corner-info.top-right { top: 0.8rem; right: 0.8rem; text-align: right; }
    .corner-info.bottom-left { bottom: 0.8rem; left: 0.8rem; text-align: left; }
    .corner-info.bottom-right { bottom: 0.8rem; right: 0.8rem; text-align: right; }
      .corner-info hr {
        margin: 0.2rem 0; /* Increased from 0.1rem */
        width: 100%;
        opacity: 0.5; /* Increased from 0.4 */
    }
    .top-right hr, .bottom-right hr { margin-left: auto; } /* Align hr right if text is right */    #themeToggle {
        padding: 0.4rem; /* Increased from 0.2rem */
        display: inline-block; 
        font-size: 1rem; /* Added explicit font size */
    }    /* Mobile tap animation for letter containers */
    .homan-item.tapped-effect .letter-container {
        animation: mobileTapPulse 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
}

/* Keyframe animation for mobile tap effect */
@keyframes mobileTapPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Tooltip Styles */
.tooltip-container {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    animation: tooltipPulse 3s ease-in-out infinite;
}

.tooltip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-color-secondary-light);
    pointer-events: none;
    user-select: none;
}

.tooltip span {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    background: var(--details-bg-light);
    border: 1px solid var(--details-border-light);
    border-radius: 20px;
    padding: 8px 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark theme tooltip styles */
html.dark .tooltip {
    color: var(--text-color-secondary-dark);
}

html.dark .tooltip span {
    background: var(--details-bg-dark);
    border-color: var(--details-border-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html.dark .tooltip-arrow {
    background: var(--text-color-secondary-dark);
}

html.dark .tooltip-arrow::after {
    border-top-color: var(--text-color-secondary-dark);
}

/* Tooltip animation
@keyframes tooltipPulse {
    0%, 100% { 
        opacity: 0.8;
        transform: translateX(-50%) translateY(0px);
    }
    50% { 
        opacity: 1;
        transform: translateX(-50%) translateY(-3px);
    }
} */

/* Responsive adjustments */
@media (max-width: 768px) {
    .tooltip-container {
        top: 18%;
    }
    
    .tooltip span {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .tooltip-arrow {
        height: 50px;
    }
}

/* Tooltip pulse effect: pulses for 3 seconds when .pulse is added */
#tooltip-text { position: relative; }

#tooltip-text.pulse::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 220%;
  height: 220%;
  border-radius: 12px;
  background: currentColor;
  opacity: 0.18;
  pointer-events: none;
  z-index: -1;
  animation: pulse-ring 1s ease-out 0s 3;
}

#tooltip-text.pulse::after {
  /* subtle pulse that covers the tooltip arrow area as well */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%) scale(1);
  width: 20px;
  height: 10px;
  opacity: 0.18;
  pointer-events: none;
  z-index: -1;
  animation: pulse-ring 1s ease-out 0s 3;
}

@keyframes pulse-ring {
  from { transform: translate(-50%, -50%) scale(0.6); opacity: 0.6; }
  to   { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}