/* TwilightSouls - Moon Phase Compatibility
   Mystical Black Theme with Romantic Typography */

:root {
    --bg-black: #000000;
    --silver: #C0C0C0;
    --silver-light: #E8E8E8;
    --white-soft: #F5F5F5;
    --cream: #FFF8F0;
    --glow-white: rgba(255, 255, 255, 0.8);
    --glow-silver: rgba(192, 192, 192, 0.5);
    --glow-warm: rgba(255, 248, 240, 0.3);
    --text-dim: #8a8a9a;
}

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

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    background: var(--bg-black);
    color: var(--silver-light);
}

/* Starfield */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: var(--white-soft);
    border-radius: 50%;
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: var(--star-opacity, 0.3); transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Page Layout */
.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    flex-shrink: 0;
}

.title {
    font-family: 'Italiana', serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.25em;
    color: var(--cream);
    text-shadow: 0 0 40px var(--glow-warm), 0 0 80px var(--glow-silver);
    margin-bottom: 10px;
    animation: titleGlow 4s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { text-shadow: 0 0 40px var(--glow-warm), 0 0 80px var(--glow-silver); }
    100% { text-shadow: 0 0 50px var(--glow-warm), 0 0 100px var(--glow-silver); }
}

.subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 300;
    font-style: italic;
    color: var(--silver);
    letter-spacing: 0.12em;
}

/* Compatibility Section */
.compatibility-section {
    text-align: center;
    flex-shrink: 0;
}

.score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.score-display.visible {
    opacity: 1;
}

.score-number {
    font-family: 'Italiana', serif;
    font-size: clamp(3.5rem, 9vw, 6rem);
    font-weight: 400;
    color: var(--cream);
    text-shadow: 0 0 50px var(--glow-warm);
    transition: all 0.3s ease;
}

.score-percent {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--silver);
    font-weight: 300;
}

.compatibility-message {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.95rem, 1.8vw, 1.25rem);
    font-style: italic;
    font-weight: 400;
    color: var(--silver-light);
    max-width: 800px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 0 15px;
}

/* Moons Section */
.moons-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(80px, 20vw, 400px);
    flex: 1;
    width: 100%;
    max-width: 1200px;
    transition: gap 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.moons-section.joined {
    gap: clamp(20px, 5vw, 60px);
}

.moon-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.moon-wrapper {
    position: relative;
    width: clamp(130px, 20vw, 200px);
    height: clamp(130px, 20vw, 200px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.moon-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    background: radial-gradient(circle, rgba(255, 252, 245, 0.12) 0%, rgba(200, 195, 185, 0.06) 40%, transparent 70%);
    border-radius: 50%;
    animation: haloGlow 4s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes haloGlow {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
}

.moon-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.moon-image svg {
    max-width: 100%;
    max-height: 100%;
}

/* Center GIF */
.center-gif {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.center-gif img {
    width: clamp(200px, 28vw, 450px);
    height: auto;
    border-radius: 50%;
    filter: drop-shadow(0 0 25px rgba(255, 250, 240, 0.5)) drop-shadow(0 0 50px rgba(255, 250, 240, 0.2));
}

.center-gif.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.phase-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 500;
    color: var(--cream);
    letter-spacing: 0.08em;
    text-align: center;
}

/* Date Picker */
.date-picker {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.date-field {
    padding: 10px 14px;
    background: rgba(15, 15, 20, 0.9);
    border: 1px solid rgba(192, 192, 192, 0.2);
    border-radius: 6px;
    color: var(--silver-light);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.95rem, 1.5vw, 1.05rem);
    transition: all 0.3s ease;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.date-field:hover {
    border-color: rgba(255, 248, 240, 0.4);
}

.date-field:focus {
    outline: none;
    border-color: var(--cream);
    box-shadow: 0 0 20px rgba(255, 248, 240, 0.15);
}

.day-field { width: 58px; }
.year-field { width: 75px; }

.month-field {
    width: auto;
    min-width: 110px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23C0C0C0' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

.month-field option {
    background: #0a0a12;
    color: var(--silver-light);
}

.date-field::-webkit-outer-spin-button,
.date-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.date-field[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Footer */
.footer {
    flex-shrink: 0;
    text-align: center;
}

.footer p {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    font-style: italic;
    color: var(--text-dim);
    letter-spacing: 0.18em;
}

/* Responsive - Tablets */
@media (max-width: 768px) {
    .page { 
        padding: 20px 15px;
    }
    
    .moons-section { 
        gap: clamp(40px, 12vw, 120px);
    }
    
    .moons-section.joined { 
        gap: clamp(15px, 4vw, 40px);
    }
    
    .moon-wrapper {
        width: clamp(90px, 18vw, 140px);
        height: clamp(90px, 18vw, 140px);
    }
    
    .center-gif img {
        width: clamp(120px, 25vw, 250px);
    }
}

/* Responsive - Mobile Portrait */
@media (max-width: 600px) {
    .page { 
        padding: 15px 10px;
    }
    
    .title {
        font-size: 1.8rem;
        letter-spacing: 0.12em;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .compatibility-section {
        flex-shrink: 0;
    }
    
    .score-display {
        margin-bottom: 6px;
    }
    
    .score-number {
        font-size: 2.8rem;
    }
    
    .score-percent {
        font-size: 1.2rem;
    }
    
    .compatibility-message {
        font-size: 0.85rem;
        padding: 0 5px;
    }
    
    .moons-section { 
        gap: clamp(30px, 8vw, 80px);
        padding: 10px 0;
    }
    
    .moons-section.joined { 
        gap: 15px;
    }
    
    .moon-column {
        gap: 8px;
    }
    
    .moon-wrapper {
        width: clamp(70px, 20vw, 100px);
        height: clamp(70px, 20vw, 100px);
    }
    
    .moon-halo {
        width: 125%;
        height: 125%;
    }
    
    .center-gif {
        top: 40%;
    }
    
    .center-gif img {
        width: clamp(80px, 22vw, 140px);
    }
    
    .phase-name {
        font-size: 0.85rem;
    }
    
    .date-picker { 
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        max-width: 200px;
    }
    
    .date-field { 
        padding: 8px 6px;
        font-size: 0.9rem;
        min-height: 38px;
    }
    
    .day-field { 
        width: 48px;
    }
    
    .year-field { 
        width: 62px;
    }
    
    .month-field { 
        width: 100%;
        min-width: unset;
        order: -1;
        padding-right: 26px;
    }
    
    .footer p {
        font-size: 0.7rem;
        letter-spacing: 0.08em;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 380px) {
    .page {
        padding: 12px 8px;
    }
    
    .title {
        font-size: 1.5rem;
        letter-spacing: 0.08em;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
    
    .score-number {
        font-size: 2.2rem;
    }
    
    .moon-wrapper {
        width: 65px;
        height: 65px;
    }
    
    .moons-section {
        gap: 25px;
    }
    
    .center-gif img {
        width: 70px;
    }
    
    .date-picker {
        max-width: 180px;
        gap: 4px;
    }
    
    .date-field {
        padding: 7px 5px;
        font-size: 0.85rem;
        min-height: 34px;
    }
    
    .day-field { width: 42px; }
    .year-field { width: 55px; }
    
    .phase-name {
        font-size: 0.75rem;
    }
    
    .compatibility-message {
        font-size: 0.78rem;
    }
}

/* Very short screens (landscape or short devices) */
@media (max-height: 600px) {
    .page {
        padding: 10px 15px;
    }
    
    .title {
        font-size: 1.4rem;
        margin-bottom: 3px;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
    
    .score-number {
        font-size: 2rem;
    }
    
    .score-display {
        margin-bottom: 4px;
    }
    
    .compatibility-message {
        font-size: 0.8rem;
    }
    
    .moon-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .moon-column {
        gap: 5px;
    }
    
    .moons-section {
        padding: 5px 0;
    }
    
    .center-gif img {
        width: 80px;
    }
    
    .date-picker {
        gap: 4px;
    }
    
    .date-field {
        padding: 6px 8px;
        font-size: 0.85rem;
        min-height: 32px;
    }
    
    .day-field { width: 45px; }
    .year-field { width: 58px; }
    .month-field { min-width: 90px; }
    
    .phase-name {
        font-size: 0.8rem;
    }
}

/* Very short screens - hide footer */
@media (max-height: 500px) {
    .footer {
        display: none;
    }
    
    .moon-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .center-gif img {
        width: 65px;
    }
}

/* Landscape Mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .page {
        padding: 8px 20px;
    }
    
    .header {
        flex-shrink: 0;
    }
    
    .title {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
    
    .compatibility-section {
        flex-shrink: 0;
    }
    
    .score-number {
        font-size: 1.8rem;
    }
    
    .score-percent {
        font-size: 1rem;
    }
    
    .score-display {
        margin-bottom: 3px;
    }
    
    .compatibility-message {
        font-size: 0.75rem;
    }
    
    .moons-section {
        gap: 60px;
        padding: 5px 0;
    }
    
    .moons-section.joined {
        gap: 25px;
    }
    
    .moon-wrapper {
        width: 55px;
        height: 55px;
    }
    
    .moon-column {
        gap: 4px;
    }
    
    .center-gif img {
        width: 60px;
    }
    
    .phase-name {
        font-size: 0.7rem;
    }
    
    .date-picker {
        flex-wrap: nowrap;
        gap: 3px;
    }
    
    .date-field {
        padding: 5px 6px;
        font-size: 0.8rem;
        min-height: 28px;
    }
    
    .day-field { width: 38px; }
    .year-field { width: 52px; }
    .month-field { min-width: 75px; padding-right: 22px; }
    
    .footer {
        display: none;
    }
}

/* Desktop with limited height */
@media (min-width: 601px) and (max-height: 700px) {
    .page { padding: 15px 30px; }
    .moon-wrapper { width: 100px; height: 100px; }
    .score-number { font-size: 3rem; }
    .compatibility-message { font-size: 1rem; }
}

@media (min-width: 601px) and (max-height: 550px) {
    .header, .footer { display: none; }
}
