:root {
    --font: "Poppins", sans-serif;
}

body {
    color: white;
    font-family: var(--font);
    overflow: hidden;
    margin: 0;
    width: 100%;
    height: 100%;
    position: fixed;
    inset: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

input,
textarea {
    user-select: text;
}

img {
    -webkit-user-drag: none;
}

.full {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

.center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.around {
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.column {
    display: flex;
    flex-direction: column;
}

#game-start {
    background-color: #101010;
    z-index: 20;
}

.popup {
    background-color: #323232;
    border-radius: 10px;
    padding: 30px;
    width: 420px;
    text-align: center;
    z-index: 20;
}

.popup>div {
    width: 100%;
}

h2 {
    margin: 10px 0px;
    font-size: 22px;
    font-weight: 700;
}

p {
    margin: 0px;
    color: #F0F0F0;
    font-size: 14px;
    max-width: 90%;
}

#start-icon {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
}

#game-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

#game-select div {
    cursor: pointer;
    border-radius: 8px;
    padding: 5px;
}

#game-select img {
    width: 100%;
    height: 75px;
    margin-bottom: 8px;
    border-radius: 8px;
}

#game-select a {
    font-weight: 500;
    font-size: 14px;
    color: #F0F0F0;
}

#game-select .selected {
    outline: 2px solid #F7A900;
}

#start-popup {
    position: relative;
    padding-top: 60px;
}

.popup label {
    text-align: left;
    color: #B4B4B4;
    font-size: 14px;
    margin-top: 15px;
    width: 100%;
}

#difficulty-select {
    background-color: #232323;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-radius: 10px;
    margin-top: 8px;
    padding: 5px;
    width: calc(100% - 10px);
    margin-bottom: 15px;
}

#difficulty-select a {
    padding: 7px 0px;
    cursor: pointer;
    color: #B4B4B4;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
}

#difficulty-select .selected {
    background-color: #96C558;
    color: #323232;
}

#button-container {
    margin-top: 30px;
    gap: 15px;
}

#button-container button {
    font-size: 16px;
    flex: 1;
    height: 50px;
}

button {
    font-family: var(--font);
    border-radius: 10px;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.green-btn {
    background-color: #96C558;
    color: #323232;
}

.green-btn:hover {
    background-color: #739743;
}

.disabled-green-btn {
    background-color: #647C43;
    color: #323232;
    cursor: default;
}

.disabled-green-btn:hover {
    background-color: #647C43;
}

.clear-btn {
    background-color: rgba(255, 255, 255, 0);
    border: 1px solid #B4B4B4;
    color: #B4B4B4;
}

.clear-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

#close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    cursor: pointer !important;
}

#top-nav {
    background-color: #323232;
    height: 70px;
    position: relative;
    z-index: 30;
    flex-shrink: 0;
}

#top-nav>div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

#profile {
    cursor: pointer;
}

#profile img {
    height: 40px;
    width: 40px;
}

#profile a {
    font-size: 14px;
    color: #F0F0F0;
}

#hearts {
    gap: 5px;
}

#hearts .lost {
    filter: brightness(0.5);
}

.stat-container {
    font-size: 15px;
    font-weight: 600;
    color: #B4B4B4;
    gap: 10px;
}

.stat-container span {
    font-size: 14px;
    font-weight: 600;
    color: #B4B4B4;
    border: 2px solid #B4B4B4;
    border-radius: 50px;
    padding: 5px 0px;
    min-width: 60px;
    text-align: center;
}

.number-green span {
    color: #C9EE73;
    border-color: #C9EE73;
}

#stats {
    gap: 25px !important;
}

#header {
    gap: 0px !important;
}

#header h3 {
    margin: 0px;
    font-size: 18px;
    font-weight: 700;
}

#header p {
    font-size: 14px;
    margin: 0px;
    color: #B4B4B4;
}

#game button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #B4B4B4;
    border: 2px solid #B4B4B4;
    border-radius: 50px;
    background-color: rgba(0, 0, 0, 0);
    gap: 10px;
    padding: 4px 20px;
    font-size: 16px;
}

.ocean-game {
    background-image: url('/img/bkg/ocean.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.drop-game {
    background-image: url('/img/bkg/sky.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.trail-game {
    background-image: url('/img/bkg/woods-full.webp');
    background-size: cover;
    background-position: top;
    background-repeat: no-repeat;
}

.checkpoint {
    position: absolute;
    transform: translate(-50%, -50%);
}

.trail-game .checkpoint {
    position: absolute;
    background-color: rgba(0, 0, 0, 0);
    border: 6px solid white;
    width: 40px;
    height: 40px;
    border-radius: 50px;
    z-index: 5;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
}

.trail-game .checkpoint-grey {
    transform: translate(-50%, -50%);
    background-color: #AFAFBE;
}

.checkpoint .checkpoint-check {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.5);
}

.checkpoint .checkpoint-check.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#object-area .trail-word {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    font-size: 40px;
    font-weight: 700;
    border-radius: 8px;
    background: #088CCA;
    color: #fff;
    z-index: 15;
}

#object-area .trail-character {
    position: absolute;
    width: 52px;
    height: 52px;
    background: #f97316 url('/img/assets/trail-user.svg') center/100% no-repeat;
    border-radius: 999px;
    z-index: 11;
    transition: left 0.2s ease, top 0.2s ease;
}

.trail-line {
    position: absolute;
    height: 6px;
    background: #fff;
    border-radius: 999px;
    pointer-events: none;
    z-index: 9;
    transform-origin: 0 50%;
    transition: width 0.4s ease;
}

#bottom-input {
    position: absolute;
    width: min(1000px, calc(100% - 40px));
    height: 110px;
    left: 50%;
    bottom: calc(30px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    gap: 15px;
    background-color: #088CCA;
    border-radius: 10px;
    padding-top: 15px;
    z-index: 15;
}

#bottom-input p {
    font-size: 18px;
    font-weight: 500;
}

#main-input {
    text-align: center;
    border: none;
    width: 100%;
    height: 100px;
    outline: none;
    color: white;
    font-family: var(--font);
    font-size: 35px;
    font-weight: 700;
    background-color: rgba(0, 0, 0, 0);
    transform: translateY(-10px);
    pointer-events: none;
    caret-color: transparent;
}

#game {
    display: none;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

#play {
    position: absolute;
    width: 100%;
    height: calc(100% - 70px);
    top: 70px;
    left: 0;
    overflow: hidden;
}

#object-area {
    position: relative;
    width: 100%;
    top: 0;
    height: calc(100% - 210px);
}

.fish {
    position: absolute;
    background-size: cover;
    background-position: center;
    aspect-ratio: 2 / 1;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.fish.tag {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tag-color, #3b82f6);
    border-radius: 12px;
    padding: 5px 20px;
    transform-origin: center;
    overflow: visible
}

.fish.tag::before {
    z-index: 1;
}

.fish.tag a {
    color: #fff;
    font-weight: 600;
    transform: scaleX(1);
    position: relative;
    z-index: 2;

}

.fish.tag::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -18px;
    transform: translateY(-50%) rotate(180deg);
    width: 0;
    height: 0;
    border-top: 25px solid transparent;
    border-bottom: 25px solid transparent;
    border-right: 30px solid var(--tag-color, #3b82f6);
}

.fish.tag.flip-tag::before {
    left: auto;
    right: -18px;
    border-right: 0;
    border-left: 30px solid var(--tag-color, #3b82f6)
}

.fish.tag.swim-left {
    transform: none
}

.fish.tag.swim-left a {
    transform: none
}

.fish.flip-tag {
    transform: scaleX(-1)
}

.fish.flip-tag a {
    transform: scaleX(-1)
}

.fish.flip-tag::before {
    left: auto;
    right: -12px;
    border-right: 0;
    border-left: 12px solid var(--tag-color, #3b82f6)
}

.fish.fade-out {
    opacity: 0;
}

.fish a {
    font-weight: 700;
    font-size: 40px;
}

.space-rock:not(.long-word) {
    aspect-ratio: 1 / 1 !important;
}

.swim-right {
    animation: swimRight var(--swim, 9s) linear forwards
}

.swim-left {
    animation: swimLeft var(--swim, 9s) linear forwards;
    transform: scaleX(-1);
}

.fish.flip a {
    transform: scaleX(-1);
}

@keyframes swimRight {
    from {
        left: -250px
    }

    to {
        left: 100%
    }
}

@keyframes swimLeft {
    from {
        right: -250px
    }

    to {
        right: 100%
    }
}

#game-end {
    background-color: #101010;
    display: none;
    z-index: 20;
}

#end-popup {
    position: relative;
    padding-top: 75px;
}

#score-icon {
    width: 160px;
    height: 120px;
    border-radius: 12px;
    position: absolute;
    top: -65px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid #323232;
    background-color: #323232;
}

#score-icon>div {
    width: calc(100% - 15px);
    height: calc(100% - 15px);
    border-radius: 12px;
    background: radial-gradient(circle at top left, #00c6ff 0%, #7b2ff7 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

#score-icon span {
    font-size: 35px;
    font-weight: 600;
}

#settings-btn {
    cursor: pointer;
}

#pause-screen {
    z-index: 50;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
}

#pause-screen h1 {
    font-size: 50px;
}

#style-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 8px;
    margin-bottom: 15px;
}

#style-select div {
    cursor: pointer;
    border-radius: 8px;
    padding: 5px;
}

#style-select img {
    width: 100%;
    margin-bottom: 8px;
}

#style-select a {
    font-weight: 500;
    font-size: 14px;
    color: #F0F0F0;
}

#style-select .selected {
    outline: 2px solid #F7A900;
}

#game-settings {
    z-index: 20;
    background-color: #101010;
    display: none;
}

#game-settings label:first-child {
    margin-top: 0px;
}

#game-settings h2 {
    margin: 0px !important;
}

.score-table {
    width: 100%;
    margin-top: 15px;
}

.scores {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
    color: #F0F0F0
}

.scores thead {
    background-color: #2C2C2C;
}

.scores thead th {
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #B4B4B4;
    padding: 10px 15px
}

.scores thead th:last-child {
    text-align: center !important;
}

.scores tbody tr {
    background: rgba(0, 0, 0, 0.3);
}

.scores tbody td {
    padding: 5px 20px;
    font-size: 15px;
    text-align: left;
}

.scores .latest td {
    font-weight: 700;
}

.scores .latest span {
    background-color: #F2B240 !important;
}

.scores tbody tr td:first-child {
    border-radius: 12px 0 0 12px;
}

.scores tbody tr td:nth-child(2) {
    width: 30%;
}

.scores tbody td.score {
    width: 110px;
    padding: 0;
    border-radius: 0 12px 12px 0;
    background: transparent;
}

.scores tbody td.score span {
    display: block;
    text-align: center;
    font-weight: 700;
    font-size: 20px;
    color: #0d1b2a;
    background: #65C6F2;
    border-radius: 0 12px 12px 0;
    padding: 8px 20px;
}

#confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
    animation: confettiDrop 4s ease forwards;
    background-image: url('/img//bkg/confetti.webp');
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    opacity: 0;
}

@keyframes confettiDrop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 0;
        filter: brightness(1.5);
    }
}

.bubble-burst {
    position: absolute;
    pointer-events: none;
    width: 0;
    height: 0;
}

.bubble {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    background: rgba(171, 210, 255, 0.5);
    box-shadow: 0 0 6px rgba(166, 179, 255, 0.6);
    width: var(--size, 10px);
    height: var(--size, 10px);
    transform: translate(-50%, 0);
    opacity: .9;
    animation: bubble-rise var(--dur, 900ms) ease-out var(--delay, 0ms) forwards
}

@keyframes bubble-rise {
    to {
        transform: translate(calc(-50% + var(--dx, 0px)), -140px) scale(1.08);
        opacity: 0
    }
}

.fish.long-word {
    aspect-ratio: 3.5 / 1;
    transform: scale(2);
}

.fish.long-word.swim-left {
    transform: scale(2) scaleX(-1);
}

.fish.long-word.swim-left a {
    transform: scaleX(-1);
}

.fish.long-word a {
    font-size: 20px !important;
}

.fish.tag.long-word {
    border-width: 3px
}

.fg-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 5;
}

#module-name {
    text-align: center;
    width: 125px;
}

.drop-word {
    position: absolute;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: fall var(--fall, 12s) linear forwards;
    overflow: visible;
}

.drop-word a {
    font-weight: 700;
    font-size: 40px;
    color: #2C2C2C;
}

.drop-word::before {
    content: "";
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    background: url('/img/assets/parachute.webp') no-repeat center/contain;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: none;
}

.drop-word.with-para {
    padding-top: 0px;
    min-width: 140px;
}

.drop-word.with-para::before {
    opacity: 1;
}

.drop-word.tag a {
    background-color: var(--tag-color, #3b82f6);
    color: white;
    font-weight: 600;
    border-radius: 8px;
    padding: 6px 18px;
    display: inline-block;
}

.drop-word.fade-out {
    opacity: 0;
    transition: opacity .2s ease;
}

@keyframes fall {
    to {
        top: calc(100% + 80px)
    }
}

#profile img {
    border-radius: 50px;
}

#loading {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #101010;
    z-index: 9999;
}

.puff-burst {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 15;
}

.puff {
    position: absolute;
    width: var(--size, 18px);
    height: var(--size, 18px);
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e5e7eb 40%, #cbd5f5 100%);
    opacity: 0;
    filter: blur(0);
    animation: puff-pop var(--dur, 700ms) ease-out forwards;
    animation-delay: var(--delay, 0ms);
    transform: translate(0, 0) scale(0.4);
}

@keyframes puff-pop {
    0% {
        opacity: 0.6;
        transform: translate(0, 0) scale(0.4);
        filter: blur(0);
    }

    50% {
        opacity: 0.9;
        transform: translate(calc(var(--dx, 0px) * 0.6), calc(var(--dy, 0px) * 0.6)) scale(1);
        filter: blur(1px);
    }

    100% {
        opacity: 0;
        transform: translate(var(--dx, 0px), var(--dy, -20px)) scale(1.25);
        filter: blur(3px);
    }
}

.trail-word.wrong {
    animation: trail-wrong-color 420ms ease;
}

@keyframes trail-wrong-color {
    0% {
        color: #ffffff;
    }

    20% {
        color: #ff4d4f;
    }

    60% {
        color: #ff4d4f;
    }

    100% {
        color: #ffffff;
    }
}

.checkpoint.special {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkpoint .checkpoint-circle {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
    background-color: white;
}

.special-sticker {
    position: absolute;
    left: -130px;
    top: -130px;
    width: 120x;
    height: 120px;
    pointer-events: none;
    z-index: 5;
}

#game-rating {
    margin: 25px 0px 10px 0px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}

#game-rating img {
    cursor: pointer;
    padding: 0px 2.5px;
}

.special-sticker {
    transform-origin: 50% 60%;
    will-change: transform, opacity, filter;
    pointer-events: none;
}

.special-sticker-enter {
    opacity: 0;
    transform: translateY(10px) scale(0.6) rotate(-18deg);
    filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
    animation: sticker-pop 520ms cubic-bezier(.2, .9, .2, 1) forwards;
}

.special-sticker-idle {
    animation: sticker-float 1600ms ease-in-out infinite;
}

@keyframes sticker-pop {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.6) rotate(-18deg);
        filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
    }

    55% {
        opacity: 1;
        transform: translateY(-6px) scale(1.12) rotate(6deg);
        filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.30));
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.30));
    }
}

@keyframes sticker-float {
    0% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-4px)
    }

    100% {
        transform: translateY(0)
    }
}

#error-toast-host {
    position: fixed;
    left: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999999;
    pointer-events: none;
}

.error-toast {
    pointer-events: auto;
    display: flex;
    align-items: stretch;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    border-radius: 14px;
    padding: 12px 12px 12px 14px;
    background: rgba(18, 18, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    animation: toastIn 180ms ease-out;
}

.error-toast.hide {
    animation: toastOut 180ms ease-in forwards;
}

.error-toast-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.error-toast-title {
    font-weight: 700;
    letter-spacing: 0.2px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
}

.error-toast-msg {
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.78);
    overflow-wrap: anywhere;
}

.error-toast-close {
    width: 34px;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-toast-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

@keyframes toastIn {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(10px);
        opacity: 0;
    }
}

#start-game-btn.loading {
    opacity: 0.85;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-game-btn .btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 3px solid #323232;
    border-top-color: rgba(0, 0, 0, 0);
    margin-left: 10px;
    animation: spin 600ms linear infinite;
}

#start-game-btn.loading .btn-spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#trail-path-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

#trail-character,
.trail-character {
    z-index: 3;
}

#trail-word,
.trail-word {
    z-index: 4;
}

#trail-progress-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.trail-progress-line {
    fill: none;
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

@keyframes draw-trail-line {
    to {
        stroke-dashoffset: 0;
    }
}

#trail-points-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}

#trail-lines {
    z-index: 3;
}

#trail-character {
    z-index: 4;
}

.trail-points-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}

.trail-point-debug {
    position: absolute;
    width: 12px;
    height: 12px;
    background: red;
    transform: translate(-50%, -50%);
}

#timer-select {
    background-color: #232323;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-radius: 10px;
    margin-top: 8px;
    padding: 5px;
    width: calc(100% - 10px);
}

#timer-select a {
    padding: 7px 0px;
    cursor: pointer;
    color: #B4B4B4;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
}

#timer-select .selected {
    background-color: #96C558;
    color: #323232;
}

.space-rock {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    background: none !important;
    pointer-events: none;
    isolation: isolate;
}

.space-rock-body {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.space-rock.long-word a {
    font-size: 30px;
    max-width: 78%;
    text-align: center;
    line-height: 1.05;
}

.space-rock-shape .space-rock-body {
    background: var(--space-shape-color);
}

.space-rock-full .space-rock-body {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.space-rock-circle .space-rock-body {
    border-radius: 50%;
}

.space-rock-rect .space-rock-body {
    border-radius: 14px;
}

.space-rock-shape.space-rock-circle {
    width: 150px !important;
    height: 150px !important;
}

.space-rock-shape.space-rock-circle a {
    font-size: 25px;
}

.space-rock-shape.space-rock-rect {
    width: 260px !important;
    height: 80px !important;
}

.space-rock-shape a {
    font-size: 28px;
}

.space-rock-shape.space-rock-rect a {
    font-size: 26px;
    max-width: 85%;
}

.rock-with-trail.use-trail-img::before,
.rock-with-trail.use-trail-img::after {
    display: none;
}

.space-rock-body {
    position: absolute;
    inset: 0;
    z-index: 2;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

.space-rock a {
    position: relative;
    z-index: 3;
    color: white;
    font-weight: 800;
    font-size: 34px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    max-width: 80%;
    text-align: center;
}

.space-rock-trail-img {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(270px * var(--trail-size, 1));
    height: auto;
    pointer-events: none;
    z-index: 0;
    opacity: 0.9;
    transform-origin: 0% 50%;
    will-change: transform, opacity;
    mix-blend-mode: screen;
    filter: brightness(1.08) saturate(1.08) drop-shadow(0 0 10px rgba(255, 255, 255, 0.16));
    animation:
        trailBreath var(--trail-breath-duration, 650ms) ease-in-out infinite alternate,
        trailOpacity var(--trail-opacity-duration, 480ms) ease-in-out infinite alternate;
}

.space-rock.trail-paused .space-rock-trail-img {
    animation-play-state: paused;
}

.space-rock.long-word .space-rock-trail-img {
    width: calc(360px * var(--trail-size, 1));
    left: 50%;
    top: 50%;
    transform-origin: 0% 50%;
}

@keyframes trailBreath {
    from {
        transform:
            translate(0%, -50%) rotate(var(--trail-angle, 0deg)) scaleX(-1) scaleY(0.98);
    }

    to {
        transform:
            translate(0%, -50%) rotate(var(--trail-angle, 0deg)) scaleX(-1) scaleY(1.02);
    }
}

@keyframes trailOpacity {
    from {
        opacity: 0.72;
    }

    to {
        opacity: 0.98;
    }
}

.space-blast-burst {
    position: absolute;
    width: 1px;
    height: 1px;
    pointer-events: none;
    z-index: 20;
}

.space-blast-particle {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--size);
    height: var(--size);
    border-radius: 999px;
    background: radial-gradient(circle, white 0%, #a7e8ff 35%, #6d5cff 70%, transparent 100%);
    box-shadow: 0 0 12px rgba(160, 230, 255, 0.9);
    transform: translate(-50%, -50%);
    animation: spaceBlastParticle var(--dur) ease-out var(--delay) forwards;
}

.space-blast-ring {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(170, 230, 255, 0.75);
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(120, 190, 255, 0.8);
    transform: translate(-50%, -50%) scale(0.3);
    animation: spaceBlastRing 420ms ease-out forwards;
}

@keyframes spaceBlastParticle {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    }
}

@keyframes spaceBlastRing {
    from {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.3);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3.3);
    }
}

.racer-game #object-area {
    overflow: hidden;
}

.racer-car {
    position: absolute;
    width: 9%;
    height: auto;
    transform: translateY(-50%);
    z-index: 4;
    transition: left 260ms ease-out, transform 160ms ease-out;
    pointer-events: none;
}

.racer-player {
    z-index: 5;
}

.racer-boost {
    transform: translateY(-50%) scale(1.08);
}

.racer-car {
    position: absolute;
    width: 150px;
    height: auto;
    transform: translateY(-50%);
    z-index: 5;
}

.racer-car-img {
    width: 100%;
    display: block;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.racer-rim {
    position: absolute;
    width: var(--rim-size, 20px);
    height: var(--rim-size, 20px);
    left: var(--rim-x, 50%);
    top: var(--rim-y, 50%);
    z-index: 3;
    pointer-events: none;
    animation: racerRimSpin 900ms linear infinite;
    transform-origin: center;
}

.racer-rim-front {
    --rim-x: 64%;
    --rim-y: 62%;
}

.racer-rim-back {
    --rim-x: 18%;
    --rim-y: 61%;
}

.racer-car[data-car-index="2"] .racer-rim-front {
    --rim-x: 65%;
    --rim-y: 61%;
}

.racer-car[data-car-index="2"] .racer-rim-back {
    --rim-x: 20%;
    --rim-y: 59%;
}

@keyframes racerRimSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.racer-car.car-stopped .racer-rim {
    animation-play-state: paused;
}

.timer-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    cursor: pointer;
    font-weight: 500;
}

.timer-checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: #96C558;
    cursor: pointer;
}

.timer-checkbox-row span {
    color: #B4B4B4;
    font-size: 14px;
    font-weight: 400;
}

.music-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    cursor: pointer;
    font-weight: 500;
}

.music-checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: #96C558;
    cursor: pointer;
}

.music-checkbox-row span {
    color: #B4B4B4;
    font-size: 14px;
    font-weight: 400;
}

.split-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup .split-checkbox {
    margin-top: 15px;
}

.split-checkbox label {
    margin-top: 0px !important;
}

#game-select div {
    position: relative;
}

.new-tag {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #96C558;
    color: #323232;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.racer-player-box,
.racer-npc-box {
    width: 110px;
    height: 55px;
    border-radius: 10px;
}

.racer-player-box {
    background: #DB0309;
}

.racer-npc-box {
    background: #646466;
}

.rocket-piece {
    position: absolute;
    transform: translate(-50%, -50%) scale(0.66);
    transition: left 600ms ease, top 600ms ease, transform 600ms ease;
    z-index: 4;
}

.rocket-piece img {
    display: block;
    pointer-events: none;
}

.rocket-piece-simple img {
    filter: grayscale(1);
}

.rocket-piece-basic-untyped {
    opacity: 0.35;
}

.rocket-piece-basic-untyped.rocket-piece-complete {
    opacity: 1;
}

.rocket-word-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: white;
    color: rgba(80, 80, 80, 1);
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
}

.rocket-word-label-simple {
    background: #088CCA;
    color: white;
}

.rocket-piece-built {
    pointer-events: none;
}

.rocket-fire {
    position: absolute;
    width: 110px;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: rocketFirePulse 250ms infinite alternate;
}

@keyframes rocketFirePulse {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.75;
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.rocket-blast-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    animation: rocketShake 180ms linear infinite;
}

.rocket-blast-wrap .rocket-piece {
    z-index: 4;
}

.rocket-fire-blast {
    left: 50%;
    top: 98%;
    width: 120px;
    z-index: 1;
}

.rocket-blast-off {
    animation: rocketTakeoff 3s ease-in forwards;
}

@keyframes rocketTakeoff {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    20% {
        transform: translateY(18px) scale(1.02);
        opacity: 1;
    }

    100% {
        transform: translateY(-130vh) scale(0.85);
        opacity: 1;
    }
}

@keyframes rocketShake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    50% {
        transform: translateX(2px);
    }

    75% {
        transform: translateX(-1px);
    }

    100% {
        transform: translateX(0);
    }
}

#game-start.light,
#game-end.light,
#game-settings.light {
    background-color: #F4F4F4;
    color: #323232;
}

#game-start.light .popup,
#game-end.light .popup,
#game-settings.light .popup {
    background-color: #FFFFFF;
    color: #323232;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

#game-start.light .popup p,
#game-end.light .popup p,
#game-settings.light .popup p {
    color: #646464;
}

#game-start.light .popup label,
#game-end.light .popup label,
#game-settings.light .popup label {
    color: #646464;
}

#game-start.light #game-select a,
#game-settings.light #style-select a {
    color: #323232;
}

#game-start.light #difficulty-select,
#game-settings.light #difficulty-select {
    background-color: #EEEEEE;
}

#game-start.light #difficulty-select a,
#game-settings.light #difficulty-select a {
    color: #646464;
}

#game-start.light #difficulty-select .selected,
#game-settings.light #difficulty-select .selected {
    background-color: #96C558;
    color: #323232;
}

#game-start.light .timer-checkbox-row span,
#game-start.light .music-checkbox-row span,
#game-settings.light .timer-checkbox-row span,
#game-settings.light .music-checkbox-row span {
    color: #646464;
}

#game-start.light .clear-btn,
#game-end.light .clear-btn,
#game-settings.light .clear-btn {
    border-color: #8A8A8A;
    color: #646464;
}

#game-start.light .clear-btn:hover,
#game-end.light .clear-btn:hover,
#game-settings.light .clear-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#game-end.light #score-icon {
    background-color: #FFFFFF;
    border-color: #FFFFFF;
}

#game-end.light .scores {
    color: #323232;
}

#game-end.light .scores thead {
    background-color: #EEEEEE;
}

#game-end.light .scores thead th {
    color: #646464;
}

#game-end.light .scores tbody tr {
    background-color: #F4F4F4;
}

#close-btn {
    border-radius: 50px;
    filter: brightness(2);
}

.network-toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: min(420px, calc(100vw - 32px));
    z-index: 999999;
    background: rgba(18, 18, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    padding: 12px 12px 12px 14px;
    color: white;
    font-family: var(--font);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
    pointer-events: none;
}

.network-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.network-toast-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.network-toast-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 8px;
    background: rgba(255, 197, 92, 0.12);
    color: #ffc55c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.network-toast-content {
    flex: 1;
    min-width: 0;
}

.network-toast-content strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.92);
}

.network-toast-content p {
    margin: 4px 0 0;
    max-width: 100%;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.78);
    overflow-wrap: anywhere;
}

.network-toast-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.network-toast-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.network-toast-expand {
    display: block;
    width: fit-content;
    margin: 8px 0 0 34px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #96C558;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.network-toast-expand:hover {
    color: #b5e17a;
    text-decoration: underline;
    background: transparent;
}

.network-toast-details {
    display: none;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.network-toast.expanded .network-toast-details {
    display: block;
}

.network-toast-details p {
    margin: 0 0 12px;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.network-domain {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: calc(100% - 20px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
}

.network-domain code {
    flex: 1;
    min-width: 0;
    font-family: monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.92);
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
}

.network-domain button {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 7px 12px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.network-domain button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.network-toast-details .network-toast-note {
    margin: 12px 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.network-toast.expanded .network-toast-expand {
    margin-top: 12px;
}

#games-category {
    align-self: start;
    margin-top: 15px;
    margin-bottom: 10px;
}

@media (max-width: 1024px) {
    #game-start {
        overflow-y: auto;
        box-sizing: border-box;
        padding: 75px 16px 24px;
        align-items: stretch;
    }

    #start-popup {
        width: min(480px, 100%);
        box-sizing: border-box;
        flex-shrink: 0;
        margin: auto;
        padding: 55px 20px 22px;
    }

    #game-start #game-select {
        gap: 10px;
    }

    #game-start #game-select img {
        height: clamp(45px, 9vh, 75px);
        object-fit: cover;
    }

    #game-start #button-container {
        margin-top: 15px;
    }
}

@media (max-width: 1024px) and (max-height: 820px) {
    #game-start #game-select img {
        height: 50px;
        margin-bottom: 4px;
    }

    #game-start #games-category {
        margin-top: 8px;
        margin-bottom: 5px;
    }

    #game-start #start-popup {
        padding-top: 50px;
    }

    #game-start #button-container {
        margin-top: 10px;
    }
}

@media (max-width: 600px) {
    #game-start #game-select a {
        font-size: 12px;
    }

    #game-start #start-popup {
        padding-left: 15px;
        padding-right: 15px;
    }
}


@media (max-height: 850px) {

    #game-start,
    #game-end,
    #game-settings {
        overflow-y: auto;
        box-sizing: border-box;
        padding: 55px 16px 18px;
        justify-content: flex-start;
        align-items: center;
    }

    #game-settings {
        padding-top: 18px;
    }

    #start-popup,
    #end-popup,
    #settings-popup {
        width: min(420px, 100%);
        box-sizing: border-box;
        flex-shrink: 0;
        margin: auto;
        padding: 18px 20px;
    }

    #game-start #start-popup {
        padding-top: 48px;
    }

    #game-end #end-popup {
        padding-top: 64px;
    }

    #start-icon {
        width: 90px;
        height: 90px;
        top: -45px;
    }

    #score-icon {
        width: 130px;
        height: 95px;
        top: -50px;
    }

    #game-start #game-select {
        gap: 10px;
    }

    #game-start #game-select img {
        height: 55px;
        margin-bottom: 4px;
        object-fit: cover;
    }

    #game-start #games-category {
        margin-top: 8px;
        margin-bottom: 4px;
    }

    .popup h2 {
        font-size: 19px;
        margin: 5px 0;
    }

    .popup label {
        margin-top: 8px;
    }

    .popup #difficulty-select {
        margin-top: 5px;
        margin-bottom: 8px;
    }

    .popup #difficulty-select a {
        padding: 5px 0;
    }

    .popup .split-checkbox {
        margin-top: 8px;
    }

    .popup #button-container {
        margin-top: 12px;
    }

    .popup #button-container button {
        height: 42px;
        font-size: 14px;
    }

    #game-end #game-rating {
        margin: 12px 0 5px;
    }

    #game-end .score-table {
        margin-top: 8px;
    }

    #game-settings #style-select {
        gap: 10px;
        margin-bottom: 8px;
    }

    #game-settings #style-select img {
        height: 70px;
        object-fit: contain;
    }
}

@media (max-height: 650px) {

    #game-start,
    #game-end {
        padding-top: 42px;
    }

    #game-start #start-popup {
        padding-top: 40px;
    }

    #start-icon {
        width: 74px;
        height: 74px;
        top: -37px;
    }

    #game-start #game-select img {
        height: 40px;
        margin-bottom: 2px;
    }

    #game-start #game-select a {
        font-size: 12px;
    }

    #game-start #games-category {
        margin-top: 4px;
        margin-bottom: 3px;
    }

    #game-start #button-container {
        margin-top: 8px;
    }

    #game-start #button-container button {
        height: 36px;
    }

    #game #top-nav {
        height: 60px;
    }

    #game #play {
        top: 60px;
        height: calc(100% - 60px);
    }

    #bottom-input {
        height: 85px;
        bottom: 15px;
        gap: 6px;
        padding-top: 10px;
    }

    #bottom-input p {
        font-size: 15px;
    }

    #main-input {
        height: 65px;
        font-size: 27px;
    }

    #object-area {
        height: calc(100% - 155px);
    }
}


#game-start,
#game-end,
#game-settings {
    overflow-y: auto;
    align-items: safe center;
    justify-content: safe center;
}

@media (max-height: 900px) {
    #start-popup,
    #end-popup,
    #settings-popup {
        zoom: 0.9;
    }
}

@media (max-height: 800px) {
    #start-popup,
    #end-popup,
    #settings-popup {
        zoom: 0.8;
    }
}

@media (max-height: 700px) {
    #start-popup,
    #end-popup,
    #settings-popup {
        zoom: 0.7;
    }
}

@media (max-height: 600px) {
    #start-popup,
    #end-popup,
    #settings-popup {
        zoom: 0.6;
    }
}

@media (max-height: 500px) {
    #start-popup,
    #end-popup,
    #settings-popup {
        zoom: 0.5;
    }
}
