/* ============================================================
   HTML 分享 —— 全局样式
   中文 · 简洁 · 响应式（手机 / PC）
   ============================================================ */

:root {
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-faint: #9ca3af;
  --border: #e5e7eb;
  --bg: #f6f7fb;
  --card: #ffffff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #f6f7fb 0%, #eef1f8 100%);
  min-height: 100vh;
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ---------- 页头 ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: center;
}
.header-inner {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.logo-icon { width: 24px; height: 24px; color: var(--accent); }
.header-tag {
  font-size: 13px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ---------- 主容器 ---------- */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  flex: 1;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.step-head h2 { font-size: 17px; font-weight: 600; }
.step-badge {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 拖拽上传 ---------- */
.dropzone {
  border: 2px dashed #c7cbe0;
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
  background: #fbfbfe;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.dz-icon {
  width: 40px; height: 40px;
  color: var(--accent);
  margin: 0 auto 12px;
  display: block;
}
.dz-title { font-size: 15px; font-weight: 600; color: var(--text); }
.dz-sub { font-size: 13px; color: var(--text-faint); margin-top: 6px; }

/* ---------- 文件信息 ---------- */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  animation: fadeIn 0.2s ease;
}
.fi-icon { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.fi-text { flex: 1; min-width: 0; }
.fi-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
}
.fi-size { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.fi-remove {
  border: 0;
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.fi-remove:hover { background: rgba(79, 70, 229, 0.2); }

/* ---------- 设置 ---------- */
.setting-group { border: 0; margin-bottom: 20px; }
.setting-group legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 10px;
  padding: 0;
}
.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  cursor: pointer;
  font-size: 14px;
}
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-dot {
  width: 18px; height: 18px;
  border: 2px solid #c7cbe0;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}
.radio-row input:checked + .radio-dot { border-color: var(--accent); }
.radio-row input:checked + .radio-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.radio-row input:focus-visible + .radio-dot { box-shadow: 0 0 0 3px var(--accent-soft); }
.radio-text { color: var(--text); }

.text-input {
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  color: var(--text);
  transition: border-color 0.15s;
  background: #fff;
}
.text-input:focus { border-color: var(--accent); }
.text-input:disabled { background: #f3f4f6; color: var(--text-faint); }

.hint { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }

/* 有效期：宫格单选 */
.radio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.radio-tile {
  position: relative;
  cursor: pointer;
  text-align: center;
}
.radio-tile input { position: absolute; opacity: 0; pointer-events: none; }
.radio-tile span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-sub);
  background: #fff;
  transition: all 0.15s;
}
.radio-tile input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.radio-tile input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 主按钮 ---------- */
.primary-btn {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 4px;
}
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:active { transform: scale(0.99); }
.primary-btn:disabled { background: #a5b4fc; cursor: not-allowed; }

/* ---------- 上传进度 ---------- */
.progress { margin-top: 16px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}
.progress-inner {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.progress-text { font-size: 12px; color: var(--text-sub); margin-top: 6px; text-align: center; }

/* ---------- 错误提示 ---------- */
.error-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- 结果 ---------- */
.result-card { animation: fadeIn 0.25s ease; }
.success-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}
.success-icon svg { width: 28px; height: 28px; }
.result-tip { font-size: 14px; color: var(--text-sub); text-align: center; margin-bottom: 14px; }

.url-row { display: flex; gap: 8px; }
.url-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  outline: none;
  word-break: break-all;
}
.copy-btn {
  flex-shrink: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: var(--accent-dark); }
.copy-btn.copied { background: var(--success); }

.preview-link { text-align: center; margin-top: 10px; }
.preview-link a { color: var(--accent); font-size: 13px; text-decoration: none; }
.preview-link a:hover { text-decoration: underline; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.meta-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
}
.meta-label {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.meta-value {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
}
.result-hint { text-align: center; }

/* ---------- 底部 ---------- */
.site-footer {
  text-align: center;
  padding: 20px 16px 32px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.8;
}
.footer-sub { opacity: 0.8; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.25);
  z-index: 100;
  animation: toastIn 0.2s ease;
}
.toast.hide { animation: toastOut 0.3s ease forwards; }

/* ---------- 动画 ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translate(-50%, 10px); }
}

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
  .header-tag { display: none; }
  .container { padding: 16px 12px 32px; }
  .card { padding: 18px 16px; }
  .radio-grid { grid-template-columns: repeat(3, 1fr); }
  .dropzone { padding: 32px 14px; }
  .url-row { flex-direction: column; }
  .copy-btn { width: 100%; padding: 12px; }
}

@media (min-width: 601px) {
  .radio-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   v2：我的分享（折叠面板，默认收起，保证第一屏简洁）
   ============================================================ */

/* 左上角折叠按钮 */
.history-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}
.history-toggle:hover { border-color: var(--accent); color: var(--accent); }
.history-toggle.open {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.history-toggle:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.ht-icon { width: 14px; height: 14px; }
.ht-caret { width: 12px; height: 12px; transition: transform 0.15s; }
.history-toggle.open .ht-caret { transform: rotate(180deg); }
.history-count {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
}

/* 折叠面板 */
.history-panel {
  width: 100%;
  max-width: 680px;
  margin: 16px auto -4px;
  padding: 0 16px;
  animation: fadeIn 0.2s ease;
}
.panel-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-sub { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.panel-close {
  border: 0;
  background: rgba(31, 41, 55, 0.06);
  color: var(--text-sub);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.panel-close:hover { background: rgba(31, 41, 55, 0.12); }
.panel-tip {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 12px;
  line-height: 1.6;
}

/* 历史列表 */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.hs-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 18px 0;
}
.hs-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.hs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hs-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hs-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--success);
}
.hs-badge.expired { background: #f3f4f6; color: var(--text-faint); }
.hs-note { font-size: 12px; color: var(--text-sub); margin-top: 6px; line-height: 1.5; }
.hs-times { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.hs-url { display: flex; gap: 6px; margin-top: 8px; }
.hs-url input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--accent);
  background: #fbfbfe;
  outline: none;
}
.hs-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hs-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-sub);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.hs-btn:hover { border-color: var(--accent); color: var(--accent); }
.hs-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* 编辑区（修改有效期 / 修改密码） */
.hs-editor {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.hs-editor-label { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.hs-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.hs-opt {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-sub);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.hs-opt:hover { border-color: var(--accent); color: var(--accent); }
.hs-pw-row { display: flex; gap: 6px; }
.hs-pw-row input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.hs-pw-row input:focus { border-color: var(--accent); }

/* 结果卡片的备注回显 */
.result-note { text-align: left; margin-top: 10px; }

/* 移动端：折叠按钮只留图标与计数 */
@media (max-width: 600px) {
  .ht-text { display: none; }
  .history-panel { padding: 0 12px; margin-top: 12px; }
}