/* ===== 变量 ===== */
:root {
  --bg-deep: #050a1b;
  --bg-card: rgba(10, 20, 50, 0.55);
  --accent-cyan: #00f2ff;
  --accent-pink: #ff00aa;
  --accent-gold: #ffd700;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --border-glow: rgba(0, 242, 255, 0.6);
  --card-radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== 重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Noto Sans SC", -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== 页面容器 ===== */
.page {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  overflow: hidden;
}

/* ===== 背景 ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow--left {
  width: 280px;
  height: 280px;
  background: rgba(0, 100, 200, 0.15);
  top: -60px;
  left: -80px;
}

.bg-glow--right {
  width: 200px;
  height: 200px;
  background: rgba(255, 0, 170, 0.1);
  top: 200px;
  right: -60px;
}

.bg-wireframe {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  width: 120vw;
  max-width: 500px;
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

/* ===== 用户头部 ===== */
.user-header {
  position: relative;
  z-index: 2;
  margin-bottom: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a4a8a, #0a2a5a);
  border: 2px solid var(--border-glow);
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-emoji {
  font-size: 28px;
  line-height: 1;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-name {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent-cyan);
  background: rgba(0, 242, 255, 0.12);
  border: 1px solid rgba(0, 242, 255, 0.4);
  border-radius: 20px;
  letter-spacing: 0.05em;
}

.user-welcome {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.user-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.user-stats strong {
  color: var(--accent-gold);
  font-weight: 600;
}

/* ===== 子页面 ===== */
.page--sub {
  padding-bottom: calc(32px + var(--safe-bottom));
}

.sub-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.sub-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 255, 0.3);
  border-radius: 10px;
  background: rgba(10, 30, 60, 0.5);
}

.sub-title {
  flex: 1;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 600;
}

.sub-spacer {
  width: 36px;
  flex-shrink: 0;
}

.state-msg {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.state-msg--inline {
  padding: 20px 0;
}

.device-list {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--card-radius);
  padding: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.info-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.info-card__title {
  font-size: 1rem;
  font-weight: 600;
}

.info-card__tag {
  flex-shrink: 0;
  font-size: 0.6875rem;
  padding: 2px 8px;
  color: var(--accent-cyan);
  background: rgba(0, 242, 255, 0.1);
  border: 1px solid rgba(0, 242, 255, 0.25);
  border-radius: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-row dt {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.info-row dd {
  font-size: 0.8125rem;
  font-weight: 500;
}

.info-row--highlight dd {
  color: var(--accent-gold);
  font-weight: 600;
}

.stat-cards {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(0, 242, 255, 0.35);
  border-radius: var(--card-radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card--gold {
  border-color: rgba(255, 215, 0, 0.45);
  background: linear-gradient(135deg, rgba(30, 40, 20, 0.6), rgba(10, 20, 50, 0.55));
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.02em;
}

.section-block {
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-item {
  background: var(--bg-card);
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}

.mini-item__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-item__title {
  font-size: 0.9375rem;
  font-weight: 500;
}

.mini-item__money {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.mini-item__sub {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.mini-item__note {
  margin-top: 4px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.status-pill {
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.status-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.status-completed {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.status-rejected {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

/* ===== Hero 插画 ===== */
.hero {
  position: relative;
  z-index: 1;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.hero-illustration {
  position: relative;
  width: 200px;
  height: 160px;
}

.hero-ring {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 30px;
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 242, 255, 0.08) 0%, transparent 70%);
}

.hero-platform {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.server-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 2px;
}

.server-block {
  border-radius: 4px;
  border: 1px solid rgba(0, 242, 255, 0.5);
  background: linear-gradient(180deg, #1a3a7a 0%, #0d1f45 100%);
  position: relative;
}

.server-block::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-pink);
}

.server-block--1 { width: 72px; height: 22px; }
.server-block--2 { width: 80px; height: 24px; opacity: 0.9; }
.server-block--3 { width: 88px; height: 26px; opacity: 0.8; }

.hero-figure {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.figure-head {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8c4a0;
  border: 1px solid rgba(255,255,255,0.3);
}

.figure-body {
  width: 20px;
  height: 28px;
  margin-top: 2px;
  background: linear-gradient(180deg, #2a4a8a, #1a2a5a);
  border-radius: 4px 4px 2px 2px;
  border: 1px solid rgba(0, 242, 255, 0.3);
}

/* ===== 菜单网格 ===== */
.menu-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 12px 16px;
  min-height: 130px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--card-radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 0 0 1px rgba(0, 242, 255, 0.08) inset,
    0 4px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.menu-card:active {
  transform: scale(0.97);
  border-color: var(--accent-cyan);
  box-shadow:
    0 0 0 1px rgba(0, 242, 255, 0.2) inset,
    0 0 20px rgba(0, 242, 255, 0.15);
}

.card-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.card-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

/* ===== 页脚 ===== */
.page-footer {
  position: relative;
  z-index: 2;
  margin-top: 28px;
  text-align: center;
}

.btn-logout {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.06em;
  background: rgba(10, 30, 60, 0.5);
  border: 1px solid rgba(255, 100, 120, 0.35);
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-logout:active:not(:disabled) {
  color: #ff8a9a;
  border-color: rgba(255, 100, 120, 0.6);
  background: rgba(40, 20, 35, 0.55);
}

.btn-logout:disabled {
  opacity: 0.6;
  cursor: wait;
}

.page-footer p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.1em;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  background: rgba(10, 30, 60, 0.92);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  font-size: 0.875rem;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 大屏居中 ===== */
@media (min-width: 481px) {
  body {
    background: #020510;
  }

  .page {
    border-left: 1px solid rgba(0, 242, 255, 0.1);
    border-right: 1px solid rgba(0, 242, 255, 0.1);
    box-shadow: 0 0 60px rgba(0, 100, 200, 0.15);
  }
}
