:root {
    --bg-color: #050508;
    --text-color: #ffffff;
    --text-muted: #8e8ea0;
    --accent-glow: rgba(255, 255, 255, 0.8);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
}

/* Background Canvas */
#starsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Header Section */
header {
    text-align: center;
    margin-bottom: 80px;
}

header h1 {
    font-size: 2rem;
    font-weight: 200;
    letter-spacing: 6px;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                 0 0 20px rgba(255, 255, 255, 0.4),
                 0 0 30px rgba(255, 255, 255, 0.3);
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Top Container Section */
.top-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 1100px;
    gap: 30px;
    margin: 0 auto 80px auto;
    align-items: stretch;
}

/* Calculator Card */
.calculator-card {
    grid-column: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 80px;
    padding-bottom: 20px;
    width: 100%;
    position: relative;
}

.calculator-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 75px;
    right: 20px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
}

.calculator-card-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.calculator-card label {
    width: 100%;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1;
    text-transform: uppercase;
}

/* Form Inputs */
.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 280px;
}

input[type="number"], select {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 0;
    font-size: 1.1rem;
    font-weight: 300;
    outline: none;
    transition: border-color 0.3s ease;
    text-align: left;
}

input[type="number"] {
    font-weight: 200;
    letter-spacing: 1.5px;
}

select {
    font-weight: 200;
    letter-spacing: 1px;
    cursor: pointer;
}

input[type="number"]::placeholder {
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 300;
    opacity: 0.7;
}

input[type="number"]:focus, select:focus {
    border-color: #fff;
}

select option {
    background-color: #000;
    color: #fff;
}

input[type="number"] {
    flex: 2.5;
    width: 100%;
}

select {
    flex: 1;
}

.button-group {
    display: flex;
    align-items: center;
    gap: 16px;
    align-self: flex-start;
}

.share-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 1.5px;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    height: 35px;
    line-height: 1;
}

.share-btn:hover {
    background: var(--text-muted);
    color: #000;
}

button#calcBtn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    font-weight: 300;
    letter-spacing: 2px;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    height: 35px;
    line-height: 1;
}

button#calcBtn:hover {
    background: #fff;
    color: #000;
}

/* Earth Hero Card */
.earth-hero-card {
    grid-column: 3 / span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding-bottom: 20px;
    cursor: pointer;
    align-items: start;
    position: relative;
}

.earth-hero-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 40px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Earth Info & Visual Columns */
.earth-info-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    height: 100%;
}

.earth-info-column h2 {
    width: 100%;
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: #ffffff;
    margin-bottom: 24px;
    line-height: 1;
    text-transform: uppercase;
}

.earth-display {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: auto;
    margin-bottom: 2px;
}

.weight-tag {
    font-size: 1.8rem;
    font-weight: 200;
    letter-spacing: 1px;
    line-height: 1.1;
}

.gravity-tag {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 1px;
    line-height: 1;
}

.earth-visual-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.planet-visual-container-earth {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.planet-img.earth-img {
    height: 90px;
    width: auto;
    object-fit: contain;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.earth-hero-card:hover .earth-img {
    transform: scale(1.08);
    filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.35));
}

.earth-visual-column .jumper-container {
    width: 100%;
    margin-bottom: -18px;
    transform: translateY(-12px);
}

#jumper-earth {
    opacity: 1;
}

/* Planets Grid Section */
.planets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 80px 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.planet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    background: none;
    border: none;
}

.planet-gravity-display {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Astronaut & Jump Animations */
.jumper-container {
    height: 38px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: -15px;
    z-index: 10;
}

.astronaut-img {
    width: 38px;
    height: auto;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.astronaut-img.active {
    opacity: 1;
}

.astronaut-img.jumping {
    opacity: 1;
    animation: jumpVar var(--jump-duration, 1s) ease-in-out;
}

@keyframes jumpVar {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(var(--jump-height, -90px)); }
    100% { transform: translateY(0); }
}

/* Planet Cards & Visuals */
.planet-visual-container {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.planet-img {
    height: 90px;
    width: auto;
    object-fit: contain;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.15));
}

.planet-item:hover .planet-img {
    transform: scale(1.08);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

/* Accessibility Focus Ring for Planet Cards */
.planet-item:focus-visible,
.earth-visual-container:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.7);
    outline-offset: 6px;
    border-radius: 8px;
}

.planet-item[data-planet="Saturn"] .planet-img {
    height: 125px;
    max-width: 150%;
}

.planet-item[data-planet="Uranus"] .planet-img {
    height: 115px;
    max-width: 140%;
}

.planet-name {
    font-size: 0.85rem;
    font-weight: 200;
    letter-spacing: 4px;
    margin-top: 12px;
    color: #ffffff;
    text-transform: uppercase;
}

.planet-weight-display {
    font-size: 1rem;
    font-weight: 300;
    margin-top: 6px;
    color: var(--text-muted);
}

/* Stars Canvas Background */
#starsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Responsive Layout Adjustments */

/* Tablet & Smaller Screens (under 900px) */
@media (max-width: 900px) {
    body {
        padding: 30px 16px;
    }

    header {
        margin-bottom: 50px;
    }

    header h1 {
        font-size: 1.6rem;
        letter-spacing: 4px;
    }

    /* Stack top section vertically */
    .top-container {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 60px;
    }

    .calculator-card {
        grid-column: 1 / -1;
        padding-left: 0;
        align-items: center;
        padding-bottom: 40px;
        margin-bottom: 0px;
    }

    .calculator-card::after {
        left: 0;
        right: 0;
    }

    .calculator-card-content,
    .calculator-card label {
        text-align: center;
        align-items: center;
    }

    .input-group {
        justify-content: center;
    }

    .button-group {
        align-self: center;
        justify-content: center;
    }

    button#calcBtn {
        align-self: auto
    }

    .earth-hero-card {
        grid-column: 1 / -1;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: center;
    }

    .earth-info-column {
        align-items: flex-start;
        text-align: left;
        padding-left: calc(45% - 30px);
    }

    .earth-info-column h2 {
        text-align: left;
    }

    .earth-hero-card::after {
        left: 0;
        right: 0;
        bottom: -20px;
    }

    /* 2 columns for planets on tablets */
    .planets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 50px 20px;
    }
}

@media (max-width: 550px) {
    header h1 {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    header p {
        font-size: 0.8rem;
    }

    /* Stack Earth card content vertically on small mobile */
    .earth-hero-card {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .weight-tag {
        font-size: 1.4 rem;
    }

    .gravity-tag {
        font-size: 0.75 rem;
    }

    .planet-img.earth-img {
        height: 75px;
    }

    .planets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px 15px;
    }

    .planet-img {
        height: 70px;
    }

    .planet-item[data-planet="Saturn"] .planet-img {
        height: 95px;
    }

    .planet-item[data-planet="Uranus"] .planet-img {
        height: 85px;
    }

    .planets-grid .jumper-container {
        transform: translateY(10px);
    }
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

input, select, textarea {
    user-select: text;
}

.site-footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 80px;
}

.site-footer a {
    color: #ffffff;
    text-decoration: underline;
}

.site-footer a:hover {
    opacity: 0.8;
}