/*
  文件：style.css
  作用：页面样式与响应式布局，包含卡片的外观、花纹效果、表单外观与聚焦高亮。
  关联：被 index.html 通过 <link rel="stylesheet"> 引入；与 script.js 配合动态切换变量与类名。
*/

/* CSS 变量：默认卡片主色与次色（脚本会动态更新） */
:root {
  --card-color-1: #4f46e5; /* 默认主色 */
  --card-color-2: #2e2a8a; /* 默认次色（主色加深） */

  --page-bg: #0f172a; /* 页面背景（可动态更新） */
  --page-bg-secondary: #111827; /* 页面背景次色（用于径向渐变） */
  --border: #334155;
  --muted: #94a3b8;
  --text: #e2e8f0;
  --focus: #22d3ee;
  --shadow-strong: rgba(0, 0, 0, 0.35);
  --shadow-soft: rgba(0, 0, 0, 0.2);
}

/* 全局与排版 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

/* 修复：确保带 hidden 属性的元素被强制隐藏，避免被 display 规则覆盖 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 10% 10%, var(--page-bg-secondary), var(--page-bg));
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Roboto Mono", "Liberation Mono", "Courier New", monospace;
  line-height: 1.6;
  transition: background 300ms ease; /* 背景色切换动画 */
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px);
}

/* 安全提示区域样式 */
.security-notice {
  background: linear-gradient(135deg, #059669, #047857);
  border: 1px solid #10b981;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
  animation: slideDown 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

.security-notice::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #34d399, #10b981);
  animation: shimmer 2s infinite;
}

.security-notice-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  position: relative;
}

.security-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.security-text {
  flex: 1;
  color: #ffffff;
}

.security-text strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.security-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.close-btn:active {
  transform: scale(0.95);
}

/* 动画效果 */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* 隐藏状态的动画 */
.security-notice.hiding {
  animation: slideUp 0.3s ease-in forwards;
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    margin-bottom: 16px;
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    margin-bottom: 0;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .security-notice-content {
    padding: 14px 16px;
    gap: 10px;
  }
  
  .security-icon {
    font-size: 20px;
  }
  
  .security-text strong {
    font-size: 15px;
  }
  
  .security-text p {
    font-size: 13px;
  }
  
  .close-btn {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
}

.page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

/* 布局：上预览、下表单；宽屏并排 */
@media (min-width: 960px) {
  .page {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* 预览区域 */
.preview {
  display: grid;
  place-items: center;
}

.card-stage {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* 信用卡容器：使用 aspect-ratio 保持真实比例 85.6:53.98 ≈ 1.586 */
.card-container {
  position: relative;
  width: min(520px, 92vw);
  aspect-ratio: 1.586/1;
  border-radius: 18px;
  padding: 24px;
  color: #fff;
  overflow: hidden;
  box-shadow:
    0 28px 50px -10px var(--shadow-strong),
    0 12px 24px -8px var(--shadow-soft);
  background-image: linear-gradient(135deg, var(--card-color-1), var(--card-color-2));
  background-size: cover;
  background-position: center;
  isolation: isolate; /* 便于 ::after 图层混合 */
}

/* 背景图案图层（由 .pattern-* 类设置） */
.card-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  z-index: 0; /* 在内容下方 */
  background: none;
  transition: background 240ms ease, opacity 240ms ease;
}

/* 图案1：斜向细条纹 */
.card-container.pattern-1::after {
  background-image:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.16) 0, rgba(255,255,255,0.16) 2px, transparent 2px, transparent 10px);
}

/* 图案2：网格圆点 */
.card-container.pattern-2::after {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.18) 1px, transparent 1.5px);
  background-size: 16px 16px;
}

/* 图案3：波浪纹理 */
.card-container.pattern-3::after {
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.12) 0px,
      rgba(255,255,255,0.12) 1px,
      transparent 1px,
      transparent 8px,
      rgba(255,255,255,0.08) 8px,
      rgba(255,255,255,0.08) 12px,
      transparent 12px,
      transparent 20px
    );
}

/* 图案4：六边形蜂窝 */
.card-container.pattern-4::after {
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.15) 2px, transparent 3px),
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.08) 1px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,0.08) 1px, transparent 2px);
  background-size: 24px 24px, 12px 12px, 12px 12px;
  background-position: 0 0, 6px 6px, 18px 18px;
}

/* 图案5：菱形网格 */
.card-container.pattern-5::after {
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.12) 8px,
      rgba(255,255,255,0.12) 10px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.12) 8px,
      rgba(255,255,255,0.12) 10px
    );
}

/* 图案6：放射状纹理 */
.card-container.pattern-6::after {
  background-image:
    conic-gradient(
      from 0deg at 50% 50%,
      rgba(255,255,255,0.15) 0deg,
      transparent 30deg,
      rgba(255,255,255,0.08) 60deg,
      transparent 90deg,
      rgba(255,255,255,0.15) 120deg,
      transparent 150deg,
      rgba(255,255,255,0.08) 180deg,
      transparent 210deg,
      rgba(255,255,255,0.15) 240deg,
      transparent 270deg,
      rgba(255,255,255,0.08) 300deg,
      transparent 330deg,
      rgba(255,255,255,0.15) 360deg
    );
  background-size: 80px 80px;
}

/* 图案7：几何三角形 */
.card-container.pattern-7::after {
  background-image:
    linear-gradient(30deg, rgba(255,255,255,0.12) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,0.12) 87.5%, rgba(255,255,255,0.12)),
    linear-gradient(150deg, rgba(255,255,255,0.12) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,0.12) 87.5%, rgba(255,255,255,0.12)),
    linear-gradient(30deg, rgba(255,255,255,0.12) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,0.12) 87.5%, rgba(255,255,255,0.12)),
    linear-gradient(150deg, rgba(255,255,255,0.12) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,0.12) 87.5%, rgba(255,255,255,0.12));
  background-size: 20px 35px;
  background-position: 0 0, 0 0, 10px 18px, 10px 18px;
}

/* 图案8：圆环纹理 */
.card-container.pattern-8::after {
  background-image:
    radial-gradient(circle at 50% 50%, transparent 8px, rgba(255,255,255,0.1) 9px, rgba(255,255,255,0.1) 11px, transparent 12px),
    radial-gradient(circle at 25% 25%, transparent 4px, rgba(255,255,255,0.08) 5px, rgba(255,255,255,0.08) 6px, transparent 7px),
    radial-gradient(circle at 75% 75%, transparent 4px, rgba(255,255,255,0.08) 5px, rgba(255,255,255,0.08) 6px, transparent 7px);
  background-size: 32px 32px, 16px 16px, 16px 16px;
  background-position: 0 0, 8px 8px, 24px 24px;
}

/* 图案9：织物纹理 */
.card-container.pattern-9::after {
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.08) 0px,
      rgba(255,255,255,0.08) 1px,
      transparent 1px,
      transparent 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.08) 0px,
      rgba(255,255,255,0.08) 1px,
      transparent 1px,
      transparent 4px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 1px,
      transparent 1px,
      transparent 8px
    );
}

/* 图案10：星空效果 */
.card-container.pattern-10::after {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.2) 1px, transparent 2px),
    radial-gradient(circle at 60% 70%, rgba(255,255,255,0.15) 0.5px, transparent 1px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.18) 1.5px, transparent 2px),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,0.12) 0.8px, transparent 1.5px),
    radial-gradient(circle at 90% 60%, rgba(255,255,255,0.16) 1px, transparent 1.5px),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.14) 0.6px, transparent 1px);
  background-size: 60px 60px, 40px 40px, 80px 80px, 50px 50px, 70px 70px, 35px 35px;
  background-position: 0 0, 20px 20px, 40px 10px, 10px 40px, 30px 50px, 50px 30px;
}

/* 卡片元素层级 */
.card-chips,
.card-logo,
.card-number,
.card-bottom {
  position: absolute;
  z-index: 1; /* 高于 ::after */
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* 芯片和NFC图片容器 - 放在卡片高度中间偏上位置 */
.card-chips {
  position: absolute;
  top: 35%;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

/* 芯片图片样式 */
.card-chip {
  width: 58px;
  height: auto;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  border-radius: 6px;
}

/* NFC图片样式 - 与芯片图片保持一致的大小和样式 */
.card-nfc {
  width: 58px;
  height: auto;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  border-radius: 6px;
}

/* 信用卡品牌Logo - 移到右下角 */
.card-logo {
  bottom: 18px;
  right: 22px;
  width: 84px;
  height: auto;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  border-radius: 8px;
}

/* 品牌名与发卡商logo容器 - 放在最上面左对齐 */
.card-brand {
  position: absolute;
  top: 22px;
  left: 24px; /* 左对齐到边缘 */
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px; /* logo与文字间距 */
  max-width: 70%;
  overflow: hidden;
}

/* 发卡商logo基础样式 */
.issuer-logo {
  flex-shrink: 0; /* 防止logo被压缩 */
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
  border-radius: 8px;
}

/* E卡logo样式 */
.issuer-logo.ether-logo {
  width: 64px;
  height: 64px;
}

/* 人人卡logo样式 */
.issuer-logo.ready-logo {
  width: 80px;
  height: 80px;
}

/* RooGoo logo样式 */
.issuer-logo.roogoo-logo {
  width: 80px;
  height: 80px;
}

/* SafePal logo样式 */
.issuer-logo.safepal-logo {
  width: 80px;
  height: 80px;
}

/* Payy logo样式 */
.issuer-logo.payy-logo {
  width: 96px;
  height: 36px;
}

/* 品牌文字样式 */
.brand-text {
  font-size: clamp(16px, 3.6vw, 20px);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* 允许文字被压缩 */
}

/* 右上徽章（虚拟卡/实体卡） - 保持在右上角 */
.card-badge {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 1;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  color: #0b1020;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* 卡号 - 放在芯片下方，留出适当间距 */
.card-number {
  left: 24px;
  right: 24px;
  top: 62%; /* 往下移动，与芯片留出更多空隙 */
  transform: translateY(-50%);
  font-size: clamp(20px, 4.2vw, 28px);
  letter-spacing: 2px;
  word-spacing: 8px;
  font-weight: 600;
}

.card-bottom {
  left: 24px;
  right: 130px; /* 为右下角Logo留出更多空间，避免与Logo过于接近 */
  bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.card-field .field-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  opacity: 0.9;
}

.card-name {
  margin-top: 4px;
  font-size: clamp(13px, 2.8vw, 16px);
  letter-spacing: 1.2px;
  max-width: 70vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-expiry {
  margin-top: 4px;
  font-size: clamp(13px, 2.8vw, 16px);
  letter-spacing: 1.2px;
}

/* 聚焦高亮：脚本在对应元素上添加 .is-highlight */
.card-number.is-highlight,
.card-name-block.is-highlight,
.card-expiry-block.is-highlight,
.card-logo.is-highlight,
.card-brand.is-highlight,
.card-badge.is-highlight,
.card-container.is-highlight {
  outline: 3px solid rgba(255,255,255,0.85);
  outline-offset: 2px;
  border-radius: 10px;
  box-shadow:
    0 0 0 4px rgba(255,255,255,0.15),
    0 8px 18px rgba(0,0,0,0.35);
}

/* 控制面板表单 */
.controls-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.btn.toggle {
  font-weight: 600;
}
.controls {
  width: 100%;
}

.card-form {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px clamp(14px, 3vw, 22px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 720px) {
  .card-form {
    grid-template-columns: 1fr 1fr;
  }
  .form-actions {
    grid-column: 1 / -1;
  }
}

/* 表单单元 */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 14px;
  color: var(--text);
}

input[type="text"],
select,
input[type="color"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.35);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  outline: none;
}

input[type="text"]::placeholder {
  color: #94a3b8aa;
}

input[type="text"]:focus,
select:focus,
input[type="color"]:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
  background: rgba(2, 6, 23, 0.6);
}

/* 颜色控制区域样式 */
.color-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 预设颜色按钮网格 */
.preset-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

/* 预设颜色按钮样式 */
.preset-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.35);
  color: var(--text);
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  min-height: 70px;
}

.preset-color-btn:hover {
  border-color: var(--focus);
  background: rgba(2, 6, 23, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.preset-color-btn.active {
  border-color: var(--focus);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25);
}

/* 颜色预览圆形 */
.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* 颜色名称 */
.color-name {
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 自定义颜色区域 */
.custom-color {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.custom-color input[type="color"] {
  width: 50px;
  height: 40px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}

.custom-color-label {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

/* 预设背景色按钮样式 */
.preset-bg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.35);
  color: var(--text);
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  min-height: 70px;
}

.preset-bg-btn:hover {
  border-color: var(--focus);
  background: rgba(2, 6, 23, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.preset-bg-btn.active {
  border-color: var(--focus);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25);
}

/* 小屏幕优化 */
@media (max-width: 480px) {
  .preset-colors {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .preset-color-btn,
  .preset-bg-btn {
    min-height: 60px;
    padding: 6px 4px;
    gap: 4px;
  }
  
  .color-preview {
    width: 24px;
    height: 24px;
  }
  
  .color-name {
    font-size: 9px;
  }
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* 按钮 */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 120ms ease, border-color 160ms ease, background 160ms ease;
  user-select: none;
}

.btn:hover {
  border-color: var(--focus);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: linear-gradient(180deg, rgba(148,163,184,0.1), rgba(148,163,184,0.06));
}

/* 开关控件样式 */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: background 200ms ease;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-label .toggle-slider {
  background: var(--focus);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-label .toggle-slider::after {
  transform: translateX(20px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* 有效期字段的显示/隐藏控制 */
.expiry-field {
  transition: opacity 300ms ease, transform 300ms ease;
}

.expiry-field.hidden {
  opacity: 0.5;
  transform: translateY(-5px);
  pointer-events: none;
}

/* 卡片上有效期区域的显示/隐藏 */
.card-expiry-block {
  transition: opacity 300ms ease, transform 300ms ease;
}

.card-expiry-block.hidden {
  opacity: 0;
  transform: scale(0.9);
}

/* 小屏优化 */
@media (max-width: 420px) {
  .card-container {
    padding: 18px;
  }
  .card-chips {
    left: 18px;
    gap: 8px; /* 小屏幕下减少间距 */
  }
  .card-chip,
  .card-nfc {
    width: 48px;
  }
  .card-logo {
    width: 70px;
    bottom: 16px; /* 保持在右下角 */
    right: 18px;
  }
  .card-brand {
    left: 18px; /* 左对齐到边缘 */
    top: 18px;
    max-width: 65%;
    gap: 6px; /* 小屏幕下减少间距 */
  }
  
  /* 小屏幕下E卡logo样式 */
  .issuer-logo.ether-logo {
    width: 48px;
    height: 48px;
  }
  
  /* 小屏幕下人人卡logo样式 */
  .issuer-logo.ready-logo {
    width: 64px;
    height: 64px;
  }
  
  /* 小屏幕下RooGoo logo样式 */
  .issuer-logo.roogoo-logo {
    width: 64px;
    height: 64px;
  }
  
  /* 小屏幕下SafePal logo样式 */
  .issuer-logo.safepal-logo {
    width: 64px;
    height: 64px;
  }
  
  /* 小屏幕下Payy logo样式 */
  .issuer-logo.payy-logo {
    width: 64px;
    height: 24px;
  }
  
  .brand-text {
    font-size: clamp(14px, 4vw, 18px);
  }
  .card-badge {
    top: 18px; /* 保持在右上角 */
    right: 18px;
    font-size: 11px;
    padding: 3px 8px;
  }
  .card-number {
    top: 62%; /* 与芯片留出适当间距 */
  }
  .card-bottom {
    right: 110px; /* 小屏幕下为Logo留出更多空间，避免与Logo过于接近 */
  }
}

/* ========================= 全屏和控制面板功能样式 ========================= */

/* 控制面板工具栏增强样式 */
.controls-toolbar {
  position: relative;
  z-index: 1000; /* 确保在全屏模式下工具栏可见 */
}

/* 全屏模式下的工具栏样式 */
:fullscreen .controls-toolbar,
:-webkit-full-screen .controls-toolbar,
:-moz-full-screen .controls-toolbar,
:-ms-fullscreen .controls-toolbar {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  backdrop-filter: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  transition: all 0.3s ease;
  z-index: 9999;
}

/* 全屏模式下工具栏按钮样式 */
:fullscreen .controls-toolbar .btn,
:-webkit-full-screen .controls-toolbar .btn,
:-moz-full-screen .controls-toolbar .btn,
:-ms-fullscreen .controls-toolbar .btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  font-size: 14px;
  padding: 12px 24px;
  min-width: 140px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 全屏模式下工具栏按钮悬停效果 */
:fullscreen .controls-toolbar .btn:hover,
:-webkit-full-screen .controls-toolbar .btn:hover,
:-moz-full-screen .controls-toolbar .btn:hover,
:-ms-fullscreen .controls-toolbar .btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4c93 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 全屏模式下确保工具栏始终可见 */
:fullscreen .controls-toolbar,
:-webkit-full-screen .controls-toolbar,
:-moz-full-screen .controls-toolbar,
:-ms-fullscreen .controls-toolbar {
  display: flex !important;
}

/* 全屏模式下页面布局优化 */
:fullscreen .page,
:-webkit-full-screen .page,
:-moz-full-screen .page,
:-ms-fullscreen .page {
  max-width: none;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 全屏模式下预览区域优化 */
:fullscreen .preview,
:-webkit-full-screen .preview,
:-moz-full-screen .preview,
:-ms-fullscreen .preview {
  flex: 1;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
  padding-bottom: 100px; /* 为底部按钮留出空间 */
}

/* 全屏模式下卡片容器优化 */
:fullscreen .card-container,
:-webkit-full-screen .card-container,
:-moz-full-screen .card-container,
:-ms-fullscreen .card-container {
  width: min(80vw, 700px);
  transform: scale(1.3);
  box-shadow: 
    0 50px 100px -20px var(--shadow-strong),
    0 25px 50px -15px var(--shadow-soft);
  transition: all 0.5s ease;
}

/* 控制面板内容隐藏状态的动画效果 */
.card-form[hidden] {
  animation: slideOut 0.3s ease-in-out;
}

.card-form:not([hidden]) {
  animation: slideIn 0.3s ease-in-out;
}

.security-notice[hidden] {
  animation: slideOut 0.3s ease-in-out;
}

.security-notice:not([hidden]) {
  animation: slideIn 0.3s ease-in-out;
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
  }
  to {
    opacity: 0;
    transform: translateY(20px);
    max-height: 0;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
  }
}

/* 按钮状态指示 */
.btn.toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.2), rgba(34, 211, 238, 0.1));
  border-color: var(--focus);
  color: var(--focus);
}

/* 全屏按钮特殊样式 */
#fullscreen-btn {
  position: relative;
  overflow: hidden;
}

#fullscreen-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

#fullscreen-btn:hover::before {
  left: 100%;
}

/* 移动端模拟全屏样式 */
body.mobile-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 10% 10%, var(--page-bg-secondary), var(--page-bg));
  z-index: 9999;
}

body.mobile-fullscreen .page {
  max-width: none !important;
  padding: 0 !important;
  height: 100vh !important;
  width: 100vw !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  margin: 0 !important;
  grid-template-columns: none !important;
  gap: 0 !important;
}

body.mobile-fullscreen .preview {
  flex: 1 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: inherit !important;
  padding: 20px 20px 100px 20px !important;
  margin: 0 !important;
  place-items: center !important;
}

body.mobile-fullscreen .card-container {
  width: min(520px, 92vw) !important;
  transform: scale(1.0) !important;
  box-shadow: 
    0 50px 100px -20px var(--shadow-strong),
    0 25px 50px -15px var(--shadow-soft) !important;
  transition: all 0.5s ease !important;
  margin: 0 auto !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
}

body.mobile-fullscreen .card-stage {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

body.mobile-fullscreen .controls-toolbar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 80px);
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
  transition: all 0.3s ease;
  z-index: 10000;
}

body.mobile-fullscreen .controls-toolbar .btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 12px;
  padding: 8px 16px;
  min-width: 80px;
  touch-action: manipulation;
}

body.mobile-fullscreen .controls-toolbar .btn:hover,
body.mobile-fullscreen .controls-toolbar .btn:active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* 隐藏移动端全屏模式下的其他内容 */
body.mobile-fullscreen .controls > *:not(.controls-toolbar) {
  display: none !important;
}

/* 响应式全屏优化 */
@media (max-width: 768px) {
  body.mobile-fullscreen .controls-toolbar {
    bottom: env(safe-area-inset-bottom, 70px);
    padding: 0;
  }
  
  body.mobile-fullscreen .controls-toolbar .btn {
    font-size: 14px;
    padding: 10px 20px;
    min-width: 120px;
    /* 保持原有按钮样式 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  }
  
  body.mobile-fullscreen .card-container {
    width: min(520px, 90vw) !important;
    transform: scale(1.0) !important;
  }
</replace_in_file>

<replace_in_file id="mf0jdrirk6h5pbhjiweuhdybdbewimkm">
<path>style.css</path>
<diff>------- SEARCH
  body.mobile-fullscreen .preview {
    padding: 20px 20px 120px 20px !important; /* 小屏幕下为按钮留出更多空间 */
  }
=======
  body.mobile-fullscreen .preview {
    padding: 20px 20px 140px 20px !important; /* 小屏幕下为按钮留出更多空间 */
  }
  
  body.mobile-fullscreen .preview {
    padding: 20px 20px 120px 20px !important; /* 小屏幕下为按钮留出更多空间 */
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  body.mobile-fullscreen .card-container {
    width: min(95vw, 400px);
    transform: scale(1.0);
  }
  
  body.mobile-fullscreen .controls-toolbar {
    bottom: env(safe-area-inset-bottom, 20px);
    padding: 0;
  }
  
  body.mobile-fullscreen .controls-toolbar .btn {
    font-size: 13px;
    padding: 8px 16px;
    min-width: 100px;
    /* 保持原有按钮样式 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  }
  
  body.mobile-fullscreen .preview {
    padding-bottom: 90px;
  }
}

/* ========================= iOS 和 PWA 安装提示样式 ========================= */

/* iOS 添加到主屏幕提示样式 */
.ios-install-prompt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.ios-install-prompt.show {
  opacity: 1;
  visibility: visible;
}

.ios-install-content {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.ios-install-prompt.show .ios-install-content {
  transform: scale(1);
}

.ios-install-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}

.ios-install-header h3 {
  margin: 0;
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
}

.ios-install-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.ios-install-close:hover {
  background-color: #f3f4f6;
}

.ios-install-body {
  padding: 20px;
}

.ios-install-body p {
  margin: 0 0 20px;
  color: #4b5563;
  line-height: 1.5;
}

.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ios-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.ios-step-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
}

.ios-step-text {
  color: #374151;
  font-weight: 500;
}

/* PWA 安装提示样式 */
.pwa-install-prompt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.pwa-install-prompt.show {
  opacity: 1;
  visibility: visible;
}

.pwa-install-content {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.pwa-install-prompt.show .pwa-install-content {
  transform: scale(1);
}

.pwa-install-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}

.pwa-install-header h3 {
  margin: 0;
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
}

.pwa-install-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.pwa-install-close:hover {
  background-color: #f3f4f6;
}

.pwa-install-body {
  padding: 20px;
}

.pwa-install-body p {
  margin: 0 0 20px;
  color: #4b5563;
  line-height: 1.5;
}

.pwa-install-actions {
  display: flex;
  gap: 12px;
}

.pwa-install-btn {
  flex: 1;
  background: #4f46e5;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.pwa-install-btn:hover {
  background: #4338ca;
}

.pwa-install-cancel {
  flex: 1;
  background: #f3f4f6;
  color: #374151;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.pwa-install-cancel:hover {
  background: #e5e7eb;
}

/* 移动端优化 */
@media (max-width: 480px) {
  .ios-install-prompt,
  .pwa-install-prompt {
    padding: 10px;
  }
  
  .ios-install-header,
  .pwa-install-header {
    padding: 16px 16px 0;
  }
  
  .ios-install-body,
  .pwa-install-body {
    padding: 16px;
  }
  
  .ios-install-header h3,
  .pwa-install-header h3 {
    font-size: 16px;
  }
  
  .ios-step {
    padding: 10px;
    gap: 10px;
  }
  
  .ios-step-icon {
    font-size: 18px;
    width: 28px;
  }
  
  .pwa-install-actions {
    flex-direction: column;
  }
  
  .pwa-install-btn,
  .pwa-install-cancel {
    padding: 14px 20px;
  }
}

