:root {
  --bg-canvas: #0b0f17;
  --bg-screen: #0f172a;
  --bg-card: #1e293b;
  --bg-card-active: #172554;
  --bg-keypad: #0b1120;
  --bg-key-num: #1e293b;
  --bg-key-fn: #334155;
  --brand-primary: #3b82f6;
  --brand-light: #60a5fa;
  --accent-cyan: #38bdf8;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --status-online: #10b981;
  --status-offline: #f59e0b;
  --border-subtle: #334155;
  --radius-screen: 44px;
  --radius-card: 18px;
  --radius-key: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "PingFang SC", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 桌面端展示为 iPhone 16 Pro 外框预览；iPhone 真机全屏铺满 */
.app-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-screen);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 500px) and (min-height: 720px) {
  .phone-shell {
    width: 393px;
    height: 852px;
    max-height: 95vh;
    border-radius: var(--radius-screen);
    border: 2px solid var(--border-subtle);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65), 0 0 0 8px #070b12;
  }
}

/* 顶部状态栏与灵动岛（桌面预览显示，iPhone 真机由系统原生状态栏接管） */
.ios-status-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 4px;
  font-size: 13px;
  font-weight: 600;
}

@media (min-width: 500px) {
  .ios-status-bar {
    display: flex;
  }
}

.dynamic-island {
  min-width: 132px;
  height: 30px;
  padding: 0 12px;
  border-radius: 99px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--status-online);
  letter-spacing: 0.2px;
  transition: color 0.2s ease;
}

.dynamic-island.is-offline {
  color: var(--status-offline);
}

/* 顶部工具栏 */
.header-section {
  padding: 10px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rate-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: var(--status-online);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rate-status-badge:active {
  transform: scale(0.97);
}

.rate-status-badge.is-offline {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--status-offline);
}

.rate-status-badge svg.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.pill-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.pill-action-btn:active {
  transform: scale(0.96);
  background: var(--bg-key-fn);
}

/* 货币卡片列表区 */
.currency-list-section {
  flex: 1;
  min-height: 0;
  padding: 4px 16px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.currency-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}

.currency-cards-stack::-webkit-scrollbar {
  display: none;
}

.currency-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s ease;
}

.currency-card:active {
  transform: scale(0.99);
}

.currency-card.is-active {
  background: var(--bg-card-active);
  border: 2px solid var(--brand-primary);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.22);
}

.card-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.flag-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.currency-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.code-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 3px;
  margin-left: -3px;
  border-radius: 6px;
}

.code-selector-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.role-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-key-fn);
  color: var(--text-primary);
  white-space: nowrap;
}

.currency-card.is-active .role-tag {
  background: #2563eb;
}

.role-tag.is-taxfree {
  background: #059669;
}

.currency-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-left: 8px;
  flex-shrink: 0;
}

.currency-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.currency-card.is-active .currency-amount {
  font-size: 24px;
}

.currency-amount.is-highlight {
  color: var(--accent-cyan);
}

.currency-amount.is-taxfree-highlight {
  color: #34d399;
}

.currency-right-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* 快捷操作胶囊栏 */
.quick-actions-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 2px;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.quick-btn:active {
  transform: scale(0.96);
}

.quick-btn.is-swap {
  flex: 1;
  background: rgba(30, 58, 138, 0.5);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--brand-light);
  font-weight: 600;
}

.quick-btn.is-active-toggle {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-weight: 600;
}

/* 底部定制算术键盘 */
.keypad-section {
  background: var(--bg-keypad);
  padding: 10px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid rgba(51, 65, 85, 0.45);
}

.key-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.key-btn {
  height: 48px;
  border-radius: var(--radius-key);
  border: none;
  background: var(--bg-key-num);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.1s ease;
  font-family: inherit;
}

.key-btn:active {
  transform: scale(0.94);
  filter: brightness(1.25);
}

.key-btn.is-fn {
  background: var(--bg-key-fn);
  font-weight: 700;
}

.key-btn.is-op {
  background: var(--bg-key-fn);
  color: var(--brand-light);
  font-size: 22px;
  font-weight: 700;
}

.key-btn.is-ac {
  color: #f87171;
  font-size: 17px;
}

.key-btn.is-primary {
  background: var(--brand-primary);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
}

.home-indicator-wrap {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.home-indicator {
  width: 134px;
  height: 5px;
  border-radius: 99px;
  background: #64748b;
  opacity: 0.75;
}

/* 底部抽屉通用蒙层 (Screen 2 & Screen 3 Guide) */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 22, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 30;
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  background: #131c31;
  border-top: 1px solid var(--border-subtle);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 12px 18px 18px;
  max-height: 82%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-backdrop.is-open .bottom-sheet {
  transform: translateY(0);
}

.sheet-handle-wrap {
  display: flex;
  justify-content: center;
}

.sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: #475569;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
}

.sheet-done-btn {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-screen);
  border: 1px solid var(--border-subtle);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
}

.search-bar input::placeholder {
  color: var(--text-secondary);
}

.sheet-caption {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.currency-option-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
}

.currency-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
}

.currency-option-item.is-selected {
  background: var(--bg-card-active);
  border-color: rgba(59, 130, 246, 0.5);
}

.option-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.option-flag {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.option-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-title {
  font-size: 13px;
  font-weight: 600;
}

.option-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.option-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* iOS 桌面安装引导卡片（还原 Figma Screen 3） */
.pwa-guide-card {
  background: var(--bg-card-active);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwa-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-screen);
}

.pwa-step-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.pwa-step-badge.is-green {
  color: var(--status-online);
}

.pwa-step-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.home-screen-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--bg-card);
}

.app-icon-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ios-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.ready-badge {
  padding: 6px 10px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--status-online);
  font-size: 11px;
  font-weight: 600;
}

/* 顶部轻提示 Toast */
.toast-msg {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 50;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast-msg.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
