/* ============================================================
 * 寄给未来 · 写信页样式
 * 主题：牛皮纸 / 时光 / 手写感
 * ============================================================ */
:root {
  --paper: #f5efe4;
  --paper-2: #fffdf8;
  --ink: #3f3428;
  --ink-2: #6b5b47;
  --muted: #a8977f;
  --line: #e6dccb;
  --brand: #a67c46;
  --brand-2: #c8a06a;
  --brand-soft: #f6eddf;
  --danger: #c0563a;
  --ok: #5c8a5c;
  --radius: 14px;
  --shadow: 0 6px 26px rgba(126, 100, 62, .10);
  --shadow-lg: 0 14px 44px rgba(126, 100, 62, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：作者样式里的 display 会覆盖 HTML hidden 属性，这里强制兜底 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(200, 160, 106, .13), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(166, 124, 70, .10), transparent 46%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 18px; }

/* ------------------------------------------------ 头部 */
.site-header {
  background: linear-gradient(135deg, #b98f56, #a67c46 55%, #96703e);
  color: #fff;
  box-shadow: 0 2px 18px rgba(120, 90, 50, .22);
  padding: 18px 0;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 13px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  display: grid; place-items: center; font-size: 23px;
}
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 21px; letter-spacing: 4px; font-weight: 700; }
.brand-text p { margin: 2px 0 0; font-size: 12px; opacity: .88; letter-spacing: 1px; }
.brand-nav { display: flex; gap: 8px; flex: 0 0 auto; }
.brand-nav a {
  color: #fff; text-decoration: none; font-size: 13px;
  padding: 7px 14px; border-radius: 20px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  transition: .18s; white-space: nowrap;
}
.brand-nav a:hover { background: rgba(255, 255, 255, .26); }

/* ------------------------------------------------ 进度 */
.progress-wrap {
  background: rgba(255, 253, 248, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  padding: 12px 0 0;
}
.steps { list-style: none; display: flex; margin: 0; padding: 0; gap: 4px; }
.steps li {
  flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  padding-bottom: 9px; position: relative; cursor: default; transition: .2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.steps li .n {
  display: inline-grid; place-items: center;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--line); color: var(--muted);
  font-size: 11px; margin-right: 6px; vertical-align: -5px; transition: .2s;
}
.steps li.active { color: var(--brand); font-weight: 600; }
.steps li.active .n { background: var(--brand); color: #fff; }
.steps li.done { color: var(--ok); }
.steps li.done .n { background: var(--ok); color: #fff; }
.steps li.done .n::after { content: "✓"; }
.steps li.done .n { font-size: 0; }
.steps li.done .n::after { font-size: 12px; }
.progress-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: -1px; }
.progress-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .35s ease; }

/* ------------------------------------------------ 面板 */
main { padding: 26px 0 10px; }

.panel { animation: fadeUp .34s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 20px; }
.panel-head h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: 1px; }
.panel-head h2 .icon { margin-right: 8px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }

.field { margin-bottom: 22px; }
.field > label.flabel {
  display: block; font-weight: 600; font-size: 14.5px;
  margin-bottom: 7px; color: var(--ink);
}
.field > label.flabel .req { color: var(--danger); margin-left: 3px; }
.fnote { font-size: 12.5px; color: var(--muted); margin: -3px 0 9px; line-height: 1.7; }
.fnote .hl { color: var(--danger); font-weight: 600; }
.fnote a { color: var(--brand); }

.finput, .ftextarea, select.finput {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: inherit;
  color: var(--ink); background: var(--paper-2);
  border: 1.5px solid var(--line); border-radius: 10px;
  transition: .18s; outline: none;
}
.finput:focus, .ftextarea:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(200, 160, 106, .17);
}
.ftextarea { resize: vertical; line-height: 1.9; min-height: 90px; }
.finput::placeholder, .ftextarea::placeholder { color: #c3b6a2; }
.finput[type="date"] { cursor: pointer; }

.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: 5px; }

/* 选项（单选/多选） */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--paper-2); cursor: pointer; transition: .18s;
}
.opt:hover { border-color: var(--brand-2); background: #fff; }
.opt input { appearance: none; -webkit-appearance: none; margin: 3px 0 0; flex: 0 0 auto;
  width: 19px; height: 19px; border: 1.5px solid #cdbfa9; background: #fff; transition: .15s; position: relative; }
.opt input[type="radio"] { border-radius: 50%; }
.opt input[type="checkbox"] { border-radius: 5px; }
.opt input:checked { background: var(--brand); border-color: var(--brand); }
.opt input[type="checkbox"]:checked::after {
  content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 13px;
  display: grid; place-items: center; line-height: 1;
}
.opt input[type="radio"]:checked::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff;
}
.opt-main { flex: 1; min-width: 0; }
.opt-title { font-size: 14.5px; font-weight: 500; }
.opt-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.65; }
.opt.checked { border-color: var(--brand); background: var(--brand-soft); }
.opt:hover .opt-desc { color: var(--ink-2); }

/* 图片单选 */
.imgrid { display: grid; gap: 11px; }
.imgopt { cursor: pointer; text-align: center; transition: .18s; }
.imgopt .thumb {
  border: 2.5px solid transparent; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 9px rgba(126, 100, 62, .10); transition: .18s;
  aspect-ratio: 3 / 4; display: grid; place-items: center;
}
.imgopt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgopt .cap { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.imgopt:hover .thumb { transform: translateY(-2px); box-shadow: var(--shadow); }
.imgopt.checked .thumb { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(166, 124, 70, .18); }
.imgopt.checked .cap { color: var(--brand); font-weight: 600; }
.imgopt .zoom {
  position: absolute; right: 7px; top: 7px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .42); color: #fff; display: grid; place-items: center;
  font-size: 12px; opacity: 0; transition: .18s;
}
.imgopt .thumbwrap { position: relative; }
.imgopt:hover .zoom { opacity: 1; }

/* 上传 */
.uploader {
  border: 2px dashed var(--line); border-radius: 12px; background: var(--paper-2);
  padding: 22px; text-align: center; cursor: pointer; transition: .18s;
}
.uploader:hover, .uploader.drag { border-color: var(--brand-2); background: var(--brand-soft); }
.uploader .up-icon { font-size: 26px; }
.uploader .up-main { font-size: 14px; margin-top: 7px; }
.uploader .up-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.uploader input[type="file"] { display: none; }

.filelist { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.fileitem {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px; font-size: 13px;
}
.fileitem .fi-thumb {
  width: 40px; height: 40px; border-radius: 7px; overflow: hidden; flex: 0 0 40px;
  background: var(--brand-soft); display: grid; place-items: center; font-size: 18px;
}
.fileitem .fi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fileitem .fi-main { flex: 1; min-width: 0; }
.fileitem .fi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .fi-meta { font-size: 11.5px; color: var(--muted); }
.fileitem .fi-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.fileitem .fi-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.fileitem .fi-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 17px; padding: 4px 7px; border-radius: 6px; line-height: 1;
}
.fileitem .fi-del:hover { color: var(--danger); background: #fbeeea; }
.fileitem.err { border-color: #e6b8ab; background: #fdf4f1; }
.fileitem.err .fi-meta { color: var(--danger); }

/* 地址区块 */
.section-block {
  background: var(--brand-soft); border: 1px dashed #dcc8a8; border-radius: 12px;
  padding: 18px 20px; margin-bottom: 22px;
}
.section-block h3 { margin: 0 0 9px; font-size: 15px; color: var(--brand); }
.section-block .addr-text { font-size: 14px; line-height: 2; white-space: pre-line; user-select: all; }
.section-block .copy-btn {
  margin-top: 11px; font-size: 12.5px; padding: 6px 14px; border-radius: 18px;
  border: 1px solid var(--brand-2); background: #fff; color: var(--brand); cursor: pointer;
}
.section-block .copy-btn:hover { background: var(--brand); color: #fff; }

/* 步骤导航 */
.form-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 30px 0 40px; padding-top: 22px; border-top: 1px solid var(--line);
}
.btn {
  font-family: inherit; font-size: 15px; padding: 12px 30px; border-radius: 26px;
  border: 1.5px solid transparent; cursor: pointer; transition: .2s; font-weight: 500;
  white-space: nowrap;
}
.btn[hidden] { display: none !important; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 4px 15px rgba(166, 124, 70, .3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 7px 21px rgba(166, 124, 70, .38); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand); }
.btn-ghost[disabled] { opacity: .4; cursor: not-allowed; }
.nav-hint { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); }
.nav-hint.error { color: var(--danger); font-weight: 500; }

/* 成功页 */
.done-card {
  background: var(--paper-2); border-radius: 18px; padding: 40px 32px;
  box-shadow: var(--shadow-lg); text-align: center; margin-bottom: 40px;
  animation: fadeUp .4s ease both;
}
.done-icon { font-size: 54px; line-height: 1; }
.done-card h2 { font-size: 21px; margin: 16px 0 10px; letter-spacing: .5px; }
.done-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; line-height: 1.9; }
.code-box {
  display: inline-block; background: var(--brand-soft); border: 1.5px dashed #dcc8a8;
  border-radius: 12px; padding: 14px 34px; margin-bottom: 24px;
}
.code-label { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.code-value {
  font-size: 25px; font-weight: 700; letter-spacing: 3px; color: var(--brand);
  font-family: "SF Mono", Menlo, Consolas, monospace; margin-top: 4px;
  word-break: break-all;
}
.done-info { list-style: none; padding: 0; margin: 0 auto 26px; max-width: 460px; text-align: left; }
.done-info li {
  font-size: 13.5px; color: var(--ink-2); padding: 9px 0;
  border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 14px;
}
.done-info li span { color: var(--muted); flex: 0 0 auto; }
.done-info li b { font-weight: 600; text-align: right; word-break: break-all; }
.done-actions { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }
.done-actions .btn { padding: 11px 24px; font-size: 14px; text-decoration: none; display: inline-block; }
.done-tip { font-size: 12.5px; color: var(--muted); margin: 20px 0 0; line-height: 1.9; }

/* 底栏 */
.site-footer { background: #efe6d8; border-top: 1px solid var(--line); padding: 34px 0 26px; margin-top: 30px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; }
.foot-grid h4 { margin: 0 0 7px; font-size: 13px; color: var(--brand); letter-spacing: 1px; }
.foot-grid p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.85; user-select: all; }
.foot-grid p.addr { user-select: all; white-space: pre-line; }
.copyright { text-align: center; font-size: 12px; color: var(--muted); margin: 26px 0 0; }

/* 大图预览 */
.lightbox {
  position: fixed; inset: 0; background: rgba(28, 22, 15, .88); z-index: 100;
  display: grid; place-items: center; padding: 30px; cursor: zoom-out;
}
.lb-inner { max-width: 92vw; max-height: 90vh; text-align: center; }
.lb-inner img { max-width: 100%; max-height: 82vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lb-cap { color: #f0e6d6; font-size: 14px; margin-top: 13px; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(14px);
  background: rgba(45, 36, 26, .94); color: #fff; padding: 12px 26px; border-radius: 26px;
  font-size: 13.5px; z-index: 200; opacity: 0; transition: .25s; pointer-events: none;
  max-width: 86vw; text-align: center; line-height: 1.6;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(168, 62, 42, .95); }

.honeypot { position: absolute !important; left: -9999px !important; opacity: 0; height: 0; }

/* 移动端 */
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 11px; }
  .brand-nav { align-self: stretch; }
  .brand-nav a { flex: 1; text-align: center; }
  .steps li { font-size: 0; }
  .steps li .n { margin-right: 0; }
  .btn { padding: 11px 20px; font-size: 14px; }
  .nav-hint { display: none; }
  .done-card { padding: 30px 20px; }
  .code-value { font-size: 19px; letter-spacing: 2px; }
  .imgrid { gap: 8px; }
  .imgopt .cap { font-size: 11px; }
}
