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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f8f9fa;
    color: #333;
    overflow: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

.webapp-bg {
    background: #f8f9fa;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    position: absolute;
    inset: 0;
    background: #f8f9fa;
}

.screen.active {
    display: flex;
}

/* Header */
.wa-header {
    background: #fff;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    gap: 10px;
}

.wa-header.center-title {
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.header-title-text {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 17px;
    margin-right: 32px;
}

.wa-search {
    flex: 1;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 8px 15px;
    color: #999;
    font-size: 14px;
}

.header-action {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

.wa-marquee {
    background: #fff3cd;
    color: #856404;
    padding: 8px 15px;
    font-size: 12px;
    flex-shrink: 0;
}

.wa-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 70px;
}

/* Tab bar */
.wa-tabbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 11px;
    color: #888;
    z-index: 100;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px 12px;
}

.tab-item.active {
    color: #0088cc;
    font-weight: bold;
}

.tab-icon {
    font-size: 20px;
}

/* Buttons */
.wa-btn {
    background: #0088cc;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.wa-btn.red { background: #d32f2f; }
.wa-btn.blue { background: #0277bd; }
.wa-btn.small { padding: 6px 12px; font-size: 12px; }

.btn-large {
    width: 100%;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: bold;
    font-size: 15px;
    padding: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 136, 204, 0.3);
}

.btn-outline {
    width: 100%;
    background: transparent;
    color: #0088cc;
    border: 1px solid #0088cc;
    border-radius: 24px;
    font-weight: bold;
    font-size: 15px;
    padding: 12px;
    cursor: pointer;
    margin-top: 10px;
}

.back-btn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.back-btn.light {
    background: #f0f2f5;
}

.leave-btn {
    background: #ffebee;
    color: #c62828;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.hidden { display: none !important; }

/* Loading */
.loading-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading-icon {
    font-size: 48px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-title {
    font-size: 22px;
    font-weight: bold;
}

.loading-desc {
    color: #888;
    font-size: 14px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Match page */
.match-content {
    flex: 1;
    padding: 30px 20px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.match-hero {
    text-align: center;
    margin: 30px 0;
}

.match-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0088cc, #0055a4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(0, 136, 204, 0.3);
    transition: transform 0.3s;
}

.match-circle.searching {
    animation: spin-pulse 1.5s ease-in-out infinite;
}

@keyframes spin-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.05) rotate(10deg); }
}

.match-status-text {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    max-width: 280px;
    margin: 0 auto;
}

.match-tips {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tip-item {
    padding: 8px 0;
    font-size: 14px;
    color: #555;
    border-bottom: 1px dashed #eee;
}

.tip-item:last-child { border-bottom: none; }

.match-btn { max-width: 320px; }

/* Chat list */
.chat-item {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e91e63, #9c27b0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.chat-item-body { flex: 1; min-width: 0; }

.chat-item-name {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 4px;
}

.chat-item-preview {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 11px;
    color: #bbb;
    flex-shrink: 0;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    text-align: center;
    width: 80%;
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-weight: bold; font-size: 18px; margin-bottom: 8px; }
.empty-desc { color: #888; font-size: 14px; margin-bottom: 20px; }

/* Chat room */
.chat-room-header {
    background: #fff;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.chat-partner-info { flex: 1; }

.chat-partner-name {
    font-weight: bold;
    font-size: 16px;
}

.chat-partner-sub {
    font-size: 12px;
    color: #4caf50;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #eef1f5;
}

.msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
}

.msg-bubble.mine {
    align-self: flex-end;
    background: #0088cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-bubble.theirs {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.msg-bubble.system {
    align-self: center;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    font-size: 12px;
    max-width: 90%;
    text-align: center;
}

.msg-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
}

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.chat-input-bar input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 15px;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: #0088cc;
}

.chat-input-bar button {
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 18px;
    font-weight: bold;
    cursor: pointer;
}

/* Profile */
.profile-hero {
    background: linear-gradient(135deg, #0088cc, #0055a4);
    padding: 40px 20px 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.avatar {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}

.profile-sub {
    font-size: 13px;
    opacity: 0.9;
}

.asset-card {
    display: flex;
    margin: -20px 15px 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.asset-col {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
}

.asset-col + .asset-col {
    border-left: 1px solid #eee;
}

.red-track { background: #fffafb; }
.blue-track { background: #f0faff; }

.asset-name {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.asset-val {
    font-size: 18px;
    font-weight: bold;
    margin: 5px 0;
}

.asset-val.red { color: #c62828; }
.asset-val.blue { color: #0088cc; }

.asset-val span {
    font-size: 11px;
    color: #999;
    font-weight: normal;
}

.asset-note {
    font-size: 10px;
    color: #999;
    margin-bottom: 10px;
}

.asset-col .wa-btn {
    width: 100%;
    font-size: 11px;
    padding: 8px 4px;
}

.profile-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px;
}

.list-group {
    background: #fff;
    border-radius: 12px;
    margin: 0 15px 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.list-group-title {
    padding: 12px 15px 8px;
    font-size: 13px;
    color: #999;
    font-weight: bold;
}

.list-item {
    padding: 14px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.list-item:last-child { border-bottom: none; }
.list-item.muted { color: #999; justify-content: center; }

.list-item span:last-child {
    color: #666;
    max-width: 55%;
    text-align: right;
    word-break: break-all;
}

.list-item.editable {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.edit-row {
    display: flex;
    gap: 8px;
}

.edit-row input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
}

/* Recharge */
.recharge-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.recharge-balance {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    font-size: 15px;
}

.recharge-balance strong {
    color: #c62828;
    font-size: 22px;
}

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

.package-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.package-card:active {
    transform: scale(0.97);
}

.package-card.hot {
    border-color: #e91e63;
    position: relative;
}

.package-card.hot::before {
    content: "热门";
    position: absolute;
    top: -1px;
    right: 10px;
    background: #e91e63;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 0 0 8px 8px;
}

.package-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}

.package-stars {
    font-size: 24px;
    font-weight: bold;
    color: #c62828;
    margin-bottom: 4px;
}

.package-bonus {
    font-size: 12px;
    color: #4caf50;
    margin-bottom: 8px;
    min-height: 18px;
}

.package-price {
    font-size: 14px;
    color: #666;
}

.order-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.order-item:last-child { border-bottom: none; }

.order-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.order-status {
    color: #4caf50;
    font-size: 12px;
}

.order-status.pending { color: #ff9800; }
.order-status.expired { color: #999; }

/* Payment screen */
.payment-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.payment-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.payment-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.payment-amount {
    font-size: 32px;
    font-weight: bold;
    color: #c62828;
    margin-bottom: 8px;
}

.payment-stars {
    font-size: 15px;
    color: #0088cc;
    font-weight: bold;
}

.payment-address {
    font-size: 12px;
    word-break: break-all;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    color: #333;
    line-height: 1.6;
}

.copy-btn {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
}

.copy-btn.outline {
    background: transparent;
    border: 1px solid #0088cc;
    color: #0088cc;
}

.payment-countdown {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.payment-countdown span {
    color: #c62828;
    font-weight: bold;
}

.payment-status {
    text-align: center;
    padding: 12px;
    background: #fff3cd;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    margin-bottom: 15px;
}

.payment-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.payment-note {
    font-size: 12px;
    color: #999;
    line-height: 1.8;
    padding: 0 10px;
}

/* 三级系统 UI */
.header-title-text.full { flex: 1; text-align: center; font-weight: bold; font-size: 17px; }

.province-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.province-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 16px;
    background: #f0f2f5;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    border: none;
}

.province-chip.active {
    background: #0088cc;
    color: #fff;
    font-weight: bold;
}

.profile-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
}

.profile-card-cover {
    height: 160px;
    background: linear-gradient(135deg, #fce4ec, #e3f2fd);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 10px;
}

.profile-card-cover .loc {
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.profile-card-body { padding: 12px; }

.profile-card-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.profile-card-title { font-size: 13px; color: #888; margin-bottom: 8px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

.info-tag {
    font-size: 12px;
    background: #ffebee;
    color: #c62828;
    padding: 3px 8px;
    border-radius: 4px;
}

.detail-hero {
    height: 240px;
    background: #222 center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    flex-shrink: 0;
}

.detail-back {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}

.detail-panel {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

.info-panel {
    padding: 20px;
    background: #fff;
    border-radius: 20px 20px 0 0;
    margin-top: -16px;
    position: relative;
}

.info-title { font-size: 22px; font-weight: bold; margin-bottom: 6px; }

.bottom-action-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
    z-index: 50;
}

#screen-detail { background: #fff; }

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.gallery-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    background: #eee;
}

.video-box { margin-top: 12px; }

.video-box video { width: 100%; border-radius: 8px; max-height: 240px; }

.form-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 80px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    box-sizing: border-box;
}

.btn-outline.danger {
    margin-top: 12px;
    color: #c62828;
    border-color: #c62828;
}

.admin-item {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.admin-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.admin-item-name { font-weight: bold; font-size: 15px; }

.admin-item-meta { font-size: 12px; color: #888; margin-bottom: 10px; }

.admin-item-actions { display: flex; gap: 8px; }

.asset-col.full { flex: 1; border: none !important; }

.role-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.25);
}

.user-role-row {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.user-role-row select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.wa-header .wa-btn.small { flex-shrink: 0; }

.profile-card-tags { font-size: 12px; color: #e91e63; }

