/* ============================================================
   4w 图床 · 样式表
   设计语言：极简留白（无阴影 · 细线 · 大留白 · 下沉的强调色）
   零依赖 · 零内联样式 · 兼容严格 CSP（style-src 'self'）
   ============================================================ */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --line: #e4e7eb;        /* 常规分割线 */
  --line2: #cfd6dd;       /* 控件边框，比分割线略深 */
  --text: #1b2839;
  --dim: #5b6b7f;
  --faint: #94a3b3;
  --accent: #0b7285;      /* 下沉的青色，不用高饱和蓝紫 */
  --accent-d: #095c6b;
  --accent-soft: #e3f4f7;
  --err: #c92a2a;
  --err-soft: #fff5f5;
  --warn-bg: #fffbf0;
  --warn-line: #f0dfb8;
  --warn-text: #8a6116;
  --ok: #0b7285;
  --r: 5px;               /* 统一小圆角 */
  --maxw: 960px;
  --maxw-wide: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* ============================================================
   导航：下划线式，不用胶囊/背景块
   ============================================================ */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand {
  font-weight: 700; font-size: 17px; letter-spacing: -.01em;
  color: var(--text); text-decoration: none;
}
.nav nav { display: flex; gap: 22px; }
.nav nav a {
  padding: 2px 0; font-size: 15px; color: var(--dim);
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav nav a:hover { color: var(--text); }
.nav nav a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ============================================================
   容器
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 44px 32px 80px; }
.wrap.wide { max-width: var(--maxw-wide); }
@media (max-width: 1280px) { .wrap.wide { max-width: 100%; } }
@media (max-width: 720px) {
  .nav { padding: 16px 20px; }
  .nav nav { gap: 16px; }
  .wrap { padding: 28px 20px 60px; }
}

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 30px;
  margin-bottom: 26px;
}
.card h1, h1 { font-size: 21px; font-weight: 680; letter-spacing: -.02em; margin: 0 0 10px; }
.card > :last-child { margin-bottom: 0; }

/* ============================================================
   统计：无卡片、无边框，只有大号强调色数字 + 一条底线
   ============================================================ */
.stats {
  display: flex; gap: 44px; flex-wrap: wrap;
  margin-bottom: 40px; padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.stat { flex: 0 1 auto; }
.stat b {
  display: block; font-size: 28px; font-weight: 700; line-height: 1.15;
  letter-spacing: -.03em; color: var(--accent);
}
.stat span { color: var(--faint); font-size: 13px; letter-spacing: .02em; }
@media (max-width: 560px) { .stats { gap: 26px; } .stat b { font-size: 23px; } }

/* ============================================================
   拖拽上传区
   ============================================================ */
.drop {
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 56px 24px;
  text-align: center;
  background: #fcfdfe;
  transition: border-color .15s, background .15s;
}
.drop.hover, .drop:hover { border-color: var(--accent); background: #f7fcfd; }
.drop-main { font-size: 18px; font-weight: 640; letter-spacing: -.01em; margin: 0 0 8px; }

/* ============================================================
   表单控件
   ============================================================ */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
input[type=password], input[type=text] {
  flex: 1 1 240px;
  padding: 11px 13px; font: inherit;
  border: 1px solid var(--line2); border-radius: var(--r);
  background: #fff; color: var(--text);
}
input[type=password]:focus, input[type=text]:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}

button {
  font: inherit; font-weight: 560;
  padding: 10px 20px; border-radius: var(--r); cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  transition: background .15s, border-color .15s, color .15s;
}
button:hover { background: var(--accent-d); border-color: var(--accent-d); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost {
  background: #fff; color: var(--accent); border-color: var(--line2);
}
button.ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* 破坏性操作走描边风格：视觉上不抢，但颜色说明后果 */
button.danger { background: #fff; color: var(--err); border-color: #f0c2c2; }
button.danger:hover { background: var(--err-soft); border-color: var(--err); color: var(--err); }
button.small { padding: 4px 12px; font-size: 12.5px; }
/* 文字按钮（如首页「选择文件」） */
button.link {
  background: none; border: 0; padding: 0; color: var(--accent);
  text-decoration: underline; font: inherit; cursor: pointer;
}
button.link:hover { background: none; color: var(--accent-d); }
kbd {
  background: #f7f8fa; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-size: 12.5px;
}

/* ============================================================
   提示条
   ============================================================ */
.alert {
  padding: 12px 16px; margin-bottom: 22px;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r); font-size: 14.5px; background: #fbfcfd;
}
.alert.err  { border-color: #f0c2c2; border-left-color: var(--err); background: var(--err-soft); color: var(--err); }
.alert.info { border-color: #bfe3e9; border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-d); }

.dim { color: var(--dim); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }

/* ============================================================
   上传结果区（标签页 + 文本框）
   ============================================================ */
.tabs { display: flex; gap: 0; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--dim); font-size: 14px; padding: 8px 14px;
}
.tab:hover { background: none; color: var(--text); border-bottom-color: var(--line2); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab.copy { margin-left: auto; color: var(--accent); border-bottom-color: transparent; }
.tab.copy:hover { color: var(--accent-d); border-bottom-color: var(--accent); }
textarea {
  width: 100%; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--line2); border-radius: var(--r);
  padding: 14px; resize: vertical; background: #fcfdfe; color: var(--text);
}
textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ============================================================
   广场网格
   ============================================================ */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  margin: 26px 0;
}
.cell {
  position: relative; display: block; aspect-ratio: 1/1; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r);
  background: #f1f3f5; transition: border-color .15s;
}
.cell:hover { border-color: var(--accent); }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 11px; padding: 4px 7px;
  background: rgba(255, 255, 255, .92); color: var(--dim);
  border-top: 1px solid var(--line);
}

.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin-top: 26px; font-size: 14px; }
.pager a { color: var(--accent); text-decoration: none; }
.pager a:hover { text-decoration: underline; }

/* ============================================================
   日志表：紧凑 5 列 + 操作列 sticky
   （9 列时删除按钮会被挤出屏幕，必须横向滚动才能看到）
   ============================================================ */
.tablewrap { overflow-x: auto; margin-top: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--faint); font-weight: 620; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
}
tbody tr:hover { background: #fafcfd; }

.thumbcell { width: 54px; padding: 8px 10px; }
.thumbcell img {
  display: block; width: 40px; height: 40px; object-fit: cover;
  border-radius: var(--r); border: 1px solid var(--line);
}
.thumbmissing {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r);
  border: 1px dashed var(--line2); color: var(--faint); font-size: 14px;
}
.maincell { min-width: 200px; }
.fname { font-weight: 620; color: var(--text); text-decoration: none; word-break: break-all; }
a.fname:hover { color: var(--accent); text-decoration: underline; }
.meta { margin-top: 3px; font-size: 12.5px; color: var(--faint); }
.timecell { white-space: nowrap; font-size: 13px; }
.uacell {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--faint); font-size: 12.5px; cursor: help;
}
/* 操作列固定在右侧：窄屏横向滚动时删除按钮也不会被挤出视野 */
.actcell, .acthead {
  position: sticky; right: 0; width: 82px; text-align: right;
  background: var(--card); box-shadow: -9px 0 9px -9px rgba(27, 40, 57, .1);
}
tbody tr:hover .actcell { background: #fafcfd; }
table form { margin: 0; }

.badge {
  display: inline-block; margin-left: 7px; padding: 1px 7px;
  border-radius: 3px; font-size: 11px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #bfe3e9;
}
.badge.via-api { background: #f1f3f5; color: var(--dim); border-color: var(--line); }
tr.row-gone td:not(.actcell) { opacity: .55; }

/* ============================================================
   消息页（错误提示 / 删除确认）
   必须走外链样式表：严格 CSP 的 style-src 'self'
   会同时拦掉内联 <style> 元素和 style="" 属性
   ============================================================ */
.msgpage { max-width: 620px; margin: 80px auto; padding: 0 32px; }
.msgpage h1 { font-size: 21px; font-weight: 680; letter-spacing: -.02em; margin: 0 0 12px; }
.msgpage img {
  max-width: 100%; display: block; margin: 18px 0;
  border: 1px solid var(--line); border-radius: var(--r);
}
.msgpage code {
  background: #f4f6f8; padding: 2px 7px; border-radius: 3px;
  font-size: 13px; word-break: break-all;
}
.msgpage .warn {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn-text); padding: 12px 16px;
  border-radius: var(--r); font-size: 14px; margin: 16px 0;
}
.msgpage .okmsg { color: var(--accent); font-size: 14px; }

/* ============================================================
   灯箱
   ============================================================ */
.lb {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100;
  background: rgba(10, 14, 20, .94);
  display: flex; align-items: center; justify-content: center;
}
.lb[hidden] { display: none; }
.lb-img {
  max-width: 92vw; max-height: 82vh; object-fit: contain;
  border-radius: var(--r); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lb-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 101;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; color: #fff;
}
.lb-cap {
  flex: 1; min-width: 0; font-size: 13px; opacity: .88;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-count { font-size: 13px; opacity: .6; white-space: nowrap; }
.lb-open { color: #fff; font-size: 13px; opacity: .72; white-space: nowrap; }
.lb-open:hover { opacity: 1; }
.lb-btn {
  flex: none; width: 38px; height: 38px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer;
  transition: background .15s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .26); border-color: rgba(255, 255, 255, .4); }
.lb-nav { position: fixed; top: 50%; margin-top: -19px; z-index: 101; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
body.lb-body-lock { overflow: hidden; }

@media (max-width: 640px) {
  .lb-img { max-width: 96vw; max-height: 74vh; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-btn { width: 34px; height: 34px; font-size: 16px; }
  .lb-nav { margin-top: -17px; }
  .lb-open { display: none; }
}

/* ============================================================
   页脚
   ============================================================ */
.foot {
  text-align: center; color: var(--faint); font-size: 13px;
  padding: 30px 20px 50px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.foot .dim { margin-left: 6px; }
