/* =====================================================================
 * mima20207  —  暖色护眼配色
 * 主色：#FBF5E9 (背景)  #F3E9D2 (卡面)  #8B5E3C (强调)  #3D2B1F (文字)
 * ===================================================================== */
:root {
  --bg: #FBF5E9;
  --bg-soft: #F3E9D2;
  --bg-deep: #ECDFC2;
  --surface: #FFFBF1;
  --accent: #8B5E3C;
  --accent-dark: #6B4323;
  --accent-light: #C89B7B;
  --text: #3D2B1F;
  --text-mute: #7A6A58;
  --danger: #B84B3D;
  --ok: #4E7C57;
  --amber: #C07A2E;
  --border: #E2D3B3;
  --shadow: 0 6px 18px rgba(80, 50, 15, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Helvetica Neue", Arial, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-deep); padding: 1px 6px; border-radius: 4px; font-family: Consolas, Menlo, monospace; font-size: 0.92em; }
img { max-width: 100%; display: block; }

/* -------- Buttons & forms -------- */
button, .btn, .btn-primary {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius);
  transition: all .15s ease;
}
button:hover, .btn:hover, .btn-primary:hover { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }
button.danger, .danger { background: #fff; color: var(--danger); border-color: #E5B4AE; }
button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  width: 100%;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-light);
  outline-offset: 1px;
  border-color: var(--accent);
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-mute); }
label > input, label > select, label > textarea { color: var(--text); }
small.hint { color: var(--text-mute); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin: 10px 0; font-size: 14px; }
.flash.ok  { background: #E8F0E3; color: var(--ok);     border: 1px solid #BEDAB7; }
.flash.err { background: #F8E3DF; color: var(--danger); border: 1px solid #E7BFB8; }

.muted { color: var(--text-mute); }
.tiny  { font-size: 12px; }

/* -------- Home / Login page -------- */
.home {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 0%, #F8EBCF 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, #F4E0BA 0%, transparent 55%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
}
.home-wrap {
  width: 100%; max-width: 420px;
  text-align: center;
}
.site-title {
  font-size: clamp(32px, 6vw, 48px);
  margin: 12px 0 4px; color: var(--accent-dark); letter-spacing: 2px;
}
.site-sub { color: var(--text-mute); margin-top: 0; }
.login-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface);
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.home-foot { margin-top: 28px; }
.admin-entry { color: var(--text-mute); font-size: 13px; }

.centered { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.notice-card { background: var(--surface); padding: 28px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; max-width: 480px; }
.password-card { max-width: 380px; }

/* -------- User backend layout -------- */
.user-layout {
  display: grid; grid-template-columns: 220px 1fr;
  min-height: 100dvh;
  background: var(--bg);
}
.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100dvh;
}
.sidebar .brand { font-size: 20px; font-weight: 700; color: var(--accent-dark); padding: 6px 8px; }
.sidebar .brand a { color: inherit; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: 15px;
}
.sidebar nav a:hover { background: var(--bg-deep); text-decoration: none; }
.sidebar nav a.on { background: var(--accent); color: #fff; }
.sidebar .logout { margin-top: auto; }
.sidebar .logout button { width: 100%; }

.content { padding: 24px; max-width: 100%; }
.content.narrow { max-width: 820px; margin: 0 auto; }
.page-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.page-head h1 { margin: 0; font-size: 24px; color: var(--accent-dark); }
.page-head small { color: var(--text-mute); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 18px; color: var(--accent-dark); }

.form-grid { display: grid; gap: 12px; }
.form-grid.inline { grid-template-columns: 1fr 1fr auto; align-items: end; }
.form-grid.inline-form { grid-template-columns: 1fr 1fr; align-items: end; }
.inline-form { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.log-form textarea {
  font-family: "Microsoft YaHei","微软雅黑", Consolas, monospace;
  font-size: 15px; line-height: 1.75;
}

/* -------- Stats -------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); padding: 20px; border-radius: 14px; border: 1px solid var(--border); text-align: center; box-shadow: var(--shadow); color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--accent-light); }
.stat .num { font-size: 28px; color: var(--accent-dark); font-weight: 700; }
.stat .lbl { color: var(--text-mute); font-size: 14px; }

.quick { display: flex; flex-wrap: wrap; gap: 10px; }
.tips { margin: 0; padding-left: 22px; color: var(--text-mute); }

/* -------- Tables -------- */
.table-scroll { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th, .data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data th { color: var(--text-mute); font-weight: 600; background: var(--bg-soft); }
.data td.muted { color: var(--text-mute); text-align: center; padding: 20px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.pill.gray  { background: var(--bg-deep); color: var(--text-mute); }
.pill.green { background: #E3EFDE; color: var(--ok); }
.pill.amber { background: #FAEBD3; color: var(--amber); }

details > summary { cursor: pointer; color: var(--accent-dark); }
details[open] { background: var(--bg-soft); padding: 8px; border-radius: 8px; margin-top: 6px; }

/* -------- Gallery -------- */
.grid-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.gcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.gcard > a { display: block; aspect-ratio: 4/3; overflow: hidden; background: var(--bg-deep); }
.gcard img { width: 100%; height: 100%; object-fit: cover; }
.gcard .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.gcard .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .sub  { color: var(--text-mute); font-size: 12px; }
.gcard .slug { font-size: 12px; }
.gcard .actions { gap: 6px; }
.gcard .actions form { margin: 0; }

/* -------- Share pages (public) -------- */
.share-layout { min-height: 100dvh; background: var(--bg); padding: 0; }
.share-top {
  background: var(--bg-soft); border-bottom: 1px solid var(--border);
  padding: 12px 18px; display: flex; align-items: center; gap: 10px;
}
.share-top .brand { font-weight: 700; color: var(--accent-dark); }
.share-foot { text-align: center; padding: 22px 16px; }

.log-article {
  max-width: 820px; margin: 24px auto; padding: 0 18px;
}
.log-title { font-size: clamp(22px, 4vw, 32px); color: var(--accent-dark); margin-bottom: 6px; }
.log-meta  { color: var(--text-mute); font-size: 14px; display: flex; flex-wrap: wrap; gap: 14px; border-bottom: 1px dashed var(--border); padding-bottom: 10px; }
.log-body {
  font-family: "Microsoft YaHei","微软雅黑", Consolas, monospace;
  font-size: 17px; line-height: 1.95;
  color: var(--text);
  background: var(--surface);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-top: 18px;
  white-space: pre-wrap;       /* 保留代码与换行 */
  word-wrap: break-word;
  overflow-x: auto;
}

.tag-section, .file-section { max-width: 820px; margin: 24px auto; padding: 0 18px; }
.tag-section h1 { color: var(--accent-dark); }
.log-list { list-style: none; padding: 0; }
.log-list li { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-list li a { font-size: 17px; font-weight: 600; }

.file-section .file-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 14px 0; text-align: center; }
.file-section img { display: inline-block; max-height: 70vh; border-radius: 8px; }
.file-section .file-name { color: var(--accent-dark); word-break: break-all; }

/* -------- Responsive: mobile -------- */
.nav-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 18px; box-shadow: var(--shadow); }

@media (max-width: 820px) {
  .user-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 80%; max-width: 280px;
    transform: translateX(-110%); transition: transform .22s ease; z-index: 60;
    box-shadow: 0 0 24px rgba(0,0,0,.12);
  }
  .user-layout.nav-open .sidebar { transform: translateX(0); }
  .user-layout.nav-open::after {
    content:""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55;
  }
  .nav-toggle { display: inline-flex; }
  .content { padding: 64px 14px 24px; }

  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid.inline { grid-template-columns: 1fr; }
  .form-grid.inline-form { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .site-title { letter-spacing: 1px; }
  .card { padding: 14px; }
  .log-body { padding: 16px; font-size: 16px; }
}

/* --- 确保大号输入在手机上不自动缩放 --- */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px; }
}
