/* ============================================================
   照妖镜 — 界面样式
   ------------------------------------------------------------
   设计令牌取自 anthropic.com 的实测值（浏览器计算样式 + CSS 变量）：
     页面底色  #FAF9F5 (swatch--ivory-light)
     卡片底色  #FFFFFF (swatch--white)
     次级面    #F0EEE6 (swatch--ivory-medium)
     主文字    #141413 (swatch--slate-dark)
     强调色    #C6613F (swatch--accent)
     强调亮色  #D97757
     圆角      4 / 8 / 16px，描边 1px
   官方字体 Anthropic Sans / Serif / Mono 为专有字体，这里用系统字体近似。

   目录：1 令牌  2 基础  3 导航  4 卡片  5 表单  6 按钮
         7 说明区  8 弹窗与提示  9 照片页  10 响应式
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --ivory-light: #FAF9F5;
  --ivory-medium: #F0EEE6;
  --ivory-dark: #E3DACC;
  --white: #FFFFFF;

  --slate-dark: #141413;
  --slate-hover: #2B2B29;
  --text-muted: #6E6E68;
  --cloud: #B0AEA5;

  --accent: #C6613F;
  --accent-bright: #D97757;
  --danger: #B4432B;

  --border: rgba(20, 20, 19, .10);
  --border-strong: rgba(20, 20, 19, .20);

  --radius-s: 4px;
  --radius: 8px;
  --radius-l: 16px;
  --radius-round: 100vw;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --shadow-card: 0 1px 2px rgba(20, 20, 19, .03), 0 6px 20px rgba(20, 20, 19, .04);
  --shadow-modal: 0 16px 48px rgba(20, 20, 19, .18);
  --maxw: 600px;
}

/* ---------- 2. 基础 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body.cyber-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--ivory-light);
  color: var(--slate-dark);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; height: auto; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 40px;
  padding-left: calc(20px + env(safe-area-inset-left));
  padding-right: calc(20px + env(safe-area-inset-right));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 3. 导航 ---------- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 20px;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--slate-dark);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}
.site-brand img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--ivory-medium);
}
.site-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-nav a.site-nav-link {
  flex: 0 0 auto;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  padding: 7px 2px;
  border-bottom: 1px solid transparent;
  transition: color .18s, border-color .18s;
}
.site-nav a.site-nav-link:hover,
.site-nav a.site-nav-link:focus {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- 4. 卡片 ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  margin: 0 0 16px;
  overflow: hidden;
}
.card-head {
  padding: 26px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.01em;
  color: var(--slate-dark);
  text-wrap: balance;
}
.card-sub {
  margin: 8px 0 0;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cloud);
}
.card-body { padding: 22px 24px 24px; }

/* ---------- 5. 表单 ---------- */
.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 20px; }

.label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--slate-dark);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input::placeholder { color: #9A9892; }
.input:hover { border-color: rgba(20, 20, 19, .3); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(198, 97, 63, .14);
}
.input[readonly] { cursor: default; }
.input-mono {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--ivory-light);
  border-color: var(--border);
  color: var(--slate-dark);
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  color: var(--slate-dark);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s, border-color .18s, color .18s, opacity .18s;
}
.btn-primary {
  color: var(--ivory-light);
  background: var(--slate-dark);
  border-color: var(--slate-dark);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--slate-hover);
  border-color: var(--slate-hover);
  color: var(--ivory-light);
}
.btn-secondary {
  color: var(--slate-dark);
  background: var(--white);
  border-color: var(--border-strong);
}
.btn-secondary:hover, .btn-secondary:focus {
  background: var(--ivory-medium);
  color: var(--slate-dark);
}
.btn-danger {
  color: var(--danger);
  background: var(--white);
  border-color: rgba(180, 67, 43, .35);
}
.btn-danger:hover, .btn-danger:focus {
  background: rgba(180, 67, 43, .07);
  color: var(--danger);
}
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }

/* 并排按钮：文字换行时两端等高，避免一高一低 */
.btn-row { display: flex; gap: 10px; align-items: stretch; }
.btn-row > * { flex: 1 1 0; min-width: 0; display: flex; }
.btn-row > * > .btn { flex: 1 1 auto; width: 100%; }
.gap { height: 10px; }

/* ---------- 7. 说明区与页脚 ---------- */
.guide {
  padding: 20px 24px 22px;
  border-top: 1px solid var(--border);
  background: var(--ivory-light);
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-muted);
}
.guide-title {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.guide ol, .guide ul { margin: 0; padding-left: 1.25em; }
.guide li { margin-bottom: 2px; }
.guide code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--ivory-medium);
  border-radius: var(--radius-s);
  padding: 1px 5px;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.local-time {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--cloud);
}

.site-footer {
  padding: 8px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- 8. 弹窗与提示 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 20, 19, .45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.modal-mask.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%;
  max-width: 340px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px 22px 20px;
  background: var(--white);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-modal);
  transform: translateY(6px) translateZ(0);
  will-change: transform;
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-mask.is-open .modal { transform: translateY(0) translateZ(0); }
.modal h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--slate-dark);
}
.modal-lines { margin: 0; padding: 0; list-style: none; }
.modal-lines li {
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
}
.modal-lines li:last-child { margin-bottom: 0; }
.modal .btn { margin-top: 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  transform: translateX(-50%) translateY(10px);
  background: var(--slate-dark);
  color: var(--ivory-light);
  border-radius: var(--radius-round);
  box-shadow: 0 8px 28px rgba(20, 20, 19, .22);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, transform .2s, visibility .2s;
}
.toast.is-open { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ivory-light);
}
.toast--success .toast-dot { background: #7EA16B; }
.toast--warning .toast-dot { background: var(--accent-bright); }
.toast--error .toast-dot { background: #E0735A; }

/* ---------- 9. 照片页 ---------- */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 2px 0 16px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.bar a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 15px;
  color: var(--slate-dark);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-round);
  font-size: 13.5px;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background .18s, border-color .18s, color .18s;
}
.bar a:hover, .bar a:focus {
  background: var(--ivory-medium);
  border-color: var(--border-strong);
  color: var(--slate-dark);
}
.bar a.is-danger { color: var(--danger); border-color: rgba(180, 67, 43, .35); }
.bar a.is-danger:hover { background: rgba(180, 67, 43, .07); color: var(--danger); }
.bar .count { color: var(--text-muted); }

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}
.shot-grid a {
  display: block;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ivory-medium);
}
.shot-grid img { display: block; width: 100%; height: auto; }
@supports (aspect-ratio: 1 / 1) {
  .shot-grid img { aspect-ratio: 1 / 1; object-fit: cover; }
}

.empty {
  padding: 34px 8px 30px;
  text-align: center;
  font-size: 14px;
  line-height: 1.95;
  color: var(--text-muted);
}
.empty code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--ivory-medium);
  border-radius: var(--radius-s);
  padding: 1px 5px;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  background: rgba(20, 20, 19, .93);
}
.viewer.is-open { display: flex; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  font-size: 20px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
}
.viewer-close:hover, .viewer-close:focus { background: rgba(255, 255, 255, .24); }

/* ---------- 10. 响应式 ---------- */
@media (max-width: 600px) {
  .container { padding: 18px 16px 32px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .site-nav { padding-bottom: 16px; }
  .site-brand { font-size: 14px; }
  .site-brand img { width: 28px; height: 28px; }

  .card-head { padding: 21px 18px 15px; }
  .card-title { font-size: 17.5px; }
  .card-body { padding: 18px 18px 20px; }
  .guide { padding: 17px 18px 19px; font-size: 13.5px; }

  /* 16px 以下 iOS Safari 聚焦时会自动放大整页 */
  .input { min-height: 48px; font-size: 16px; }
  .input-mono { font-size: 13px; }
  .btn { min-height: 48px; }

  .shot-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
}

@media (max-width: 360px) {
  .card-title { font-size: 16.5px; }
  .btn-row { flex-direction: column; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}