/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: linear-gradient(180deg, #a8d8f0 0%, #7ec8e8 50%, #5bb8e0 100%);
    position: relative;
}

/* ===== 全屏闪白层 ===== */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.flash-overlay.active {
    animation: flashWhite 0.15s ease-out forwards;
}

@keyframes flashWhite {
    0% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
    }
}

/* ===== 顶部非点击区（防误触） ===== */
.safe-top-zone {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    z-index: 50;
    pointer-events: auto;
}

/* ===== 主内容区 ===== */
.main-container {
    position: fixed;
    top: 0;
    left: 14%;
    right: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8vh 0 4vh;
    z-index: 10;
    margin-right: 15%;
    overflow: hidden;
}

/* ===== 上方文字 ===== */
.top-text {
    font-size: 44px;
    font-weight: bold;
    color: #000000;
    letter-spacing: 4px;
    margin-bottom: 10px;
    margin-top: 0;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* ===== 跑表显示 ===== */
.timer-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 8px;
    height: 90px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    gap: 18px;
    flex-shrink: 0;
}

.timer-display.active {
    opacity: 1;
    transform: translateY(0);
}

.timer-number {
    font-family: 'Courier New', Courier, monospace;
    font-size: 90px;
    font-weight: bold;
    color: #000000;
    letter-spacing: 2px;
    transition: color 0.15s ease;
    display: inline-block;
    width: 330px;
    text-align: right;
    white-space: nowrap;
    overflow: visible;
    margin-right: 20px;
}

.timer-number.frozen {
    color: #ff0000;
    animation: freezePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes freezePop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.35);
    }
    60% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1.25);
    }
}

.timer-unit {
    font-family: 'Courier New', Courier, monospace;
    font-size: 54px;
    font-weight: bold;
    color: #000000;
    transition: color 0.15s ease;
}

.timer-unit.frozen {
    color: #ff0000;
}

/* ===== 中心圆形容器 ===== */
.circle-container {
    width: min(55vmin, 40vh);
    height: min(55vmin, 40vh);
    border-radius: 50%;
    border: 8px solid #ffffff;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(31, 110, 160, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

/* 横屏适配：电脑端防止圆形变形 */
@media (orientation: landscape) and (min-width: 768px) {
    .circle-container {
        width: min(50vmin, 42vh);
        height: min(50vmin, 42vh);
    }

    .visual-target {
        width: min(38vmin, 34vh);
        height: min(38vmin, 34vh);
    }
}

/* 假动作闪动动画 */
.circle-container.fake-flash {
    animation: fakeFlash 0.3s ease;
}

@keyframes fakeFlash {
    0%, 100% {
        transform: scale(1);
        border-color: #ffffff;
    }
    30% {
        transform: scale(1.08);
        border-color: #ffaa00;
        box-shadow: 0 8px 32px rgba(255, 180, 60, 0.4), inset 0 0 20px rgba(255, 220, 150, 0.5);
    }
    60% {
        transform: scale(0.96);
    }
}

/* ===== 视标 ===== */
.visual-target {
    width: min(42vmin, 32vh);
    height: min(42vmin, 32vh);
    border-radius: 50%;
    transition: all 0.15s ease;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

/* 状态1：高密视标（细条纹） */
.visual-target.dense {
    background: repeating-linear-gradient(
        90deg,
        #1a5276 0px,
        #1a5276 3px,
        transparent 3px,
        transparent 6px
    );
}

/* 状态2：粗条纹视标 */
.visual-target.coarse {
    background: repeating-linear-gradient(
        90deg,
        #e74c3c 0px,
        #e74c3c 12px,
        transparent 12px,
        transparent 24px
    );
    animation: targetPulse 0.6s ease-in-out infinite alternate;
}

@keyframes targetPulse {
    from {
        transform: scale(1);
        opacity: 0.9;
    }
    to {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ===== 下方提示文字 ===== */
.bottom-text {
    font-size: 28px;
    font-weight: bold;
    color: #000000;
    margin-top: 12px;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    text-align: center;
    padding: 0 20px;
    min-height: 40px;
    flex-shrink: 0;
}

/* 等待阶段：深灰色呼吸闪烁 */
.bottom-text.waiting {
    color: #555555;
    animation: breatheBlink 1.5s ease-in-out infinite;
}

@keyframes breatheBlink {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* 假动作阶段：红色注意 + shake */
.bottom-text.fake-alert {
    color: #ff0000;
    font-size: 56px;
    animation: shakeAlert 0.3s ease;
}

@keyframes shakeAlert {
    0%, 100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-8px);
    }
    40% {
        transform: translateX(8px);
    }
    60% {
        transform: translateX(-4px);
    }
    80% {
        transform: translateX(4px);
    }
}

/* 触发阶段：巨大红色快点屏幕 + 脉冲 */
.bottom-text.hurry {
    color: #ff0000;
    font-size: 72px;
    animation: hurryPulse 0.5s ease-in-out infinite;
}

@keyframes hurryPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
}

/* ===== 互动头衔 ===== */
.rank-title {
    font-size: 48px;
    font-weight: bold;
    color: #ff0000;
    margin-top: 0;
    margin-bottom: 4px;
    letter-spacing: 4px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rank-title.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 实时计时阶段：头衔黑色 */
.rank-title.realtime {
    color: #000000;
}

/* 定格瞬间：头衔变红 + 放大冲击 */
.rank-title.frozen-rank {
    color: #ff0000;
    animation: rankFreezePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes rankFreezePop {
    0% {
        transform: translateY(0) scale(1);
    }
    30% {
        transform: translateY(-10px) scale(1.15);
    }
    60% {
        transform: translateY(0) scale(1.08);
    }
    100% {
        transform: translateY(0) scale(1.1);
    }
}

/* ===== 扎心文案 ===== */
.rank-desc {
    font-size: 24px;
    font-weight: bold;
    color: #000000;
    margin-top: 0;
    margin-bottom: 12px;
    letter-spacing: 2px;
    text-align: center;
    padding: 0 20px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.15s;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
}

.rank-desc.show {
    opacity: 1;
    transform: translateY(0);
}

/* 超过0.5秒后的紧迫感红色（由JS动态添加） */
.rank-desc.urgent-red {
    color: #cc0000;
}

/* ===== 全屏点击层 ===== */
.click-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    cursor: pointer;
}

/* ===== 太早点击提示 ===== */
.too-early-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    font-weight: bold;
    color: #ff0000;
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.too-early-hint.show {
    opacity: 1;
    animation: tooEarlyShake 0.5s ease;
}

@keyframes tooEarlyShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    20% { transform: translate(-52%, -50%) rotate(-3deg); }
    40% { transform: translate(-48%, -50%) rotate(3deg); }
    60% { transform: translate(-51%, -50%) rotate(-2deg); }
    80% { transform: translate(-49%, -50%) rotate(2deg); }
}

/* ===== 响应式适配 ===== */
@media (max-height: 700px) {
    .top-text {
        font-size: 36px;
        margin-bottom: 4px;
    }

    .timer-number {
        font-size: 72px;
        width: 260px;
    }

    .timer-unit {
        font-size: 44px;
    }

    .timer-display {
        height: 76px;
        margin-bottom: 4px;
    }

    .bottom-text {
        font-size: 24px;
        margin-top: 4px;
    }

    .bottom-text.fake-alert {
        font-size: 36px;
    }

    .bottom-text.hurry {
        font-size: 48px;
    }

    .rank-title {
        font-size: 40px;
        min-height: 56px;
    }

    .rank-desc {
        font-size: 20px;
        min-height: 56px;
        margin-bottom: 4px;
    }

    .circle-container {
        width: min(65vmin, 50vh);
        height: min(65vmin, 50vh);
    }

    .visual-target {
        width: min(55vmin, 40vh);
        height: min(55vmin, 40vh);
    }
}

@media (min-height: 1000px) {
    .top-text {
        font-size: 64px;
        margin-bottom: 12px;
    }

    .timer-number {
        font-size: 140px;
        width: 500px;
    }

    .timer-unit {
        font-size: 84px;
    }

    .timer-display {
        height: 140px;
        margin-bottom: 12px;
    }

    .bottom-text.hurry {
        font-size: 84px;
    }

    .rank-title {
        font-size: 72px;
        min-height: 96px;
    }

    .rank-desc {
        font-size: 36px;
        min-height: 96px;
    }

    .circle-container {
        width: min(65vmin, 58vh);
        height: min(65vmin, 58vh);
    }

    .visual-target {
        width: min(55vmin, 48vh);
        height: min(55vmin, 48vh);
    }
}
