* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    background-color: #3b4252;
}

body {
    width: 100%;
    min-height: 100vh;
    background-color: #3b4252; /* Heavy Storm Grey Background */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html.game-active,
body.game-active {
    height: 100vh;
    overflow: hidden;
    scroll-behavior: auto;
}

#background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1;
    pointer-events: none;
    transition: opacity 1s ease-out;
    contain: layout paint;
    will-change: opacity;
}

#background-layer.hidden {
    opacity: 0;
}

#rain-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#app {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 2;
    background: transparent;
    contain: layout paint;
}

#top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

.control-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.2s, transform 0.15s ease-out;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    padding: 4px;
}

.control-btn.hidden {
    display: none !important;
}

.control-btn:hover {
    color: rgba(255, 255, 255, 0.95);
}

.control-btn.is-holding,
.control-btn:active {
    transform: scale(0.95);
}

.control-btn:hover .mute-btn-label {
    color: rgba(255, 255, 255, 0.95);
}

.mute-icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hold-progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.hold-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 2.5;
}

.hold-progress-ring .ring-progress {
    fill: none;
    stroke: #FF9500;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    stroke-dashoffset: 113.1;
    transition: stroke-dashoffset 0.15s ease-out;
}

#mute-btn.is-holding .hold-progress-ring .ring-progress {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1000ms linear;
}

#exit-fullscreen-btn.is-holding .hold-progress-ring .ring-progress {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2000ms linear;
}

.mute-icon-wrapper .speaker-icon,
.mute-icon-wrapper .exit-fullscreen-icon,
.mute-icon-wrapper .settings-icon {
    width: 24px;
    height: 24px;
    pointer-events: none;
    transition: transform 0.25s ease-out;
}

#settings-btn:hover .settings-icon {
    transform: rotate(35deg);
}

.mute-btn-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.65);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: color 0.2s;
}

.control-btn:hover .mute-btn-label {
    color: rgba(255, 255, 255, 0.95);
}

.mute-slash.hidden {
    display: none;
}

#init-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease-out;
}

#init-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#start-btn {
    padding: clamp(16px, 2.6vh, 22px) clamp(30px, 4vw, 46px);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: #fff;
    background: linear-gradient(145deg, #FFA31A 0%, #FF8500 100%);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 
        0 10px 28px rgba(255, 149, 0, 0.35),
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.55);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

/* Wet glossy specular sheen across top curve */
#start-btn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 12px;
    right: 12px;
    height: 42%;
    border-radius: 22px 22px 60% 60% / 18px 18px 25% 25%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.06) 65%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

#start-btn:hover {
    transform: scale(1.04);
    box-shadow: 
        0 14px 34px rgba(255, 149, 0, 0.45),
        0 6px 14px rgba(0, 0, 0, 0.35),
        inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

#start-btn:active {
    transform: scale(0.98);
}

.btn-text {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Container for physical water beads on button surface */
#button-beads-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    border-radius: 24px;
}

/* Semi-transparent refractive water beads with 3D specular highlight and shadow */
.water-bead {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.55) 20%, 
        rgba(255, 255, 255, 0.08) 55%, 
        rgba(0, 0, 0, 0.12) 100%);
    box-shadow: 
        inset -1px -1px 2px rgba(0, 0, 0, 0.3),
        inset 1px 1px 2px rgba(255, 255, 255, 0.85),
        0 2px 5px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(var(--bead-scale, 1));
    transition: opacity 1.2s ease-out, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform, opacity;
}

/* Gentle pulse when a bead absorbs an incoming droplet */
.water-bead.merging {
    transform: translate(-50%, -50%) scale(calc(var(--bead-scale, 1) * 1.26));
}

/* Pendant corner drip detaching from the button */
.corner-drip {
    position: absolute;
    width: 10px;
    height: 15px;
    background: radial-gradient(circle at 35% 30%, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(210, 235, 255, 0.4) 30%, 
        rgba(180, 215, 245, 0.08) 65%, 
        rgba(0, 0, 0, 0.1) 100%);
    box-shadow: 
        inset -1px -1px 2px rgba(0, 0, 0, 0.2),
        inset 1px 1px 2px rgba(255, 255, 255, 0.8),
        0 2px 5px rgba(0, 0, 0, 0.15);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    pointer-events: none;
    z-index: 105;
    transform: translate(-50%, 0);
    animation: corner-drop-fall 1.4s cubic-bezier(0.4, 0, 0.9, 1) forwards;
}

@keyframes corner-drop-fall {
    0% {
        transform: translate(-50%, 0) scaleY(0.7);
        opacity: 0.8;
    }
    15% {
        transform: translate(-50%, 8px) scaleY(1.35);
        opacity: 0.95;
    }
    100% {
        transform: translate(-50%, 100vh) scaleY(1.6);
        opacity: 0.1;
    }
}

#game-layer {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.dynamic-letter, .dynamic-object {
    position: absolute;
    transform: translate(-50%, -50%);
    max-width: 85%;
    max-height: 85%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dynamic-letter {
    font-size: min(9vw, 18vh);
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.2);
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
}

.dynamic-object {
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.animate-object {
    animation: float 3s ease-in-out infinite alternate, object-fade 2.5s ease-in-out forwards;
}

.animate-letter {
    animation: text-fade 2.5s ease-in-out forwards;
}

@keyframes float {
    0% {
        transform: translate(-50%, calc(-50% - 10px));
    }
    100% {
        transform: translate(-50%, calc(-50% + 10px));
    }
}

@keyframes text-fade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes object-fade {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* --- Start Screen Brand Header & Parent Info Scroll Pill --- */
.start-brand-header {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    z-index: 5;
    width: 90%;
    max-width: 600px;
}

.start-brand-title {
    font-size: clamp(1.35rem, 2.5vw, 1.85rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.6px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    margin-bottom: 4px;
}

.start-brand-subtitle {
    font-size: clamp(0.82rem, 1.4vw, 0.98rem);
    font-weight: 500;
    color: rgba(216, 222, 233, 0.72);
    letter-spacing: 0.3px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.parent-scroll-pill {
    position: absolute;
    bottom: calc(5vh + 22px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 999px;
    background: rgba(25, 34, 48, 0.84);
    border: 1px solid rgba(216, 238, 255, 0.25);
    color: rgba(236, 244, 252, 0.88);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.parent-scroll-pill:hover {
    background: rgba(35, 48, 68, 0.94);
    color: #ffffff;
    border-color: rgba(255, 163, 26, 0.65);
    transform: translateX(-50%) translateY(-2px);
}

/* --- Scrollable Parent Guide & FAQ Section (Below Fold on Start Screen) --- */
body.game-active #parent-guide {
    display: none;
}

.parent-guide-section {
    position: relative;
    z-index: 3;
    background: linear-gradient(180deg, rgba(27, 40, 56, 0.85) 0%, rgba(36, 43, 56, 0.88) 18%, rgba(46, 52, 64, 0.90) 100%);
    color: #eceff4;
    padding: 72px 24px 84px;
    border-top: 1px solid rgba(185, 225, 255, 0.18);
    contain: layout paint;
}

.parent-guide-container {
    max-width: 1040px;
    margin: 0 auto;
}

.parent-guide-header {
    text-align: center;
    max-width: 780px;
    margin: 0 auto 52px;
}

.guide-eyebrow {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(255, 163, 26, 0.16);
    border: 1px solid rgba(255, 163, 26, 0.4);
    color: #ffb84d;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}

.parent-guide-header h2 {
    font-size: clamp(1.65rem, 3.2vw, 2.35rem);
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 16px;
}

.guide-lead {
    font-size: 1.08rem;
    line-height: 1.65;
    color: #d8dee9;
}

.guide-lead strong {
    color: #ffffff;
}

.guide-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 56px;
}

.guide-card {
    background: rgba(59, 66, 82, 0.55);
    border: 1px solid rgba(216, 222, 233, 0.12);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.guide-card-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    background: rgba(90, 200, 250, 0.16);
    color: #70d6ff;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.guide-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.guide-card p {
    font-size: 0.96rem;
    line-height: 1.6;
    color: #d8dee9;
}

.guide-card code,
.pillar-item code,
.faq-item code {
    background: rgba(0, 0, 0, 0.28);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: Consolas, monospace;
    color: #ffcc00;
}

.section-subheading {
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 24px;
    text-align: center;
}

.guide-pillars {
    margin-bottom: 56px;
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.pillar-item {
    background: rgba(46, 52, 64, 0.65);
    border-left: 4px solid #FFA31A;
    border-radius: 12px;
    padding: 22px 20px;
}

.pillar-item h3 {
    font-size: 1.08rem;
    color: #ffffff;
    margin-bottom: 8px;
}

.pillar-item p {
    font-size: 0.94rem;
    line-height: 1.58;
    color: #cfd6e2;
}

.guide-alphabet-box {
    background: rgba(59, 66, 82, 0.42);
    border: 1px solid rgba(216, 222, 233, 0.12);
    border-radius: 18px;
    padding: 32px 24px;
    margin-bottom: 56px;
}

.alphabet-intro {
    text-align: center;
    color: #d8dee9;
    font-size: 0.98rem;
    margin-bottom: 20px;
}

.alphabet-pill-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 10px;
}

.alphabet-pill-list li {
    background: rgba(35, 41, 52, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #e5e9f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alphabet-pill-list li strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 163, 26, 0.22);
    color: #ffb84d;
    font-weight: 800;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.guide-faq {
    max-width: 820px;
    margin: 0 auto 52px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.faq-item {
    background: rgba(59, 66, 82, 0.5);
    border: 1px solid rgba(216, 222, 233, 0.12);
    border-radius: 14px;
    padding: 18px 22px;
}

.faq-item summary {
    font-size: 1.04rem;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    color: #FFA31A;
    font-weight: 700;
    flex-shrink: 0;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    margin-top: 12px;
    font-size: 0.96rem;
    line-height: 1.62;
    color: #d8dee9;
}

.guide-cta-footer {
    text-align: center;
    padding-top: 12px;
}

.guide-start-btn {
    padding: 16px 36px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(145deg, #FFA31A 0%, #FF8500 100%);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 149, 0, 0.32);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 24px;
}

.guide-start-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 28px rgba(255, 149, 0, 0.45);
}

.guide-footer-meta {
    font-size: 0.88rem;
    color: #9aa5b8;
}

.guide-footer-meta a {
    color: #88c0d0;
    text-decoration: none;
}

.guide-footer-meta a:hover {
    text-decoration: underline;
}

/* --- Settings Modal & Dialogue --- */
.settings-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
    padding: 20px;
}

.settings-modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.settings-dialog-card {
    background: linear-gradient(145deg, #2e3440 0%, #252a35 100%);
    border: 1px solid rgba(216, 222, 233, 0.18);
    border-radius: 24px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.55),
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px 26px 22px;
    color: #eceff4;
    transform: scale(1);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
}

.settings-modal-backdrop.hidden .settings-dialog-card {
    transform: scale(0.92);
}

.settings-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 18px;
}

.settings-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-title-icon {
    width: 24px;
    height: 24px;
    color: #FFA31A;
}

.settings-title-wrap h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.settings-intro {
    font-size: 0.95rem;
    color: #d8dee9;
    margin-bottom: 16px;
    line-height: 1.45;
}

.sound-options-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.sound-option-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(46, 52, 64, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    position: relative;
}

.sound-option-card:hover {
    background: rgba(59, 66, 82, 0.75);
    border-color: rgba(255, 163, 26, 0.5);
    transform: translateY(-1px);
}

.sound-option-card.active,
.sound-option-card:has(input:checked) {
    background: rgba(59, 66, 82, 0.95);
    border-color: #FFA31A;
    box-shadow: 0 4px 14px rgba(255, 149, 0, 0.18);
}

.sound-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-indicator {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, background-color 0.2s;
}

.option-indicator::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFA31A;
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sound-option-card:has(input:checked) .option-indicator {
    border-color: #FFA31A;
}

.sound-option-card:has(input:checked) .option-indicator::after {
    transform: scale(1);
}

.option-details {
    flex: 1;
    min-width: 0;
}

.option-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.option-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.option-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 163, 26, 0.2);
    color: #ffb84d;
    border: 1px solid rgba(255, 163, 26, 0.4);
}

.option-desc {
    font-size: 0.88rem;
    color: #d8dee9;
    line-height: 1.35;
}

.option-desc strong {
    color: #eceff4;
}

.settings-note {
    font-size: 0.82rem;
    color: #9aa5b8;
    line-height: 1.45;
    background: rgba(0, 0, 0, 0.22);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.settings-dialog-footer {
    display: flex;
    justify-content: flex-end;
}

.settings-done-btn {
    padding: 10px 28px;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(145deg, #FFA31A 0%, #FF8500 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 149, 0, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    outline: none;
}

.settings-done-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 149, 0, 0.45);
}

.settings-done-btn:active {
    transform: scale(0.97);
}


