:root {
    --teal: #008c8c;
    --teal-dark: #056464;
    --line: #c7e8e8;
    --text: #132a2a;
    --white: #ffffff;
    --shadow: 0 18px 40px rgba(0, 90, 90, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top, #ffffff 0%, #f1fbfb 45%, #dff3f6 100%);
}

.app-shell {
    width: min(100%, 460px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 20px 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: white;
    color: var(--teal);
    font-size: 28px;
    box-shadow: 0 12px 24px rgba(0, 90, 90, 0.15);
}

.players-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--teal-dark);
    font-weight: 800;
}

.hero {
    text-align: center;
    margin-top: 4px;
}

.coin-dot {
    width: 21px;
    height: 21px;
    margin: 0 auto -6px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, #fff4bd, #f1c14d 48%, #b17c12 100%);
    color: #7d5a00;
    font-weight: 900;
    font-size: 13px;
    box-shadow: inset -2px -3px 5px rgba(0,0,0,0.18), 0 3px 8px rgba(0,0,0,0.16);
}

.hero h1 {
    margin: 0;
    color: var(--teal-dark);
    font-size: clamp(34px, 9vw, 46px);
    line-height: 1;
    letter-spacing: -1px;
}

.hero p {
    margin: 10px 0 0;
    color: #263b3b;
    font-size: 16px;
}

.jar-stage {
    display: flex;
    justify-content: center;
    margin: 22px 0 18px;
    min-height: 305px;
}

.mystery-jar {
    position: relative;
    width: 230px;
    height: 290px;
}

.jar-mouth {
    position: absolute;
    left: 25px;
    right: 25px;
    top: 6px;
    height: 34px;
    border: 5px solid rgba(124, 135, 135, 0.82);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.68);
    z-index: 8;
    box-shadow: inset 0 4px 6px rgba(255,255,255,0.8), 0 3px 0 rgba(0,0,0,0.06);
}

.jar-neck {
    position: absolute;
    left: 43px;
    right: 43px;
    top: 25px;
    height: 36px;
    border-left: 5px solid rgba(145, 158, 158, 0.76);
    border-right: 5px solid rgba(145, 158, 158, 0.76);
    background: linear-gradient(90deg, rgba(255,255,255,0.54), rgba(255,255,255,0.16), rgba(255,255,255,0.45));
    z-index: 4;
}

.jar-body {
    position: absolute;
    left: 15px;
    right: 15px;
    top: 38px;
    bottom: 8px;
    overflow: hidden;
    border: 6px solid rgba(145, 158, 158, 0.82);
    border-top: 4px solid rgba(145, 158, 158, 0.82);
    border-radius: 32px 32px 50px 50px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.70) 0%, rgba(255,255,255,0.14) 25%, rgba(232,255,255,0.14) 50%, rgba(255,255,255,0.56) 100%),
        rgba(250,255,255,0.62);
    box-shadow:
        inset 16px 0 22px rgba(255,255,255,0.72),
        inset -14px 0 18px rgba(0,100,100,0.08),
        0 16px 32px rgba(0,0,0,0.12);
}

.coin-fill {
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 0;
    height: 28%;
    min-height: 82px;
    overflow: hidden;
    transition: height 0.75s ease;
    z-index: 3;
    border-radius: 42% 42% 10px 10px / 16% 16% 10px 10px;
    background: linear-gradient(180deg, rgba(178, 120, 70, 0.18), rgba(83, 59, 41, 0.78));
}

.coin-texture {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
    background-size: 88px 58px;
}

.coin-texture-back {
    opacity: 0.72;
    transform: translateY(8px) scale(1.02);
    background-image:
        radial-gradient(ellipse at 14% 28%, #b86f36 0 10px, #743819 11px, transparent 12px),
        radial-gradient(ellipse at 37% 42%, #d6dddd 0 11px, #8d9898 12px, transparent 13px),
        radial-gradient(ellipse at 64% 30%, #c78345 0 10px, #7f3f1d 11px, transparent 12px),
        radial-gradient(ellipse at 86% 50%, #e2e7e7 0 9px, #919c9c 10px, transparent 11px);
}

.coin-texture-mid {
    opacity: 0.92;
    background-size: 96px 64px;
    background-position: 14px 10px;
    background-image:
        radial-gradient(ellipse at 20% 62%, #e0e6e6 0 13px, #8c9999 14px, transparent 15px),
        radial-gradient(ellipse at 44% 30%, #c5773b 0 12px, #7d3a18 13px, transparent 14px),
        radial-gradient(ellipse at 70% 58%, #f1f4f4 0 12px, #98a3a3 13px, transparent 14px),
        radial-gradient(ellipse at 92% 28%, #bd7439 0 10px, #7a3918 11px, transparent 12px);
}

.coin-texture-front {
    opacity: 1;
    background-size: 105px 68px;
    background-position: -8px 18px;
    background-image:
        radial-gradient(ellipse at 11% 70%, #cf8244 0 13px, #7e3a18 14px, transparent 15px),
        radial-gradient(ellipse at 36% 52%, #ffffff 0 14px, #9aa5a5 15px, transparent 16px),
        radial-gradient(ellipse at 62% 78%, #c4793b 0 12px, #7b3816 13px, transparent 14px),
        radial-gradient(ellipse at 82% 48%, #e7ecec 0 13px, #939f9f 14px, transparent 15px);
}

.coin-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 24%, rgba(0,0,0,0.12) 100%),
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.05) 0 2px,
            rgba(0,0,0,0.035) 2px 4px
        );
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.coin-top {
    position: absolute;
    left: -10px;
    right: -10px;
    top: -16px;
    height: 38px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 8% 58%, #ba7038 0 12px, transparent 13px),
        radial-gradient(circle at 22% 42%, #e2e7e7 0 13px, transparent 14px),
        radial-gradient(circle at 36% 56%, #c67a3c 0 13px, transparent 14px),
        radial-gradient(circle at 51% 42%, #f2f6f6 0 13px, transparent 14px),
        radial-gradient(circle at 66% 57%, #bd7439 0 13px, transparent 14px),
        radial-gradient(circle at 82% 42%, #d5dddd 0 13px, transparent 14px),
        radial-gradient(circle at 96% 58%, #b76e35 0 12px, transparent 13px),
        linear-gradient(180deg, #d89b58, #9b6336);
    box-shadow: inset 0 5px 7px rgba(255,255,255,0.28), 0 7px 10px rgba(0,0,0,0.18);
    z-index: 6;
}

.glass-highlight-left {
    position: absolute;
    left: 28px;
    top: 42px;
    width: 26px;
    height: 156px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.70), rgba(255,255,255,0.04));
    transform: rotate(8deg);
    z-index: 9;
    pointer-events: none;
}

.glass-highlight-right {
    position: absolute;
    right: 26px;
    top: 60px;
    width: 10px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.54), rgba(255,255,255,0.03));
    transform: rotate(-8deg);
    z-index: 9;
    pointer-events: none;
}

.glass-front {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02) 34%, rgba(255,255,255,0.15)),
        linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.02));
    z-index: 8;
    pointer-events: none;
}

.jar-base {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 8px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.24);
    background: rgba(255,255,255,0.05);
    z-index: 9;
    pointer-events: none;
}

.jar-shadow {
    position: absolute;
    left: 34px;
    right: 34px;
    bottom: 0;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0,0,0,0.20), rgba(0,0,0,0.04) 70%, transparent);
    filter: blur(1px);
    z-index: -1;
}

.helper {
    text-align: center;
    color: #273f3f;
    margin: 0 0 20px;
    font-size: 15px;
}

.guess-form {
    display: grid;
    gap: 12px;
}

input {
    width: 100%;
    border: 1px solid #7ed1d1;
    border-radius: 14px;
    padding: 18px;
    font-size: 24px;
    background: rgba(255,255,255,0.90);
    color: var(--text);
    outline: none;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
}

input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(0, 140, 140, 0.12);
}

button {
    min-height: 58px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #09b1b1, #007d7d);
    color: white;
    font-weight: 900;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(0, 100, 100, 0.25);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chance-chip {
    width: fit-content;
    margin: 16px auto 0;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--white);
    color: var(--teal-dark);
    border: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(0, 100, 100, 0.1);
}

.cooldown-card {
    margin: 18px 0 0;
    padding: 20px;
    text-align: center;
    border-radius: 20px;
    background: rgba(233, 251, 251, 0.92);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.clock {
    font-size: 34px;
}

.cooldown-card p {
    margin: 6px 0;
}

.cooldown-card strong {
    display: block;
    color: var(--teal-dark);
    font-size: 44px;
}

.rules-card {
    margin-top: 20px;
    padding: 20px;
    border-radius: 20px;
    background: rgba(255,255,255,0.90);
    border: 1px solid #d8eeee;
    box-shadow: var(--shadow);
}

.rules-card h2 {
    margin: 0 0 10px;
    color: var(--teal-dark);
    font-size: 20px;
}

.rules-card ul {
    margin: 0;
    padding-left: 22px;
    color: #243b3b;
    line-height: 1.8;
}

.popup {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 31, 31, 0.55);
    z-index: 50;
}

.popup-card {
    width: min(100%, 380px);
    padding: 26px;
    text-align: center;
    border-radius: 24px;
    background: white;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    animation: pop 0.2s ease-out;
}

.popup-icon {
    font-size: 54px;
}

.popup-card h2 {
    margin: 8px 0;
    color: var(--teal-dark);
    font-size: 28px;
}

.popup-card p {
    color: #233d3d;
    font-size: 17px;
    line-height: 1.5;
}

.popup-card button {
    width: 100%;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    left: -9999px;
}

@keyframes pop {
    from {
        transform: scale(0.94);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 380px) {
    .app-shell {
        padding-left: 14px;
        padding-right: 14px;
    }

    .mystery-jar {
        transform: scale(0.94);
        transform-origin: top center;
    }

    .jar-stage {
        min-height: 292px;
    }
}
