/* assets/css/style.css (Final Version with All Fixes and New Features) */

/* =================================
   变量与页面基础
   ================================= */
:root {
    /* 定义盒子尺寸变量 (2:2:3 的立式长方体) */
    --box-width: 200px;
    --box-depth: 200px;
    --box-height: 300px;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    margin: 0;
    min-height: 100vh;
    perspective: 2000px; /* 为3D变换提供全局视角 */
    overflow-x: hidden;
}
.container {
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
    box-sizing: border-box;
}

/* =================================
   盲盒风格UI (Blind Box UI)
   ================================= */
body#pc-body {
    background-color: #1a1a2e;
    color: #fff;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}
#pc-container {
    opacity: 0;
    transition: opacity 0.5s ease;
}
#pc-container h1 {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-size: 2.5em;
    margin: 20px 0 40px 0;
    text-align: center;
}
#pc-container .card {
    background-color: rgba(26, 26, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 30px;
}
#pc-container .result-card {
    display: none;
    background-color: rgba(43, 43, 67, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin-top: 30px;
}
.manual-input {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    align-items: center;
}
#pc-container #codeInput {
    flex-grow: 1;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 5px;
    padding: 12px;
    font-size: 16px;
}
#pc-container button {
    transition: all 0.3s ease;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
}
#pc-container #unboxBtn {
    color: #1a1a2e;
    font-weight: bold;
    border-radius: 50px;
}
#pc-container .redeem-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    border: none;
    cursor: pointer;
    color: #1a1a2e;
    font-weight: bold;
    border-radius: 50px;
}
#pc-container #startScanBtn {
    background-color: transparent;
    border: 1px solid;
    color: #fff;
    border-radius: 5px;
}
.result-card h2, .result-card h3 {
    color: #fff;
    margin-top: 0;
}
.result-card h3 {
    font-size: 1.8em;
    font-weight: 500;
    margin-bottom: 20px;
}
.result-card .gift-image {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    max-height: 250px;
    margin: 15px 0;
}
.result-card .meta {
    font-size: 0.9em;
    color: #aaa;
    margin-top: 20px;
}
.ad-container {
    margin: 25px 0;
    text-align: center;
}
.ad-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* --- 全新3D盲盒动画样式 --- */
.unboxing-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.unboxing-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.scene {
    width: var(--box-width);
    height: var(--box-height);
    perspective: 3000px;
    cursor: grab;
}
.scene:active {
    cursor: grabbing;
}
.box {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-15deg) rotateY(30deg);
    transition: transform 0.2s ease-out;
}
.box.is-opening {
    animation: opening-spin 1s ease-out forwards;
}
.box.is-opening .top {
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) 0.4s;
    transform: rotateX(90deg) translateZ(calc(var(--box-height) / 2)) translateY(-150%) rotateX(-70deg);
    opacity: 0;
}
@keyframes opening-spin {
    0% { transform: rotateX(-15deg) rotateY(30deg); }
    80% { transform: rotateX(20deg) rotateY(400deg) scale(1.1); }
    100% { transform: rotateX(0deg) rotateY(390deg) scale(1); }
}
.result-card.revealed {
    display: block !important;
    animation: gift-fly-out 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
    opacity: 0;
}
@keyframes gift-fly-out {
    from { opacity: 0; transform: translateY(100px) scale(0.7); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.box-face {
    position: absolute;
    border: 2px solid var(--main-color, #FAD02E);
    box-shadow: 0 0 20px var(--main-color, #FAD02E), inset 0 0 30px rgba(250, 208, 46, 0.3);
    background-color: rgba(60,40,80,0.8);
    display: flex; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; background-size: cover; background-position: center; overflow: hidden;
}
.front, .back, .left, .right {
    width: var(--box-width);
    height: var(--box-height);
}
.top, .bottom {
    width: var(--box-width);
    height: var(--box-depth);
    top: calc((var(--box-height) - var(--box-depth)) / 2);
}
.front  { transform: translateZ(calc(var(--box-depth) / 2)); }
.back   { transform: rotateY(180deg) translateZ(calc(var(--box-depth) / 2)); }
.right  { transform: rotateY(90deg) translateZ(calc(var(--box-width) / 2)); }
.left   { transform: rotateY(-90deg) translateZ(calc(var(--box-width) / 2)); }
.top    { transform: rotateX(90deg) translateZ(calc(var(--box-height) / 2)); }
.bottom { transform: rotateX(-90deg) translateZ(calc(var(--box-height) / 2)); }
.seal {
    position: absolute;
    width: 80%;
    height: 60%;
    background-color: #ffc107;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed rgba(0,0,0,0.2);
}
.seal-text {
    font-weight: bold;
    color: #333;
    font-size: 24px;
}
.seal:hover {
    background-color: #ffd54f;
}
.box.auto-rotate {
    animation: complex-rotate 20s infinite linear;
}
@keyframes complex-rotate {
    0%   { transform: rotateX(-15deg) rotateY(30deg); }
    25%  { transform: rotateX(15deg) rotateY(120deg); }
    50%  { transform: rotateX(-20deg) rotateY(240deg); }
    75%  { transform: rotateX(0deg) rotateY(360deg); }
    100% { transform: rotateX(-15deg) rotateY(390deg); } /* 360 + 30 for smooth loop */
}
.unboxing-text {
    margin-top: 60px;
    color: #fff;
    font-size: 1.5em;
    text-shadow: 0 0 10px black;
}
.box-face .face-content { text-align: center; color: white; font-size: 20px; font-weight: bold; text-shadow: 0 0 10px black; word-break: break-all; }
.face-content-image { max-width: 90%; max-height: 90%; border-radius: 8px; }
.face-content-text { line-height: 1.5; }

/* --- PC端二维码模态框样式 --- */
.qr-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}
.qr-modal-content {
    background: #fff;
    color: #333;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 300px;
    position: relative;
    animation: modal-pop 0.3s ease-out;
}
@keyframes modal-pop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.qr-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}
#qrcode-container {
    width: 200px;
    height: 200px;
    margin: 20px auto 0;
}
#qrcode-container img {
    width: 100%;
    height: 100%;
}