/* ============================
   抛硬币首页 - 全局样式
   ============================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overscroll-behavior: none;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 50%, #dfe4ea 100%);
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
    color: #4a5568;
    cursor: url("/cursor-pointer.png") 16 16, auto;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
}

/* ============================
   头部标题
   ============================ */
header {
    text-align: center;
    margin-bottom: 28px;
    z-index: 10;
}

header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #4a90e2 0%, #5f6caf 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
}

header p {
    font-size: 15px;
    color: #718096;
    letter-spacing: 1px;
}

/* ============================
   硬币展示区
   ============================ */
.coin-stage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 24px;
    min-height: 160px;
    width: 100%;
    max-width: 900px;
    padding: 20px;
    z-index: 10;
    perspective: 800px;
}

/* 单枚硬币 */
.coin {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.coin-face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    backface-visibility: hidden;
    box-shadow:
        inset 0 0 0 4px rgba(255, 255, 255, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.12);
    user-select: none;
}

/* 硬币正面：金色渐变 */
.coin-front {
    background: radial-gradient(circle at 30% 30%, #ffe29f 0%, #ffb347 50%, #e6a23c 100%);
    transform: rotateY(0deg);
}

/* 硬币反面：银色渐变 */
.coin-back {
    background: radial-gradient(circle at 30% 30%, #f0f0f0 0%, #c0c0c0 50%, #a0a0a0 100%);
    transform: rotateY(180deg);
}

/* ============================
   输入控制区
   ============================ */
.coin-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 420px;
    margin-top: 28px;
    z-index: 10;
}

.input-row {
    display: flex;
    width: 100%;
    gap: 12px;
}

#numberInput {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(74, 144, 226, 0.4);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 16px;
    color: #4a5568;
    text-align: center;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    cursor: text;
}

#numberInput::placeholder {
    color: #a0aec0;
}

#numberInput:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.18);
}

#flipBtn {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(135deg, #5f6caf 0%, #4a90e2 100%);
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.35);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, filter 0.25s ease;
    white-space: nowrap;
}

#flipBtn:hover {
    transform: translateY(-3px) scale(1.03);
    filter: brightness(1.08);
    box-shadow: 0 10px 28px rgba(74, 144, 226, 0.45);
}

#flipBtn:active {
    transform: translateY(0) scale(0.98);
}

/* ============================
   提示信息
   ============================ */
#messageBox {
    min-height: 24px;
    font-size: 14px;
    text-align: center;
    color: #718096;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#messageBox.show {
    opacity: 1;
    transform: translateY(0);
}

#messageBox.error {
    color: #e53e3e;
}

#messageBox.info {
    color: #4a90e2;
}

/* ============================
   结果统计与图表区
   ============================ */
.result-area {
    width: 100%;
    max-width: 420px;
    margin-top: 28px;
    padding: 22px 24px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(74, 144, 226, 0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
    z-index: 10;
}

.result-area.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-value.front {
    color: #e6a23c;
}

.stat-value.back {
    color: #8c8c8c;
}

.stat-label {
    font-size: 13px;
    color: #718096;
    margin-top: 4px;
}

.result-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.pie-chart {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: background 0.4s ease;
}

.chart-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.front {
    background: #ffb347;
}

.legend-dot.back {
    background: #c0c0c0;
}

/* ============================
   全屏 iframe 樱花图集
   ============================ */
.gallery-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.02);
    transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s ease;
}

.gallery-frame.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

body.gallery-active .coin-stage,
body.gallery-active .coin-controls,
body.gallery-active .result-area,
body.gallery-active header {
    display: none;
}

/* ============================
   1314 浪漫过渡动画
   ============================ */
body.is-transitioning {
    overflow: hidden;
}

body.is-transitioning .coin-stage,
body.is-transitioning .coin-controls,
body.is-transitioning .result-area {
    filter: blur(2px);
    transition: filter 0.6s ease;
}

.romantic-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(30, 30, 40, 0.55) 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.romantic-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* 浪漫诗句 */
.romantic-poem {
    position: relative;
    z-index: 1002;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 4px;
    text-align: center;
    padding: 0 24px;
    background: linear-gradient(135deg, #ffb7c5 0%, #e2a8ff 50%, #a8d8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 4px 20px rgba(255, 183, 197, 0.35);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.romantic-poem.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* 最终光晕覆盖 */
.romantic-whitewash {
    position: absolute;
    inset: 0;
    z-index: 1001;
    background: radial-gradient(circle at center, #fff8fb 0%, #fff0f5 60%, #ffe6ee 100%);
    opacity: 0;
    transition: opacity 1.2s ease;
}

.romantic-whitewash.show {
    opacity: 1;
}

/* 过渡樱花花瓣 */
.romantic-petal {
    position: absolute;
    top: -40px;
    border-radius: 150% 0 150% 0;
    box-shadow: 0 0 4px rgba(255, 182, 193, 0.4);
    opacity: 0.85;
    transform: rotate(0deg);
    will-change: transform, opacity;
    animation-name: romantic-fall;
    animation-timing-function: linear;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes romantic-fall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.85;
    }
    25% {
        transform: translateY(25vh) translateX(20px) rotate(90deg);
    }
    50% {
        transform: translateY(50vh) translateX(-15px) rotate(180deg);
    }
    75% {
        transform: translateY(75vh) translateX(25px) rotate(270deg);
    }
    100% {
        transform: translateY(110vh) translateX(0) rotate(360deg);
        opacity: 0;
    }
}

/* ============================
   实用小工具面板
   ============================ */
.tools-panel {
    width: 100%;
    max-width: 420px;
    margin-top: 28px;
    z-index: 10;
}

.tools-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #5f6caf 0%, #4a90e2 100%);
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.28);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.tools-toggle:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 8px 22px rgba(74, 144, 226, 0.36);
}

.toggle-icon {
    font-size: 16px;
}

.toggle-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.tools-content {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: max-height 0.45s ease, opacity 0.35s ease, visibility 0.35s ease;
}

.tools-content.show {
    max-height: 800px;
    opacity: 1;
    visibility: visible;
    margin-top: 16px;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tool-card {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-title {
    font-size: 15px;
    font-weight: 700;
    color: #4a5568;
    margin: 0;
}

.tool-desc {
    font-size: 12px;
    color: #718096;
    margin: -4px 0 0;
}

.tool-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(74, 144, 226, 0.35);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    color: #4a5568;
    font-family: inherit;
    outline: none;
    resize: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.tool-input::placeholder {
    color: #a0aec0;
}

.tool-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.tool-input-small {
    padding: 8px 10px;
    text-align: center;
}

.tool-range-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-range-sep {
    color: #718096;
    font-size: 13px;
    font-weight: 600;
}

.tool-btn {
    width: 100%;
    padding: 9px 0;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #5f6caf 0%, #4a90e2 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.28);
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.tool-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.36);
}

.tool-btn-large {
    padding: 14px 0;
    font-size: 14px;
}

.tool-result {
    min-height: 22px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #4a5568;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.tool-result.show {
    opacity: 1;
    transform: translateY(0);
}

.tool-result.success {
    color: #38a169;
}

.tool-result.danger {
    color: #e53e3e;
}

.tool-result.warning {
    color: #dd6b20;
}

.tool-result.default {
    color: #4a5568;
}

/* 倒计时器专用样式 */
.countdown-display {
    font-size: 28px;
    font-weight: 700;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    text-align: center;
    color: #4a5568;
    min-height: 36px;
    margin: 4px 0;
    letter-spacing: 2px;
}

.countdown-controls {
    display: flex;
    gap: 8px;
}

.countdown-controls .tool-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 12px;
}

/* 今日运势专用样式 */
.fortune-result {
    text-align: left !important;
    padding-top: 8px;
}

.fortune-level {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 6px 0;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.fortune-level.大吉 {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.fortune-level.中吉 {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
}

.fortune-level.吉 {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.fortune-level.平 {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.fortune-level.凶 {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.fortune-intro {
    font-size: 13px;
    line-height: 1.6;
    color: #4a5568;
    margin: 8px 0;
}

.fortune-section {
    margin: 8px 0;
    font-size: 12px;
}

.fortune-section strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.fortune-good strong {
    color: #38a169;
}

.fortune-bad strong {
    color: #e53e3e;
}

.fortune-section ul {
    margin: 0;
    padding-left: 16px;
    color: #4a5568;
}

.fortune-section li {
    margin: 2px 0;
}

.fortune-tip {
    margin-top: 8px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(74, 144, 226, 0.1);
    font-size: 12px;
    font-style: italic;
    color: #718096;
    line-height: 1.5;
}

.fortune-cooldown {
    min-height: 18px;
    margin-top: 6px;
    font-size: 12px;
    text-align: center;
    color: #dd6b20;
}

.tool-btn:disabled,
.tool-btn.disabled {
    background: #a0aec0;
    cursor: not-allowed;
    box-shadow: none;
}

.tool-btn:disabled:hover,
.tool-btn.disabled:hover {
    transform: none;
    filter: none;
    box-shadow: none;
}

/* ============================
   响应式适配
   ============================ */
@media (max-width: 480px) {
    header h1 {
        font-size: 26px;
    }

    header p {
        font-size: 13px;
    }

    .coin {
        width: 80px;
        height: 80px;
    }

    .coin-face {
        font-size: 26px;
    }

    .coin-stage {
        gap: 16px;
        min-height: 130px;
    }

    .input-row {
        flex-direction: column;
    }

    #numberInput,
    #flipBtn {
        width: 100%;
    }

    .result-area {
        padding: 18px 20px;
    }

    .result-stats {
        gap: 24px;
    }

    .stat-value {
        font-size: 24px;
    }

    .romantic-poem {
        font-size: 24px;
        letter-spacing: 2px;
    }

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

    .tool-card {
        padding: 14px;
    }

    .countdown-display {
        font-size: 24px;
    }
}
