/* ===== 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --gold: #d4a843;
    --gold-light: #f0c75e;
    --red: #c41e3a;
    --red-dark: #8b0000;
    --bg: #f5f0e8;
    --bg-card: #fffdf7;
    --text: #2c1810;
    --text-light: #6b5544;
    --border: #e0d5c0;
    --shadow: 0 2px 12px rgba(140, 100, 40, 0.1);
    --shadow-hover: 0 6px 24px rgba(140, 100, 40, 0.2);
    --radius: 12px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.container {
    max-width: 960px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-card);
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* ===== 头部 ===== */
.site-header {
    position: relative;
    padding: 48px 20px 40px;
    text-align: center;
    overflow: hidden;
}

.header-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    z-index: 0;
}

.header-bg::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

.header-content {
    position: relative;
    z-index: 1;
    color: #fff;
}

.deity-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

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

.site-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.site-subtitle {
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 2px;
}

/* ===== 导航 ===== */
.main-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.main-nav a {
    padding: 8px 14px;
    font-size: 14px;
    color: var(--text-light);
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.main-nav a:hover {
    background: var(--bg);
    color: var(--red);
}

.main-nav a.active {
    background: var(--red);
    color: #fff;
}

/* ===== 主内容 ===== */
.main-content {
    padding: 32px 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 32px;
}

.section-title h2 {
    font-size: 26px;
    color: var(--text);
    margin-bottom: 8px;
}

.section-title p {
    color: var(--text-light);
    font-size: 14px;
}

/* ===== 签种卡片 ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.type-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.type-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--card-color);
}

.type-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--card-color);
}

.card-icon {
    font-size: 36px;
    margin-right: 16px;
    flex-shrink: 0;
}

.card-body {
    flex: 1;
}

.card-body h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 4px;
}

.card-body p {
    font-size: 13px;
    color: var(--text-light);
}

.card-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    font-size: 12px;
    background: var(--card-color);
    color: #fff;
    border-radius: 10px;
}

.card-arrow {
    font-size: 20px;
    color: var(--card-color);
    margin-left: 12px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.type-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* ===== 信息区 ===== */
.info-section, .instruction-section, .disclaimer {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.info-section h3, .instruction-section h3 {
    font-size: 18px;
    color: var(--red);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gold);
}

.info-section p, .instruction-section p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 8px;
}

.disclaimer {
    background: #fff8ee;
    border-color: var(--gold-light);
}

.disclaimer h4 {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 8px;
}

.disclaimer p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.7;
}

/* ===== 抽签区域 ===== */
.draw-section {
    text-align: center;
    padding: 20px 0 40px;
}

.deity-image {
    margin-bottom: 32px;
}

.deity-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle, var(--theme-color, var(--red)) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.deity-glow {
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    border-radius: 50%;
    border: 2px solid var(--theme-color, var(--red));
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.6; }
}

.deity-emoji {
    font-size: 64px;
    animation: float 3s ease-in-out infinite;
}

.deity-name {
    margin-top: 16px;
    font-size: 18px;
    color: var(--theme-color, var(--red));
    font-weight: 600;
    letter-spacing: 2px;
}

/* ===== 抽签按钮 ===== */
.draw-button-area {
    margin-bottom: 24px;
}

.draw-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 48px;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    background: var(--btn-color, var(--red));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    letter-spacing: 2px;
}

.draw-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

.draw-button:active {
    transform: translateY(0);
}

.draw-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.draw-btn-icon {
    font-size: 24px;
}

/* ===== 圣杯区域 ===== */
.cup-area {
    margin: 24px auto;
    padding: 24px;
    max-width: 400px;
}

.cup-instruction p {
    color: var(--text);
    font-size: 16px;
}

.cup-count {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 4px;
}

.cups {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 24px 0;
    perspective: 600px;
}

.cup {
    width: 70px;
    height: 90px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.cup::before {
    content: '';
    position: absolute;
    top: 0; left: 5px; right: 5px; bottom: 0;
    border-radius: 50% 50% 8px 8px / 30% 30% 8px 8px;
    background: linear-gradient(135deg, #d4a843, #b8860b);
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2);
}

.cup::after {
    content: '';
    position: absolute;
    top: 10px; left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}

.cup.flipping {
    animation: cupFlip 0.8s ease-out;
}

@keyframes cupFlip {
    0% { transform: rotateY(0) translateY(0); }
    50% { transform: rotateY(540deg) translateY(-40px); }
    100% { transform: rotateY(1080deg) translateY(0); }
}

.cup.face-up::before {
    background: linear-gradient(135deg, #f0c75e, #d4a843);
}

.cup.face-down::before {
    background: linear-gradient(135deg, #8b6914, #5c4400);
}

.cup-result {
    min-height: 30px;
    font-size: 16px;
    font-weight: 600;
    color: var(--red);
}

.throw-cup-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 32px;
    font-size: 16px;
    color: #fff;
    background: var(--btn-color, var(--red));
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.throw-cup-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.throw-cup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 抽签动画 ===== */
.draw-animation {
    margin: 32px auto;
    text-align: center;
}

.lot-cylinder {
    width: 100px;
    height: 200px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.cylinder-body {
    width: 100%;
    height: 100%;
    position: relative;
    animation: shake 0.15s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-1deg); }
    75% { transform: translateX(3px) rotate(1deg); }
}

.lot-stick {
    position: absolute;
    width: 6px;
    height: 160px;
    left: 50%;
    margin-left: -3px;
    bottom: 20px;
    background: linear-gradient(to bottom, #d4a843, #b8860b, #8b6914);
    border-radius: 3px;
    transform-origin: bottom center;
    transform: rotate(calc(var(--i) * 15deg - 52deg));
    animation: stickShake 0.3s infinite;
    animation-delay: calc(var(--i) * 0.05s);
}

@keyframes stickShake {
    0%, 100% { transform: rotate(calc(var(--i) * 15deg - 52deg)); }
    50% { transform: rotate(calc(var(--i) * 15deg - 50deg)) translateY(-2px); }
}

.drawing-text {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-light);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== 签文结果 ===== */
.lot-result {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    margin: 24px auto;
    max-width: 560px;
    border: 2px solid var(--gold);
    box-shadow: var(--shadow-hover);
    animation: resultAppear 0.5s ease-out;
}

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

.result-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px dashed var(--gold);
}

.result-header h2 {
    font-size: 22px;
    color: var(--red);
    margin-bottom: 8px;
}

.result-header .result-title {
    font-size: 20px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 12px;
}

.result-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
}

.result-meta .fortune-tag {
    padding: 2px 16px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
}

.fortune-tag.fortune-上 { background: #4caf50; }
.fortune-tag.fortune-中 { background: #ff9800; }
.fortune-tag.fortune-下 { background: #f44336; }

.result-poem {
    text-align: center;
    margin: 24px 0;
    padding: 24px;
    background: #fff8ee;
    border-radius: 8px;
}

.result-poem p {
    font-size: 18px;
    color: var(--text);
    line-height: 2;
    font-family: "KaiTi", "STKaiti", serif;
}

.result-section {
    margin-bottom: 20px;
}

.result-section h4 {
    font-size: 16px;
    color: var(--red);
    margin-bottom: 8px;
}

.result-section p {
    font-size: 14px;
    color: var(--text-light);
}

.result-actions {
    text-align: center;
    margin-top: 24px;
}

.result-actions a {
    display: inline-block;
    padding: 10px 32px;
    background: var(--red);
    color: #fff;
    border-radius: 30px;
    font-size: 15px;
    transition: all 0.2s;
}

.result-actions a:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.result-actions .btn-secondary {
    background: var(--text-light);
    margin-left: 8px;
}

/* ===== 签文列表 ===== */
.lot-list-section {
    margin-top: 40px;
}

.lot-list-section h3 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}

.lot-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.lot-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.lot-item:hover {
    border-color: var(--red);
    background: #fff8ee;
    transform: translateX(4px);
}

.lot-item.current {
    background: #fff8ee;
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(212,168,67,0.2);
}

.lot-num {
    color: var(--text-light);
    white-space: nowrap;
}

.lot-title {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lot-fortune {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 8px;
    color: #fff;
    white-space: nowrap;
}

.fortune-上 .lot-fortune, .lot-item.fortune-上 .lot-fortune { background: #4caf50; }
.fortune-中 .lot-fortune, .lot-item.fortune-中 .lot-fortune { background: #ff9800; }
.fortune-下 .lot-fortune, .lot-item.fortune-下 .lot-fortune { background: #f44336; }

/* ===== 签文详情页 ===== */
.lot-detail {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.lot-detail-header {
    text-align: center;
    padding: 32px 24px;
    border-bottom: 3px solid var(--gold);
}

.lot-detail-header.fortune-上 { background: linear-gradient(180deg, #e8f5e9, #fff); }
.lot-detail-header.fortune-中 { background: linear-gradient(180deg, #fff3e0, #fff); }
.lot-detail-header.fortune-下 { background: linear-gradient(180deg, #ffebee, #fff); }

.lot-detail-header h2 {
    font-size: 20px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.lot-detail-title {
    font-size: 28px;
    color: var(--text);
    font-weight: 700;
    margin-bottom: 16px;
    font-family: "KaiTi", "STKaiti", serif;
}

.lot-meta {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.meta-item {
    font-size: 14px;
    color: var(--text-light);
}

.fortune-badge {
    padding: 2px 16px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
}

.fortune-badge.fortune-上 { background: #4caf50; }
.fortune-badge.fortune-中 { background: #ff9800; }
.fortune-badge.fortune-下 { background: #f44336; }

.lot-poem-section, .lot-section {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.lot-poem-section h4, .lot-section h4 {
    font-size: 16px;
    color: var(--red);
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 3px solid var(--gold);
}

.lot-poem {
    text-align: center;
    padding: 20px;
    background: #fff8ee;
    border-radius: 8px;
}

.lot-poem p {
    font-size: 20px;
    line-height: 2.2;
    color: var(--text);
    font-family: "KaiTi", "STKaiti", serif;
}

.poem-variant {
    margin-top: 16px;
}

.poem-variant summary {
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    padding: 8px;
}

.poem-variant .lot-poem {
    margin-top: 8px;
}

.lot-section p {
    font-size: 15px;
    color: var(--text);
    line-height: 2;
}

.lot-story {
    text-indent: 2em;
}

.shengyi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.shengyi-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f9f5ef;
    border-radius: 6px;
    font-size: 14px;
}

.shengyi-label {
    color: var(--text-light);
    font-weight: 600;
}

.shengyi-value {
    color: var(--text);
}

.cultural-note {
    background: #fff8ee;
}

.cultural-note ul {
    margin: 12px 0;
    padding-left: 20px;
}

.cultural-note li {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-light);
}

/* ===== 翻页 ===== */
.lot-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-btn.prev, .nav-btn.next {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.nav-btn.prev:hover, .nav-btn.next:hover {
    border-color: var(--red);
    color: var(--red);
}

.nav-btn.center {
    background: var(--red);
    color: #fff;
}

.nav-btn.center:hover {
    opacity: 0.9;
}

/* ===== 底部 ===== */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    background: #2c1810;
    color: #d4b896;
    font-size: 14px;
}

.site-footer a {
    color: var(--gold-light);
}

.site-footer a:hover {
    text-decoration: underline;
}

.footer-note {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.7;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .site-title { font-size: 24px; }
    .card-grid { grid-template-columns: 1fr; }
    .lot-list-grid { grid-template-columns: 1fr; }
    .main-content { padding: 20px 12px; }
    .draw-button { padding: 14px 32px; font-size: 18px; }
    .lot-detail-title { font-size: 22px; }
    .lot-poem p { font-size: 18px; }
    .main-nav { gap: 2px; }
    .main-nav a { padding: 6px 10px; font-size: 13px; }
    .lot-nav { flex-direction: column; }
    .shengyi-grid { grid-template-columns: repeat(2, 1fr); }
}
