/* ===================================================================
   layout.css — 全局骨架：Header / 底部导航 / Page 壳 / Modal / Toast
   =================================================================== */

/* ===== HEADER ===== */
.app-header {
  position: fixed;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w);
  z-index: 100;
  padding-top: var(--safe-top);
  height: calc(var(--header-h) + var(--safe-top));
  background: rgba(12, 14, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
}
.app-header > * { display: flex; align-items: center; min-height: var(--header-h); }

.brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; min-height: var(--tap-min);
  min-width: 0; flex-shrink: 1; overflow: hidden;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #2fd089 0%, #1f9a64 100%);
  color: #08130d;
  flex-shrink: 0;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name {
  font-size: 17px; font-weight: 300; letter-spacing: 0.6px;
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.brand-name b { color: var(--text); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 钱包按钮（头部）*/
.wallet-pill {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.wallet-pill:active { background: var(--accent-glow); }
.wallet-pill i { font-size: 13px; }

/* ===== 语言切换 ===== */
.lang-switcher { position: relative; }
.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  padding: 0 10px; height: 34px;
  font-size: 12px;
  display: flex; align-items: center; gap: 4px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.lang-btn:active { border-color: var(--accent); color: var(--accent); }
.lang-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 200;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 130px; max-height: 60vh; overflow-y: auto;
  display: none; box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}
.lang-dropdown.open { display: block; }
.lang-item {
  padding: 0 14px; height: var(--tap-min);
  display: flex; align-items: center;
  cursor: pointer; transition: background 0.15s;
  color: var(--text2); font-size: 14px;
}
.lang-item:active { background: var(--accent-dim); color: var(--accent); }
.lang-item.active { color: var(--accent); font-weight: 600; }

/* ===== 主内容滚动区 ===== */
.app-main {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w);
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: 24px;
}

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w);
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: rgba(12, 14, 16, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-start;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h);
  color: var(--text3);
  transition: color 0.2s;
}
.nav-item i { font-size: 20px; }
.nav-item span { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; }
.nav-item.active { color: var(--accent); }

/* ===== 页头 ===== */
.page-header { padding: 18px 16px 6px; }
.page-title { font-size: 20px; font-weight: 600; color: var(--text); }
.page-subtitle { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ===== 区块标题（左侧绿条）===== */
.section-title {
  font-size: 15px; font-weight: 500; color: var(--text);
  padding: 18px 16px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 14px;
  background: var(--accent); border-radius: 2px;

  flex-shrink: 0;
}
.section-title .more {
  margin-left: auto; font-size: 12px; font-weight: 500;
  color: var(--text2); cursor: pointer;
}

/* ===== MODAL（底部弹起）===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: flex-end; justify-content: center;
  touch-action: none;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg3);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); border-bottom: none;
  width: 100%; max-width: 500px;
  padding-bottom: var(--safe-bottom);
  max-height: 85vh; max-height: 85dvh;
  display: flex; flex-direction: column;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 500; font-size: 15px; flex-shrink: 0;
}
.modal-close {
  background: none; border: none; color: var(--text2);
  cursor: pointer; font-size: 20px;
  width: var(--tap-min); height: var(--tap-min);
  display: flex; align-items: center; justify-content: center;
  margin: -8px; transition: color 0.2s;
}
.modal-close:active { color: var(--accent); }
.modal-body {
  padding: 16px 20px; flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
.modal-footer {
  display: flex; gap: 10px;
  padding: 12px 20px 16px; flex-shrink: 0;
  border-top: 1px solid var(--border); background: var(--bg3);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 10px);
  left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  background: var(--bg4); color: var(--text);
  padding: 10px 20px; border-radius: 20px; font-size: 13px;
  border: 1px solid var(--border); z-index: 500;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  text-align: center;
}
.toast.show { opacity: 1; }
.toast.success { border-color: var(--accent); color: var(--accent); }
.toast.error   { border-color: var(--red);    color: var(--red); }
