/* 全局一点小优化 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Microsoft YaHei", system-ui, sans-serif;
    color: #e6f0ff;
    background: #050818;
}

/* 背景区域 */
.gradient-bg {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px 18px 14px;
    background: radial-gradient(circle at top, #0b2a5a 0, #050818 40%, #02040a 100%);
    box-sizing: border-box;
}

/* 顶部区域 */
.top {
    margin-bottom: 10px;
}

#waveCanvas {
    width: 100%;
    height: 110px;
    display: block;
}

.status-label {
    padding: 4px 10px 6px;
    font-size: 18px;
    color: #b4cdff;
}

/* 卡片主体 */
.card {
    flex: 1;
    margin: 10px 0;
    padding: 35px 60px;
    border-radius: 24px;
    background: rgba(10, 35, 70, 0.92);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
}

.tip {
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
    color: #d2e1ff;
}

.center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ============================ */
/*      答案输入框（放大50%）   */
/* ============================ */
#answer {
    width: 90%;               /* 原来 60%，现在放大 */
    max-width: 900px;         /* 原 700 -> 更大 */
    font-size: 90px;          /* 原 60px → 放大 1.5 倍 */
    font-weight: 700;
    text-align: center;
    padding: 16px 28px;       /* 内边距也加大 */
    color: #ebf5ff;
    background: #0f2850;
    border-radius: 20px;
    border: 3px solid #5a87d2;
    outline: none;
}

#answer:focus {
    border-color: #73b4ff;
    box-shadow: 0 0 14px rgba(115, 180, 255, 0.6);
}

/* 反馈文字 */
.feedback {
    margin-top: 30px;
    font-size: 40px;
    text-align: center;
}

/* ============================================= */
/*         底部按钮区域：两排三列（固定）         */
/* ============================================= */
.bottom-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 永远三列排列 */
    gap: 18px;
    padding: 20px 6px 6px;
}

.bottom-bar button {
    width: 100%;
    padding: 16px 0;
    font-size: 22px;
    font-weight: 600;
    border-radius: 22px;
    border: none;
    cursor: pointer;
    color: #e6f0ff;
    background: linear-gradient(135deg, #2859a0, #3f7ad2);
    transition: all .15s ease;
}

.bottom-bar button:hover {
    background: linear-gradient(135deg, #468be0, #5a9cf0);
    transform: translateY(-2px);
}

.bottom-bar button:active {
    background: #1b4278;
    transform: translateY(1px);
}

/* ========================================= */
/*             响应式部分                     */
/* ========================================= */

/* 平板（<= 992px） */
@media (max-width: 992px) {

    .card {
        padding: 28px 32px;
    }

    #answer {
        width: 95%;
        font-size: 68px;
    }

    .feedback {
        font-size: 32px;
        margin-top: 24px;
    }

    .tip {
        font-size: 20px;
    }

    .bottom-bar button {
        font-size: 18px;
        padding: 14px 0;
    }
}

/* 手机竖屏（<= 600px） */
@media (max-width: 600px) {

    .gradient-bg {
        padding: 8px 10px 12px;
    }

    .card {
        margin: 6px 0;
        padding: 20px 16px;
        border-radius: 18px;
    }

    #waveCanvas {
        height: 80px;
    }

    .status-label {
        font-size: 14px;
        padding: 2px 6px 4px;
    }

    #answer {
        width: 100%;
        font-size: 38px;     /* 移动端自动缩小到合适大小 */
        padding: 10px 14px;
        border-radius: 14px;
    }

    .feedback {
        font-size: 24px;
        margin-top: 18px;
    }

    /* 按钮更适合窄屏 */
    .bottom-bar {
        gap: 12px;
        padding-top: 12px;
    }

    .bottom-bar button {
        font-size: 16px;
        padding: 12px 0;
        border-radius: 18px;
    }
}

/* 超小屏（<= 380px） */
@media (max-width: 380px) {

    #answer {
        font-size: 28px;
    }

    .feedback {
        font-size: 20px;
    }

    .bottom-bar button {
        font-size: 14px;
        padding: 10px 0;
    }
}


/* ====== 自定义弹窗：半透明遮罩层 ====== */
.popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.popup-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* ====== 中间卡片 ====== */
.popup-card {
    width: 90%;
    max-width: 380px;
    max-height: 90vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(135deg, #0f2446, #081020);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;

    transform: translateY(15px) scale(0.96);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
}

.popup-backdrop.show .popup-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #eef3ff;
    margin-bottom: 8px;
}

.popup-message {
font-size: 14px;
    color: #b8c9ff;
    margin-bottom: 14px;
    line-height: 1.45;
    white-space: pre-line;   /* 让 \n 真正换行 */
    max-height: 40vh;        /* 小屏幕避免撑出屏幕 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 输入框 */
.popup-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(5,10,25,0.85);
    border: 1px solid rgba(120,164,255,0.5);
    color: #eef3ff;
    font-size: 14px;
    outline: none;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.popup-input:focus {
    border-color: #78a4ff;
    background: rgba(8,14,40,0.95);
    box-shadow: 0 0 0 1px rgba(120,164,255,0.6);
}

/* 底部按钮区域 */
.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.popup-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.popup-btn-cancel {
    background: transparent;
    color: #9db3ff;
    border: 1px solid rgba(150,170,255,0.45);
}

.popup-btn-ok {
    background: linear-gradient(135deg, #4f9cff, #6bffda);
    color: #041021;
}

.popup-btn:active {
    transform: translateY(1px);
}
