/* 移动端 Web 框架 — Cooler Neo */

:root {
    --color-bg: #060a10;
    --color-bg-soft: #0b111a;
    --color-surface: #121a26;
    --color-surface-2: #182230;
    --color-border: rgba(148, 163, 184, 0.12);
    --color-border-strong: rgba(251, 191, 36, 0.28);
    --color-text: #e8eef4;
    --color-text-muted: #8494a7;
    --color-primary: #fbbf24;
    --color-primary-dim: rgba(251, 191, 36, 0.14);
    --color-secondary: #60a5fa;
    --color-secondary-dim: rgba(96, 165, 250, 0.14);
    --color-accent: #fbbf24;
    --color-success: #34d399;
    --color-danger: #f87171;
    --color-primary-rgb: 251, 191, 36;
    --color-secondary-rgb: 96, 165, 250;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.32);
    --header-height: 56px;
    --tabbar-height: 66px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tap-min: 48px;
    --line-body: 1.55;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 17px;
    line-height: var(--line-body);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    height: 100%;
    margin: 0 auto;
    background: var(--color-bg);
}

.app-header {
    flex-shrink: 0;
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-strong);
    position: relative;
    z-index: 10;
}

.app-back[hidden] {
    display: none !important;
}

.app-header:not(.app-header--sub) .app-back {
    display: none !important;
}

.app-back {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.app-back svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    max-width: calc(100% - 96px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-page {
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tab-page::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.tab-page.active {
    display: block;
}

.page-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    color: var(--color-text-muted);
    text-align: center;
    gap: 8px;
}

.page-placeholder-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--color-surface);
    border: 1px solid rgba(251, 191, 36, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 8px;
}

.page-placeholder-text {
    font-size: 17px;
}

.app-tabbar {
    flex-shrink: 0;
    display: flex;
    height: calc(var(--tabbar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: #0a1018;
    border-top: 1px solid var(--color-border-strong);
    z-index: 10;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
    cursor: pointer;
    user-select: none;
    min-height: var(--tap-min);
}

.tab-item.active {
    color: var(--color-primary);
}

.tab-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-item-icon svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.tab-item.active .tab-item-icon {
    color: var(--color-primary);
}

/* —— AppUI 自定义弹层 / Toast —— */
body.app-dialog-open {
    overflow: hidden;
}

.app-dialog-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.app-dialog-root[hidden] {
    display: none !important;
}

.app-dialog-root.is-open {
    opacity: 1;
    pointer-events: auto;
}

.app-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.app-dialog {
    position: relative;
    width: 100%;
    max-width: 320px;
    padding: 22px 20px 16px;
    border-radius: 18px;
    background: linear-gradient(165deg, #182230 0%, #0a1018 100%);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    transform: translateY(12px) scale(0.96);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.app-dialog-root.is-open .app-dialog {
    transform: translateY(0) scale(1);
}

.app-dialog-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    width: 180px;
    height: 180px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(251, 191, 36, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.app-dialog-title {
    position: relative;
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--color-text);
}

.app-dialog-message {
    position: relative;
    margin: 0;
    font-size: 17px;
    line-height: 1.55;
    color: var(--color-text-muted);
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
}

.app-dialog-message[hidden] {
    display: none !important;
}

.app-dialog-field {
    position: relative;
    margin-top: 16px;
}

.app-dialog-field[hidden] {
    display: none !important;
}

.app-dialog-input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.25);
    background: #060a10;
    color: var(--color-text);
    font-size: 19px;
    outline: none;
    transition: border-color 0.2s;
}

.app-dialog-input:focus {
    border-color: rgba(251, 191, 36, 0.7);
}

.app-dialog-actions {
    position: relative;
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.app-dialog-btn {
    flex: 1;
    height: 52px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, background 0.15s, opacity 0.15s;
}

.app-dialog-btn:active {
    transform: scale(0.97);
}

.app-dialog-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-muted);
}

.app-dialog-btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #f59e0b 100%);
    color: #1a1408;
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.22);
}

.app-toast-host {
    position: fixed;
    left: 50%;
    top: calc(12px + env(safe-area-inset-top, 0px));
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(88%, 340px);
    pointer-events: none;
}

.app-toast {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 17px;
    line-height: 1.5;
    text-align: center;
    color: #fff;
    background: rgba(26, 26, 32, 0.94);
    border: 1px solid rgba(251, 191, 36, 0.25);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.is-show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast--success {
    border-color: rgba(251, 191, 36, 0.45);
}

.app-toast--error {
    border-color: rgba(220, 80, 80, 0.55);
    background: rgba(40, 18, 18, 0.96);
}

.app-toast--info {
    border-color: rgba(255, 255, 255, 0.12);
}

.app-avatar-fallback {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(145deg, #1e2936, #121a26);
}

/* —— 通用区块 / 卡片 / 空态 —— */
.ui-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ui-section-bar {
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    flex-shrink: 0;
}

.ui-section-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--color-text);
}

.ui-section-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.ui-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    box-sizing: border-box;
}

.ui-card-accent {
    border-left: 3px solid var(--color-primary);
}

.ui-empty-state {
    text-align: center;
    padding: 36px 20px;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
    box-sizing: border-box;
}

.ui-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--color-primary-dim);
    border: 1px solid var(--color-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ui-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.ui-empty-sub {
    font-size: 13px;
    color: var(--color-text-muted);
}

.ui-btn-primary {
    margin-top: 16px;
    min-width: 140px;
    height: 38px;
    padding: 0 20px;
    border: none;
    border-radius: 19px;
    background: linear-gradient(135deg, var(--color-primary), #f59e0b);
    color: #1a1408;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
}

/* —— 骨架屏（四 Tab 共用） —— */
@keyframes sk-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.sk {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(251, 191, 36, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: sk-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.sk-wrap {
    padding: 12px 0;
    box-sizing: border-box;
}

.sk-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.sk-line {
    height: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.sk-line-title { height: 16px; width: 62%; }
.sk-line-sm { width: 36%; }
.sk-line-md { width: 68%; }
.sk-line-lg { width: 90%; }
.sk-row { display: flex; align-items: center; gap: 10px; }
.sk-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.sk-badge { width: 52px; height: 22px; border-radius: 999px; flex-shrink: 0; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.sk-avatar-lg { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; }
.sk-grow { flex: 1; min-width: 0; }
.sk-gap-lg { margin-bottom: 14px; }
