/* =====================================================
   screen-app/style.css  — V0.8 像素级还原（设计稿 1200×1920）
   ===================================================== */

:root {
    --machine-color: #ff8a80;
    --claw-color: #555;
    --btn-primary: #f50057;
    --btn-secondary: #00bcd4;
    --bg-color: #ffebee;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Arial', sans-serif;
    background-color: black;
    overflow: hidden;
    touch-action: manipulation;
}

/* ─── 游戏容器（JS 控制缩放）─── */
.game-container {
    position: relative;
    overflow: hidden;
}

/* ─── 渐变底色层 ─── */
.game-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(to bottom, #6C6751, #7A755F);
    z-index: 0;
}

/* ─── 背景图片层 ─── */
.game-bg-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: fill;
    z-index: 5;
}

/* ─── 前景图层（如有）─── */
.game-fg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    z-index: 21;
    pointer-events: none;
}

/* ─── 状态栏（调试用，正式版隐藏）─── */
.status-bar {
    display: none !important;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.online  { background: #6bcb77; }
.dot.offline { background: #ff6b6b; }

/* ─── 机器主体 ─── */
.machine-body {
    flex: 1;
    position: relative;
    overflow: visible;
    width: 100%;
    z-index: 15;
}

/* ─── 爪子系统（1.2× 设计稿）─── */
.claw-mechanism {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 162px;
    height: 780px;
    z-index: 10;
    transition: height 1s ease, left 1s ease, transform 0.5s ease;
    transform-origin: top center;
}

/* 主杆/绳子（前层） */
.claw-rod {
    position: absolute;
    top: auto;
    bottom: 0; left: 0;
    width: 100%;
    height: 200%;
    background: url('images/zhuazi2.png') no-repeat center bottom;
    background-size: 100% auto;
    z-index: 20;
    -webkit-clip-path: inset(0 0 0 4px);
    clip-path: inset(0 0 0 4px);
    pointer-events: none;
}

/* 左右爪（后层） */
.claw-left, .claw-right {
    position: absolute;
    width: 260px;
    height: 260px;
    background-image: url('images/zuo.png');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 5;
    bottom: 0px;
    left: 50%;
    transition: margin-left 0.5s ease;
}
.claw-left {
    margin-left: -166px;
    transform: rotate(0deg);
}
.claw-right {
    margin-left: -98px;
    transform: scaleX(-1) rotate(0deg);
}

/* ─── 爪子动画 ─── */
@keyframes moveHorizontal {
    0%   { left: 24%; }
    100% { left: 76%; }
}

.claw-mechanism.swinging {
    animation: moveHorizontal 4s linear infinite;
}

@keyframes dropWobble {
    0%   { transform: translateX(-50%) rotate(0deg); }
    20%  { transform: translateX(-50%) rotate(3deg); }
    40%  { transform: translateX(-50%) rotate(-3deg); }
    60%  { transform: translateX(-50%) rotate(1.5deg); }
    80%  { transform: translateX(-50%) rotate(-1.5deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

@keyframes riseWobble {
    0%   { transform: translateX(-50%) rotate(0deg); }
    20%  { transform: translateX(-50%) rotate(2.4deg); }
    40%  { transform: translateX(-50%) rotate(-2.4deg); }
    60%  { transform: translateX(-50%) rotate(1.2deg); }
    80%  { transform: translateX(-50%) rotate(-1.2deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

/* ─── 奖品区（Matter.js Canvas）─── */
.prize-area {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
    pointer-events: none;
    z-index: 8;
}

/* ─── 抓到的球 ─── */
.caught-ball {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    left: 1px;
    bottom: -56px;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.2s;
}

/* ─── 下落球动画元素 ─── */
.falling-ball {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    z-index: 25;
    transition: top 1.0s ease-in, opacity 0.3s ease;
}

/* ─── QR 码遮罩（首页待机画面）─── */
.qr-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(113, 0, 13, 0.8) 0%,
        rgba(205, 1, 26, 0.8) 100%
    );
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
}

/* 浮动卡片（大屏首页背景卡片）— V0.10: 放大 30%，整体上移 200px */
.qr-floating-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    max-width: 1000px;
    transform: translate(-50%, calc(-50% - 200px)) scale(1.3);
    pointer-events: none;
    animation: floatCardScreen 4s ease-in-out infinite;
    z-index: 1;
}

@keyframes floatCardScreen {
    0%, 100% { transform: translate(-50%, calc(-50% - 200px)) scale(1.3); }
    50%       { transform: translate(-50%, calc(-50% - 220px)) scale(1.3); }
}

/* QR 内容区（logo + 二维码 + 提示）— V0.10: 整体上移 350px（原 -100 + 额外 -250）*/
.qr-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30%;
    max-width: 400px;
    transform: translateY(-350px);
}

/* Logo（QR上方） */
.qr-logo {
    width: 200px;
    margin-bottom: 30px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.qr-box {
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}
.qr-text {
    width: 100%;
    margin-top: 15px;
    color: white;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
@media (min-width: 1200px) {
    .qr-text    { font-size: 20px; }
    .qr-content { width: 25%; }
    .qr-logo    { width: 240px; }
}

/* ─── 弹窗基础 ─── */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 80%;
    max-width: 400px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.timer-text { color: #999; font-size: 0.9rem; margin-top: 10px; }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── 中奖弹窗（全屏暗色）V0.11: 居中 + 卡片放大 ─── */
#modal-win.modal {
    background: linear-gradient(to bottom, #000000 0%, rgba(0, 0, 0, 0.7) 100%);
    align-items: center;
    padding-top: 0;
}

.modal-content.win-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 20px !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeInUp 0.5s ease-out forwards;
    transform: translateY(-200px);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(-170px); }
    to   { opacity: 1; transform: translateY(-200px); }
}

.win-content h2, .win-content p { display: none; }

.win-title-sub {
    color: #ffffff;
    font-size: 1.45rem;
    margin-bottom: 5px;
    letter-spacing: 2px;
    text-align: center;
}
.win-title-main {
    color: #ffffff;
    font-size: 2.4rem;
    font-weight: bold;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.win-product-img {
    max-width: 96%;
    max-height: 60%;
    object-fit: contain;
    margin-bottom: 30px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
    animation: floatImg 3s ease-in-out infinite;
}
.win-footer-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    text-align: center;
}

@keyframes floatImg {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
