/* ============================================
   祝福网 - 全局样式
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow: hidden; width: 100%; height: 100%; }

@font-face {
    font-family: 'WishFont';
    src: local('华文行楷'), local('STXingkai'), local('KaiTi'), local('楷体');
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
    color: #fff;
    background: #0a0a18;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,215,0,0.5); }

/* ========== 顶部导航 ========== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(10,10,24,0.85) 0%, rgba(10,10,24,0) 100%);
    pointer-events: none;
}
.top-bar > * { pointer-events: auto; }

.logo {
    font-size: 22px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255,215,0,0.3);
    letter-spacing: 4px;
    font-family: 'WishFont', 'STXingkai', 'KaiTi', serif;
}

.top-actions { display: flex; align-items: center; gap: 12px; }

.top-actions a, .top-actions .btn-login {
    color: #FFD700;
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s;
    border: 1px solid rgba(255,215,0,0.3);
    background: rgba(255,215,0,0.05);
}
.top-actions a:hover, .top-actions .btn-login:hover {
    background: rgba(255,215,0,0.15);
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255,215,0,0.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFD700;
    font-size: 14px;
}
.user-info .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    display: flex; align-items: center; justify-content: center;
    color: #1a1a2e; font-weight: bold; font-size: 14px;
}
.user-info .logout-btn {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.3s;
}
.user-info .logout-btn:hover { color: #ff6b6b; }

/* ========== 搜索 ========== */
.search-box {
    display: flex;
    align-items: center;
    gap: 4px;
}
.search-input {
    width: 100px;
    padding: 5px 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    outline: none;
    transition: width 0.3s, border-color 0.3s;
}
.search-input:focus {
    width: 160px;
    border-color: #FFD700;
}
.search-input::placeholder { color: rgba(255,255,255,0.3); }
.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    line-height: 1;
}
.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    padding: 2px;
}

/* ========== 左侧统计 ========== */
.side-stats {
    position: fixed;
    left: 10px;
    top: 56px;
    writing-mode: vertical-rl;
    letter-spacing: 4px;
    color: #FFD700;
    font-size: 12px;
    z-index: 30;
    pointer-events: none;
    font-family: 'SimSun', '宋体', serif;
    background: rgba(0,0,0,0.4);
    padding: 6px 3px;
    border-radius: 4px;
}

/* ========== 许愿树容器 ========== */
.tree-container {
    width: 100vw;
    height: 100vh;
    background: #0a0a18;
    position: relative;
}

.tree-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    background: url('/back.jpg') no-repeat center center;
    background-size: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    z-index: 1;
}

/* ========== 吊牌 ========== */
.tag-wrapper {
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    z-index: 10;
    transform-origin: top center;
}
.tag-wrapper:hover {
    transform: scale(1.1) !important;
    z-index: 50;
    filter: brightness(1.2);
}

.tag-inner {
    position: relative;
    width: 27px;
    height: 120px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: top center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-style-0 .tag-inner {
    background-image: url('/diaopai.png');
    filter: brightness(1.15) contrast(1.1);
}
.tag-style-1 .tag-inner {
    background-image: url('/diaopai2.png');
    filter: brightness(1.1) contrast(1.05);
}

.tag-style-0 .tag-text {
    color: #CC8800;
    text-shadow: 0 0 8px rgba(255,255,255,0.6), 0 0 3px rgba(255,255,255,0.3);
}
.tag-style-0 .tag-text.name-mode {
    color: #333;
    text-shadow: 0 0 8px rgba(255,255,255,0.5), 0 0 3px rgba(255,255,255,0.2);
}

.tag-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: -1px;
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.5), 0 0 2px #000;
    padding-top: 6px;
    padding-bottom: 12px;
    line-height: 1.3;
    user-select: none;
    font-family: 'KaiTi', 'STKaiti', '楷体', '华文楷体', serif;
}

.tag-text.name-mode {
    font-size: 13px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.5), 0 0 2px #000;
}

.tag-private {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    color: rgba(255,215,0,0.6);
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

/* 摇摆动画 */
@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(6deg); }
    75% { transform: rotate(-6deg); }
}
.tag-wrapper.swaying {
    animation: sway 6s ease-in-out infinite;
}
.tag-wrapper.swaying:nth-child(odd) { animation-delay: -0.5s; }
.tag-wrapper.swaying:nth-child(3n) { animation-delay: -1.2s; }
.tag-wrapper.swaying:nth-child(5n+2) { animation-delay: -2s; }

/* ========== 浮动添加按钮 ========== */
.btn-add-wish {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 90;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    color: #1a1a2e;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255,215,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    animation: btnPulse 2s ease-in-out infinite;
}
.btn-add-wish:hover {
    transform: translateY(-50%) scale(1.15) rotate(90deg);
    box-shadow: 0 6px 30px rgba(255,215,0,0.6);
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,215,0,0.3); }
    50% { box-shadow: 0 4px 35px rgba(255,215,0,0.6), 0 0 15px rgba(255,215,0,0.2); }
}

/* ========== 弹窗通用 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: linear-gradient(145deg, rgba(20,20,45,0.98), rgba(10,10,30,0.98));
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 20px;
    padding: 36px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease;
    box-shadow: 0 0 60px rgba(255,215,0,0.05);
}

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

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
}
.modal-close:hover { color: #FFD700; }

.modal-title {
    color: #FFD700;
    font-size: 22px;
    text-align: center;
    margin-bottom: 24px;
    font-family: 'WishFont', 'STXingkai', 'KaiTi', serif;
    letter-spacing: 2px;
}

/* ========== 发愿表单 ========== */
.form-section { margin-bottom: 20px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-compact { margin-bottom: 12px; }

.form-label {
    display: block;
    color: #aaa;
    font-size: 12px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.form-label em { color: #FFD700; font-style: normal; }

.form-label2 {
    color: #aaa;
    font-size: 12px;
    letter-spacing: 1px;
}
.form-label2 strong {
    color: #FFD700;
    font-weight: normal;
}

/* 行内排列 */
.inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.inline-label {
    color: #aaa;
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
    width: 5em;
}
.inline-label em { color: #FFD700; font-style: normal; }
.inline-select {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
}
.inline-select:focus { border-color: #FFD700; }
.inline-select:disabled { opacity: 0.35; cursor: not-allowed; }
.inline-select option { background: #1a1a2e; color: #fff; }

/* 下拉选择框 */
.wish-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
}
.wish-select:focus { border-color: #FFD700; }
.wish-select:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.wish-select option {
    background: #1a1a2e;
    color: #fff;
    padding: 8px;
}

/* 显示选项 */
.radio-group {
    display: flex;
    gap: 10px;
}
.radio-option {
    flex: 1;
    padding: 8px 8px;
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    color: #ccc;
    background: rgba(255,255,255,0.02);
}
.radio-option:hover { border-color: rgba(255,215,0,0.4); }
.radio-option.active {
    border-color: #FFD700;
    background: rgba(255,215,0,0.1);
    color: #FFD700;
}
.radio-option .radio-icon { font-size: 13px; margin-right: 3px; }

.radio-small { padding: 5px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.radio-small .radio-icon { font-size: 13px; }

/* ========== 祝福类型选择 ========== */
.wish-type-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.type-option {
    flex: 1;
    min-width: 60px;
    padding: 6px 4px;
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255,255,255,0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.type-option:hover { border-color: rgba(255,215,0,0.4); }
.type-option.active {
    border-color: #FFD700;
    background: rgba(255,215,0,0.1);
}
.type-option .type-name { color: #ccc; font-size: 13px; }
.type-option .type-price { color: #FFD700; font-size: 11px; }
.type-option.active .type-name { color: #FFD700; }
.type-option .type-desc { color: rgba(255,255,255,0.25); font-size: 10px; margin-top: 2px; }

/* ========== 气球（JS动画） ========== */
#kmdContainer {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 20;
}
.balloon-js {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.8;
    animation: balloonSway 3s ease-in-out infinite;
}

@keyframes balloonSway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
}
.balloon-js:hover .balloon-body {
    filter: brightness(1.15);
}
.balloon-js:hover .balloon-body::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50% 50% 50% 50%;
    background: inherit;
    animation: ghostPulse 1s ease-out infinite;
    pointer-events: none;
}

@keyframes ghostPulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}
.balloon-js .balloon-body {
    border-radius: 50% 50% 50% 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.15), 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    transition: transform 0.3s, filter 0.3s;
}
.balloon-js .balloon-body::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 18px;
    width: 12px;
    height: 18px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: rotate(-30deg);
}
.balloon-js .balloon-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 2px;
    white-space: nowrap;
    word-break: keep-all;
}
.balloon-js .balloon-knot {
    width: 8px;
    height: 8px;
    margin: -1px 0 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.balloon-js .balloon-string {
    width: 1px;
    height: 35px;
    background: rgba(255,255,255,0.25);
}

/* 私密选项 */
.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #aaa;
    font-size: 12px;
}
.privacy-toggle input { display: none; }
.toggle-switch {
    width: 44px;
    height: 24px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: transform 0.3s;
}
.privacy-toggle input:checked + .toggle-switch { background: rgba(255,215,0,0.5); }
.privacy-toggle input:checked + .toggle-switch::after { transform: translateX(20px); background: #FFD700; }

/* 祝福语输入 */
textarea.wish-message {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    max-height: 160px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}
textarea.wish-message:focus { border-color: #FFD700; }
textarea.wish-message::placeholder { color: rgba(255,255,255,0.25); }

.char-count {
    text-align: right;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
}
.char-count.over { color: #ff6b6b; }

/* 提交按钮 */
.btn-submit-wish {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    border-radius: 12px;
    color: #1a1a2e;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 3px;
    margin-top: 8px;
}
.btn-submit-wish:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255,215,0,0.3);
}
.btn-submit-wish:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== 许愿详情弹窗 ========== */
.wish-detail-box { text-align: center; }
.detail-header {
    color: rgba(255,215,0,0.5);
    font-size: 13px;
    margin-bottom: 12px;
    letter-spacing: 2px;
}
.detail-wish-label {
    font-size: 26px;
    color: #FFD700;
    margin-bottom: 20px;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 4px;
}
.detail-message {
    font-size: 18px;
    color: #fff;
    line-height: 1.8;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,215,0,0.1);
    margin-bottom: 20px;
    word-break: break-all;
    min-height: 60px;
}
.detail-footer {
    color: rgba(255,255,255,0.35);
    font-size: 13px;
    letter-spacing: 1px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}
.detail-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    letter-spacing: 1px;
}
.btn-boost {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
}
.btn-boost:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255,215,0,0.3);
}
.btn-fulfill {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.15) !important;
}
.btn-fulfill:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* ========== 空状态 ========== */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255,255,255,0.2);
    pointer-events: none;
    z-index: 1;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 16px; letter-spacing: 2px; }

/* ========== Toast 提示 ========== */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    animation: toastIn 0.4s ease, toastOut 0.4s ease 2.6s forwards;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}
.toast-success { background: rgba(50,200,50,0.2); border: 1px solid rgba(50,200,50,0.3); color: #6bff6b; }
.toast-error { background: rgba(255,50,50,0.2); border: 1px solid rgba(255,50,50,0.3); color: #ff6b6b; }
.toast-info { background: rgba(255,215,0,0.2); border: 1px solid rgba(255,215,0,0.3); color: #FFD700; }

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

/* ========== 底部信息 ========== */
.site-footer {
    position: fixed;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    z-index: 35;
    pointer-events: none;
    letter-spacing: 0.5px;
    line-height: 1;
    background: rgba(0,0,0,0.35);
    padding: 3px 8px;
    display: inline-block;
    width: auto;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 4px;
    white-space: nowrap;
}
.site-footer a {
    color: rgba(255,215,0,0.6);
    text-decoration: none;
    pointer-events: auto;
}
.site-footer a:hover {
    color: rgba(255,215,0,0.9);
}

/* ========== 分页 ========== */
.pagination {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 30;
    pointer-events: none;
    padding: 10px 0;
}
.pagination > * { pointer-events: auto; }
.page-btn {
    display: inline-block;
    min-width: 34px;
    height: 34px;
    line-height: 34px;
    padding: 0 8px;
    margin: 0 2px;
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 6px;
    background: rgba(10,10,24,0.6);
    backdrop-filter: blur(4px);
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.page-btn:hover { background: rgba(255,215,0,0.15); border-color: rgba(255,215,0,0.4); color: #FFD700; }
.page-btn.active { background: rgba(255,215,0,0.2); border-color: #FFD700; color: #FFD700; font-weight: bold; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-ellipsis { display: inline-block; width: 24px; color: rgba(255,255,255,0.3); font-size: 14px; vertical-align: middle; }
.page-info { display: inline-block; margin-left: 8px; color: rgba(255,255,255,0.3); font-size: 12px; vertical-align: middle; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .top-bar { padding: 10px 16px; }
    .logo { font-size: 18px; letter-spacing: 2px; }
    .tag-inner { width: 21px; height: 93px; }
    .tag-text { font-size: 11px; padding-top: 4px; }
    .tag-text.name-mode { font-size: 10px; }
    .modal-box { padding: 24px; }
    .btn-add-wish { right: 10px; width: 44px; height: 44px; font-size: 22px; }
    .search-input:focus { width: 120px; }
}

@media (max-width: 480px) {
    .radio-group { flex-direction: column; gap: 6px; }
    .tag-inner { width: 17px; height: 73px; }
    .tag-text { font-size: 10px; padding-top: 3px; letter-spacing: 0px; }
    .tag-text.name-mode { font-size: 9px; }
}
