:root{
    --ink: #20313f;
    --muted: #6c7b86;
    --paper: #fffaf0;
    --sky: #9bd8ff;
    --blue: #2374d8;
    --orange: #ff8a2a;
    --yellow: #ffd15c;
    --green: #27a86d;
    --red: #e2503d;
    --shadow: 0 18px 46px rgba(34, 61, 83, 0.18);
}

*{
    box-sizing: border-box;
}

html,body{
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 16%, rgba(255, 209, 92, 0.32), transparent 26%),
        radial-gradient(circle at 86% 10%, rgba(94, 190, 255, 0.28), transparent 28%),
        linear-gradient(180deg, #bde8ff 0%, #eaf8ff 48%, #fff3d6 100%);
    font-family: "Trebuchet MS", "Gill Sans", "Microsoft YaHei", sans-serif;
}

body::before{
    content: "";
    position: fixed;
    inset: auto -8% -18% -8%;
    height: 38%;
    background:
        radial-gradient(ellipse at center, rgba(78, 183, 110, 0.35), transparent 64%),
        linear-gradient(180deg, rgba(134, 212, 119, 0.45), rgba(74, 164, 88, 0.38));
    border-radius: 50% 50% 0 0;
    pointer-events: none;
}

.circle{
    position: fixed;
    border-radius: 50%;
    text-align: center;
    color: #ffffff;
    font-weight: 900;
    border: 4px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 14px 28px rgba(35, 74, 105, 0.24), inset 0 -10px 18px rgba(0, 0, 0, 0.12);
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.anime1{
    animation: appear 0.5s cubic-bezier(.2,1.5,.5,1) forwards;
}

.anime2{
    animation: disappear 0.45s ease-in forwards;
}

.info{
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 11;
    display: grid;
    grid-template-columns: minmax(112px, 150px) minmax(180px, 1fr) minmax(112px, 150px) 68px;
    align-items: center;
    gap: 14px;
    width: min(760px, calc(100% - 28px));
    padding: 10px 12px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 16px 38px rgba(44, 79, 100, 0.14);
    backdrop-filter: blur(14px);
    transform: translateX(-50%);
}

.hud_card{
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 8px 14px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: inset 0 -4px 0 rgba(35, 116, 216, 0.08);
}

.hud_label{
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.hud_value{
    color: var(--blue);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.hud_title{
    color: #31506a;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.06em;
}

.rank_btn{
    position: static;
    width: 68px;
    height: 48px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #ff9f3c, #ff6f2f);
    color: white;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(255, 111, 47, 0.26);
    transition: transform 0.2s, box-shadow 0.2s;
}

.rank_btn:hover{
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(255, 111, 47, 0.34);
}

.menu_screen .info{
    left: auto;
    right: 16px;
    grid-template-columns: 68px;
    width: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    transform: none;
}

.menu_screen .hud_card,
.menu_screen .hud_title{
    display: none;
}

.rank_modal{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 35, 48, 0.56);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.rank_modal.hidden{
    display: none;
}

.rank_content{
    position: relative;
    width: min(420px, calc(100% - 32px));
    max-height: min(620px, calc(100% - 48px));
    margin: auto;
    padding: 30px;
    overflow-y: auto;
    border: 3px solid #ffffff;
    border-radius: 28px;
    background: linear-gradient(180deg, #fffdf7, #fff3d2);
    box-shadow: var(--shadow);
}

.rank_content h2{
    margin: 0 0 20px;
    color: var(--ink);
    font-size: 26px;
    text-align: center;
}

.close_btn{
    position: absolute;
    right: 18px;
    top: 12px;
    color: #9c6b4f;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close_btn:hover{
    color: var(--red);
}

.rank_list{
    padding: 8px 0;
}

.rank_item{
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 800;
}

.rank_index{
    width: 30px;
    flex-shrink: 0;
    color: var(--orange);
    text-align: right;
}

.rank_name{
    flex: 1;
    text-align: left;
}

.rank_score{
    width: 68px;
    flex-shrink: 0;
    color: var(--blue);
    text-align: right;
}

.cover{
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 3vh, 30px);
    overflow: auto;
    background:
        radial-gradient(circle at 10% 12%, rgba(255, 209, 92, 0.44), transparent 24%),
        radial-gradient(circle at 90% 10%, rgba(107, 202, 255, 0.38), transparent 24%),
        radial-gradient(circle at 78% 88%, rgba(255, 138, 42, 0.16), transparent 28%),
        linear-gradient(145deg, #e6f8ff 0%, #fff8dc 100%);
}

.home_shell{
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
    grid-template-rows: auto auto;
    gap: clamp(14px, 2.4vh, 24px);
    width: min(1120px, 100%);
    max-height: calc(100vh - clamp(28px, 6vh, 60px));
}

.hero_panel,
.game_info,
.difficulty_panel{
    border: 3px solid rgba(255, 255, 255, 0.82);
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero_panel{
    position: relative;
    grid-row: span 2;
    min-height: 0;
    padding: clamp(22px, 4vw, 44px);
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 194, 0.78)),
        radial-gradient(circle at 80% 72%, rgba(255, 138, 42, 0.22), transparent 34%);
}

.hero_panel::after{
    content: "";
    position: absolute;
    right: -80px;
    bottom: -120px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 209, 92, 0.34);
}

.eyebrow{
    margin: 0 0 12px;
    color: var(--orange);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.title{
    margin: 0;
    color: #173349;
    font-size: clamp(42px, 6vw, 72px);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

.hero_desc{
    max-width: 420px;
    margin: 18px 0 0;
    color: #476173;
    font-size: clamp(17px, 2vw, 22px);
    font-weight: 800;
    line-height: 1.55;
}

.hero_mascot{
    position: absolute;
    right: clamp(20px, 5vw, 54px);
    bottom: clamp(20px, 6vh, 56px);
    --cat-scale: 1;
    width: 210px;
    height: 190px;
    filter: drop-shadow(0 18px 18px rgba(92, 68, 44, 0.18));
    animation: catBob 2.7s ease-in-out infinite;
}

.cat_body{
    position: absolute;
    right: 24px;
    bottom: 0;
    width: 122px;
    height: 108px;
    border-radius: 54% 48% 42% 44%;
    background: linear-gradient(135deg, #ffad45, #f17421);
}

.cat_head{
    position: absolute;
    right: 46px;
    bottom: 78px;
    width: 108px;
    height: 92px;
    border-radius: 48% 48% 44% 44%;
    background: linear-gradient(135deg, #ffb24d, #ff8327);
}

.cat_ear{
    position: absolute;
    top: -18px;
    width: 38px;
    height: 38px;
    background: #ff8a2a;
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.cat_ear.left{
    left: 8px;
    transform: rotate(-18deg);
}

.cat_ear.right{
    right: 8px;
    transform: rotate(18deg);
}

.cat_eye{
    position: absolute;
    top: 38px;
    width: 13px;
    height: 18px;
    border-radius: 50%;
    background: #24313a;
}

.cat_eye.left{
    left: 31px;
}

.cat_eye.right{
    right: 31px;
}

.cat_nose{
    position: absolute;
    left: 50%;
    top: 58px;
    width: 13px;
    height: 9px;
    border-radius: 50%;
    background: #7a3d2b;
    transform: translateX(-50%);
}

.cat_smile{
    position: absolute;
    left: 50%;
    top: 64px;
    width: 34px;
    height: 16px;
    border-bottom: 4px solid #7a3d2b;
    border-radius: 0 0 34px 34px;
    transform: translateX(-50%);
}

.cat_tail{
    position: absolute;
    left: 16px;
    bottom: 42px;
    width: 96px;
    height: 38px;
    border: 18px solid #f47a22;
    border-right: none;
    border-bottom: none;
    border-radius: 70px 0 0 0;
    transform: rotate(-22deg);
}

.cat_paw{
    position: absolute;
    right: 16px;
    bottom: 58px;
    width: 72px;
    height: 24px;
    border-radius: 999px;
    background: #ffbd64;
    transform: rotate(-18deg);
}

.game_info{
    padding: clamp(16px, 2.4vh, 24px);
}

.game_info h2{
    margin: 0 0 12px;
    font-size: clamp(22px, 3vh, 28px);
}

.rule_grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.rule_card{
    min-height: 88px;
    padding: 14px;
    border-radius: 20px;
    background: #fffaf0;
    box-shadow: inset 0 -5px 0 rgba(255, 138, 42, 0.08);
}

.rule_card strong{
    display: block;
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 17px;
}

.rule_card span{
    display: block;
    color: #526675;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.difficulty_panel{
    padding: clamp(16px, 2.4vh, 24px);
}

.section_heading{
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.section_heading span{
    font-size: clamp(22px, 3vh, 30px);
    font-weight: 900;
}

.section_heading small{
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.btn_box{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.difficult{
    min-height: clamp(62px, 9vh, 78px);
    padding: 12px 10px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(145deg, #ffffff, #eaf7ff);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(35, 116, 216, 0.12), inset 0 -6px 0 rgba(35, 116, 216, 0.08);
    transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}

.difficult:nth-child(4n+1){
    background: linear-gradient(145deg, #fffdf8, #ffe9b3);
}

.difficult:nth-child(4n+2){
    background: linear-gradient(145deg, #ffffff, #d7f2ff);
}

.difficult:nth-child(4n+3){
    background: linear-gradient(145deg, #ffffff, #dcf8e7);
}

.difficult:nth-child(4n){
    background: linear-gradient(145deg, #fff9f6, #ffd8ca);
}

.difficult span{
    display: block;
    font-size: clamp(18px, 2.4vh, 22px);
    font-weight: 900;
}

.difficult small{
    display: block;
    margin-top: 4px;
    color: #617484;
    font-size: 12px;
    font-weight: 900;
}

.difficult:hover{
    transform: translateY(-4px) rotate(-1deg);
    box-shadow: 0 16px 28px rgba(35, 116, 216, 0.2), inset 0 -6px 0 rgba(35, 116, 216, 0.08);
}

.ready,
.countdown{
    position: fixed;
    left: calc(50% - 130px);
    top: calc(50% - 130px);
    width: 260px;
    height: 260px;
    border: 5px solid rgba(255, 255, 255, 0.88);
    border-radius: 50%;
    background: linear-gradient(145deg, #ffb44f, #ff7b2f);
    color: white;
    font-family: "Trebuchet MS", "Microsoft YaHei", sans-serif;
    font-size: 108px;
    font-weight: 900;
    line-height: 250px;
    text-align: center;
    box-shadow: var(--shadow);
}

.ready{
    z-index: 9;
}

.countdown{
    font-size: 190px;
}

.index1{
    z-index: 8;
}

.index2{
    z-index: 7;
}

.index3{
    z-index: 6;
}

.index4{
    z-index: 5;
    font-size: 96px;
}

.score_feedback{
    position: fixed;
    right: 22px;
    bottom: 24px;
    z-index: 12;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    pointer-events: none;
}

.game_mascot{
    position: relative;
    width: 132px;
    height: 138px;
    opacity: 0;
    transform: translateY(18px) scale(0.94);
    transition: opacity 0.18s, transform 0.18s;
}

.game_mascot.active{
    opacity: 1;
    transform: translateY(0) scale(1);
}

.game_mascot.good{
    animation: mascotCheer 0.7s ease-out;
}

.game_mascot.bad{
    animation: mascotShake 0.55s ease-out;
}

.bubble{
    position: absolute;
    right: 18px;
    bottom: 112px;
    min-width: 116px;
    padding: 9px 12px;
    border: 3px solid #ffffff;
    border-radius: 18px 18px 4px 18px;
    background: #fffaf0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 10px 24px rgba(35, 61, 83, 0.16);
}

.mini_cat{
    position: absolute;
    right: 10px;
    bottom: 0;
    width: 96px;
    height: 88px;
    border-radius: 46% 46% 42% 42%;
    background: linear-gradient(135deg, #ffb24d, #ff8327);
    box-shadow: 0 14px 24px rgba(92, 68, 44, 0.18);
}

.mini_cat_body{
    position: absolute;
    left: 14px;
    bottom: -32px;
    width: 70px;
    height: 54px;
    border-radius: 50% 50% 42% 42%;
    background: #f37a21;
    z-index: -1;
}

.mini_cat_ear{
    position: absolute;
    top: -16px;
    width: 32px;
    height: 32px;
    background: #ff8a2a;
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.mini_cat_ear.left{
    left: 7px;
    transform: rotate(-18deg);
}

.mini_cat_ear.right{
    right: 7px;
    transform: rotate(18deg);
}

.mini_cat_eye{
    position: absolute;
    top: 36px;
    width: 10px;
    height: 15px;
    border-radius: 50%;
    background: #24313a;
}

.mini_cat_eye.left{
    left: 28px;
}

.mini_cat_eye.right{
    right: 28px;
}

.mini_cat_nose{
    position: absolute;
    left: 50%;
    top: 54px;
    width: 12px;
    height: 8px;
    border-radius: 50%;
    background: #7a3d2b;
    transform: translateX(-50%);
}

.score_feedback_list{
    min-width: 120px;
}

.score_feedback_item{
    min-width: 112px;
    margin-bottom: 10px;
    padding: 10px 16px;
    border: 4px solid #ffffff;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 30px rgba(31, 46, 54, 0.2);
    font-size: 34px;
    font-weight: 900;
    text-align: center;
    animation: scoreFloat 1.05s ease-out forwards;
}

.score_feedback_item.plus{
    color: var(--green);
}

.score_feedback_item.minus{
    color: var(--red);
}

@keyframes disappear {
    0%{
        transform: scale(1);
        opacity: 0.95;
    }
    35%{
        transform: scale(1.28) rotate(-7deg);
        opacity: 1;
    }
    100%{
        transform: scale(0) rotate(14deg);
        opacity: 0;
    }
}

@keyframes appear {
    0%{
        transform: scale(0) rotate(-18deg);
        opacity: 0;
    }
    70%{
        transform: scale(1.14) rotate(4deg);
        opacity: 1;
    }
    100%{
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

@keyframes scoreFloat {
    0%{
        transform: translateY(18px) scale(0.8) rotate(-4deg);
        opacity: 0;
    }
    18%{
        transform: translateY(0) scale(1.18) rotate(2deg);
        opacity: 1;
    }
    100%{
        transform: translateY(-64px) scale(1) rotate(0);
        opacity: 0;
    }
}

@keyframes catBob {
    0%, 100%{
        transform: translateY(0) rotate(-1deg) scale(var(--cat-scale));
    }
    50%{
        transform: translateY(-12px) rotate(2deg) scale(var(--cat-scale));
    }
}

@keyframes mascotCheer {
    0%, 100%{
        transform: translateY(0) scale(1);
    }
    35%{
        transform: translateY(-12px) scale(1.08) rotate(-3deg);
    }
    70%{
        transform: translateY(-4px) scale(1.02) rotate(3deg);
    }
}

@keyframes mascotShake {
    0%, 100%{
        transform: translateX(0);
    }
    25%{
        transform: translateX(-8px) rotate(-3deg);
    }
    50%{
        transform: translateX(8px) rotate(3deg);
    }
    75%{
        transform: translateX(-4px) rotate(-2deg);
    }
}

@media (max-height: 740px) and (min-width: 821px){
    .home_shell{
        grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
        gap: 12px;
    }

    .hero_panel,
    .game_info,
    .difficulty_panel{
        border-radius: 26px;
    }

    .hero_panel{
        padding: 24px;
    }

    .title{
        font-size: 48px;
    }

    .hero_desc{
        font-size: 17px;
    }

    .hero_mascot{
        --cat-scale: 0.82;
        width: 160px;
        height: 150px;
        transform-origin: right bottom;
    }

    .game_info,
    .difficulty_panel{
        padding: 14px;
    }

    .rule_grid{
        gap: 8px;
    }

    .rule_card{
        min-height: 68px;
        padding: 10px 12px;
    }

    .rule_card strong{
        font-size: 15px;
    }

    .rule_card span{
        font-size: 12px;
        line-height: 1.35;
    }

    .section_heading{
        margin-bottom: 10px;
    }

    .btn_box{
        gap: 8px;
    }

    .difficult{
        min-height: 54px;
        padding: 8px;
    }

    .difficult span{
        font-size: 17px;
    }
}

@media (max-width: 820px){
    html,body{
        overflow: auto;
    }

    .info{
        grid-template-columns: 1fr 1fr 58px;
        width: calc(100% - 20px);
        padding: 9px 10px;
    }

    .hud_title{
        display: none;
    }

    .hud_card{
        min-height: 46px;
        padding: 7px 10px;
    }

    .hud_value{
        font-size: 24px;
    }

    .rank_btn{
        width: 54px;
        height: 42px;
        font-size: 12px;
    }

    .menu_screen .info{
        right: 10px;
        grid-template-columns: 54px;
    }

    .cover{
        align-items: flex-start;
        padding: 18px 14px;
        overflow-y: auto;
    }

    .home_shell{
        display: block;
        max-height: none;
    }

    .hero_panel,
    .game_info,
    .difficulty_panel{
        margin-bottom: 14px;
        border-radius: 26px;
    }

    .hero_panel{
        min-height: 320px;
        padding: 24px;
    }

    .title{
        max-width: 320px;
        font-size: 44px;
    }

    .hero_desc{
        max-width: 280px;
        font-size: 16px;
    }

    .hero_mascot{
        right: 6px;
        bottom: 8px;
        --cat-scale: 0.72;
        transform-origin: right bottom;
    }

    .rule_grid{
        grid-template-columns: 1fr;
    }

    .section_heading{
        display: block;
    }

    .section_heading small{
        display: block;
        margin-top: 4px;
        text-align: left;
    }

    .btn_box{
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .difficult{
        min-height: 62px;
    }

    .ready,
    .countdown{
        width: 210px;
        height: 210px;
        font-size: 82px;
        line-height: 200px;
    }

    .countdown{
        font-size: 150px;
    }

    .index4{
        font-size: 76px;
    }

    .score_feedback{
        right: 10px;
        bottom: 12px;
        gap: 8px;
    }

    .game_mascot{
        width: 106px;
        height: 118px;
        transform-origin: right bottom;
    }

    .bubble{
        right: 10px;
        min-width: 94px;
        font-size: 13px;
    }

    .mini_cat{
        transform: scale(0.82);
        transform-origin: right bottom;
    }

    .score_feedback_list{
        min-width: 88px;
    }

    .score_feedback_item{
        min-width: 82px;
        padding: 8px 12px;
        font-size: 24px;
    }
}

@media (max-width: 420px){
    .btn_box{
        grid-template-columns: 1fr;
    }

    .hero_panel{
        min-height: 360px;
    }
}
