/* One shared palette keeps every theme template readable in both color modes. */
:root {
  color-scheme: light;
  --bg: #fafbf9; --sm-surface: #ffffff; --sm-soft: #f0f3f1;
  --ink: #24312e; --muted: #65746e; --line: #e1e7e3;
  --sky: #287d86; --sky-deep: #246b73; --sm-accent-soft: #e7f1ef;
  --sm-danger: #b73848; --sm-danger-bg: #fcecef;
  --sm-success: #287148; --sm-success-bg: #e9f4eb;
  --sm-warning: #815c22; --sm-warning-bg: #f7f1e4;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151d1b; --sm-surface: #1c2723; --sm-soft: #26322d;
  --ink: #e4ece7; --muted: #abbab2; --line: #35433b;
  --sky: #72bbb7; --sky-deep: #9acfc7; --sm-accent-soft: #293f39;
  --sm-danger: #ffb5c0; --sm-danger-bg: #42272e;
  --sm-success: #a7dbb6; --sm-success-bg: #243b2c;
  --sm-warning: #e2c58d; --sm-warning-bg: #3b3426;
}
html body { background: var(--bg); color: var(--ink); }
body .r1, body .r4, body .bg1, body .bg2, body .bg3, body .bg4 { background: var(--bg); border: 0; }
body .r1 { gap: 18px; }
body .r1 .logo, body .r4 .logo, body .d11 {
  border: 0; background: transparent; box-shadow: none; color: var(--sky-deep);
}
body .r1 .sitname { font-size: 20px; font-weight: 750; letter-spacing: .015em; }
body .r1 .search, body .c122 .box { border: 0; background: var(--sm-soft); box-shadow: none; }
body .r1 .search input, body .c122 input { color: var(--ink); }
body .r1 .search input::placeholder, body .inp::placeholder { color: var(--muted); }
body .r1 .avatar, body .b2mid .ava, body .item .face, body .author .face,
body .c1111, body .d13, body .need-login .nl-face, body .cmt-face {
  border: 0; box-shadow: none; background: var(--sm-soft); color: var(--ink);
}
body .r1 .uname, body .b2mid .nm { color: var(--muted); background: transparent; border: 0; }
/* Keep the avatar and switch on one centerline; the username has its own row.
   Matching top space keeps that centerline at the header's original midpoint. */
body .r1 .sm-header-actions {
  --sm-header-avatar: 54px; --sm-header-name: 18px;
  display: grid; flex: 0 0 auto; align-items: center;
  grid-template-columns: 76px var(--sm-header-avatar);
  grid-template-rows: max(44px, var(--sm-header-avatar)) var(--sm-header-name);
  column-gap: 14px; padding-top: var(--sm-header-name);
}
body .r1 .sm-header-actions .user { display: contents; margin: 0; }
body .r1 .sm-header-actions .avatar {
  grid-column: 2; grid-row: 1; align-self: center; justify-self: center;
  width: var(--sm-header-avatar); height: var(--sm-header-avatar); min-height: 0;
}
body .r1 .sm-header-actions .uname {
  grid-column: 2; grid-row: 2; align-self: center; justify-self: center;
  display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 0;
  padding: 0; font-size: 11px; line-height: var(--sm-header-name);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body .r1 .sm-theme-toggle { grid-column: 1; grid-row: 1; align-self: center; margin: 0; }
body .r1 .sm-header-actions--guestless {
  grid-template-columns: 76px; grid-template-rows: 44px; padding-top: 0;
}

/* Use spacing and type instead of boxed panels. Media keeps its natural corners. */
body .panel, body .paper, body .cmt-card, body .d1, body .b32, body .c11,
body .row, body .item, body .empty, body .need-login,
body .card, body .card .meta, body .form, body .msg, body .post,
body .s-item, body .s-out, body .cmt-item {
  border: 0; box-shadow: none; border-radius: 0; background: transparent;
}
body .card { border-radius: 8px; }
body .card:hover, body .row:hover { box-shadow: none; }
body .card .meta { padding: 12px 2px 4px; }
body .panel h3, body .b32 h4 { color: var(--muted); font-weight: 600; letter-spacing: .04em; }
body .menu a, body .menu button { background: transparent; color: var(--ink); border: 0; border-radius: 0; font-weight: 600; }
body .menu a:hover, body .menu button:hover { color: var(--sky-deep); background: transparent; text-decoration: underline; }
body .msg, body .post, body .item, body .cmt-item { color: var(--ink); }
body .post:hover, body .item:hover, body a.s-item:hover { background: var(--sm-soft); }
body .nav-btn { border: 0; box-shadow: none; background: var(--sm-soft); color: var(--ink); }
body .nav-btn:hover { background: var(--sm-accent-soft); color: var(--sky-deep); }
body .bar { background: var(--sky); }
body .bar b { color: var(--ink); }
body .holiday { background: var(--sm-accent-soft); color: var(--ink); border: 0; }
body .r5, body .bg5 { background: var(--sm-surface); }
body .r5 { border: 0; box-shadow: -10px 10px 36px #00000012; }
body .s-out { color: var(--sm-danger); }
body .s-out:hover { background: var(--sm-danger-bg); color: var(--sm-danger); }
body .c1back { border: 0; background: transparent; }
body .c121 { border: 0; }
body .c113, body .c114 button, body .btn.unfollow, body .otp-btn,
body .share, body .tag, body .cmt-lv, body .d18 {
  border: 0; box-shadow: none; background: var(--sm-accent-soft); color: var(--sky-deep);
}
body .c114 button { background: transparent; color: var(--sm-danger); }
body .c114 button:hover, body .btn.unfollow:hover { background: var(--sm-danger-bg); color: var(--sm-danger); }
body .c113.liked { background: var(--sm-accent-soft); color: var(--sky-deep); }
body .c113:hover, body .share:hover, body .otp-btn:hover, body .d18:hover {
  background: var(--sm-accent-soft); color: var(--sky-deep);
}
body .d1 .otp-btn:disabled, body .d1 .otp-btn:disabled:hover {
  background: var(--sm-soft); color: var(--muted); border: 0;
}
body .d13.has { border: 0; box-shadow: none; }
body .msg.pending, body .msg .badge, body .cmt-badge { background: var(--sm-warning-bg); color: var(--sm-warning); }
body .sm-msg.err { background: var(--sm-danger-bg); color: var(--sm-danger); border: 0; }
body .sm-msg.ok { background: var(--sm-success-bg); color: var(--sm-success); border: 0; }
body .b24 p, body .txt p, body .paper p, body .cmt-body,
body .lb, body .form label, body .comment-form label { color: var(--ink); }
body .b1 a, body .tip, body .d18 { color: var(--muted); }
body .b1 a.on, body .b1 a:hover, body .tip a, body .empty a, body .cmt-act a { color: var(--sky-deep); }
body .author-row { border: 0; }
body .author:hover { background: var(--sm-soft); }
body .slider { background: var(--sm-soft); }
body .slider .thumb { background: var(--sky); box-shadow: none; }

body .inp, body .form input, body .form textarea,
body .comment-form textarea, body .comment-form input[type="text"],
body .comment-form input[type="email"], body .comment-form input[type="url"],
body .post-password-form input[type="password"] {
  background: var(--sm-soft); color: var(--ink); border: 0; box-shadow: none;
}
body .inp:focus, body .form input:focus, body .form textarea:focus,
body .comment-form textarea:focus, body .comment-form input:focus { background: var(--sm-soft); box-shadow: none; }
body .r1 .search button, body .submit, body .cmt-submit, body .form button,
body .c122 button, body .btn.follow, body .need-login .nl-btn {
  background: var(--sky); color: #fff; border: 0; box-shadow: none;
}
html[data-theme="dark"] body .r1 .search button, html[data-theme="dark"] body .submit,
html[data-theme="dark"] body .cmt-submit, html[data-theme="dark"] body .form button,
html[data-theme="dark"] body .c122 button, html[data-theme="dark"] body .btn.follow,
html[data-theme="dark"] body .need-login .nl-btn { color: #142522; }
body .r1 .search button:hover, body .submit:hover, body .cmt-submit:hover,
body .form button:hover, body .c122 button:hover, body .btn.follow:hover,
body .need-login .nl-btn:hover { background: var(--sky-deep); }

/* Existing form layouts used left-floating labels; stack them for captcha room. */
body .stage { padding: 24px 20px; }
body .d1 { max-width: 420px; padding: 80px 24px 52px; gap: 12px; }
body .d1 .top { top: 12px; left: 24px; right: 24px; align-items: center; gap: 10px; }
body .d1 .d11 { width: 48px; height: 48px; flex-basis: 48px; font-size: 20px; }
body .d1 .d12 {
  align-self: center; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body .d1 .d13 { width: 64px; height: 64px; font-size: 28px; }
body .d1 form, body .d1 #regBox { gap: 12px; }
body .d1 .row { display: block; }
body .d1 .inp-wrap { width: 100%; }
body .d1 .lb { position: static; display: block; transform: none; margin: 0 0 6px; font-size: 13px; }
body .d1 .inp { min-height: 40px; padding: 10px 12px; }
body .d1 .otp-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; }
body .d1 .otp-wrap .lb { grid-column: 1 / -1; margin: 0; }
body .d1 .otp-btn { position: static; transform: none; padding: 9px 12px; }
body .d1 .sm-captcha-inline { margin: 4px 0; gap: 4px; }
body .d1 .submit { width: 100%; min-height: 40px; margin: 4px 0 0; }
body .d1 .tip { text-align: center; }
body .d1 .d18 { right: 24px; bottom: 12px; padding: 6px 10px; font-size: 12px; }

/* A keyboard focus indicator remains visible even in the borderless design. */
body a:focus-visible, body button:focus-visible, body input:focus-visible,
body textarea:focus-visible, body select:focus-visible {
  outline: 2px solid var(--sky-deep); outline-offset: 3px;
}
.r1 .search:focus-within { outline: 2px solid var(--sky-deep); outline-offset: 2px; }
.r1 .search input:focus-visible { outline: 0; }

body .r4 { position: relative; bottom: auto; padding-top: 26px; padding-bottom: 26px; }
body .r4 .f-legal, body .r4 .f-contact { color: var(--muted); border: 0; }
body .r4 .f-legal a, body .r4 .f-contact a { color: var(--sky-deep); }

/* Legacy archive / generic page wrappers set these colors inline. */
html[data-theme="dark"] body .wrap > .panel > [style*="color:"],
html[data-theme="dark"] body .wrap > .panel > article [style*="color:"],
html[data-theme="dark"] body .r5 .pts > span[style*="color:"] { color: var(--muted) !important; }
html[data-theme="dark"] body .wrap > article.panel > [style*="color:"],
html[data-theme="dark"] body .wrap > .panel > article h2 a[style*="color:"] { color: var(--ink) !important; }
body .wrap > .panel > article[style*="border-bottom:"] { border: 0 !important; }

@media (max-width: 1024px) {
  body .r1 { gap: 10px; }
  body .r1 .sitname { min-width: 0; max-width: calc(100vw - 220px); font-size: 16px; overflow: hidden; text-overflow: ellipsis; padding: 0; }
  body .r1 .sm-header-actions { --sm-header-avatar: 40px; column-gap: 10px; margin-left: auto; }
  body .r1 .search { order: 4; }
  body .r4 .f-legal, body .r4 .f-contact { padding-left: 0; }
}
@media (max-width: 768px) {
  body .r1 { gap: 7px; }
  body .r1 .logo { width: 40px; height: 40px; min-height: 40px; flex: 0 0 40px; aspect-ratio: 1; }
  body .r1 .sm-header-actions { --sm-header-avatar: 34px; --sm-header-name: 16px; column-gap: 8px; }
  body .r1 .sm-header-actions .uname { font-size: 10px; }
  body .r1 .sitname { font-size: 15px; max-width: calc(100vw - 194px); }
  body .stage { padding: 18px 14px; }
  body .d1 { padding: 72px 16px 48px; gap: 10px; }
  body .d1 .top { left: 16px; right: 16px; }
  body .d1 .d13 { width: 56px; height: 56px; font-size: 26px; }
  body .d1 form, body .d1 #regBox { gap: 10px; }
  body .d1 .d18 { right: 16px; }
  body .r4 { padding-top: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  body .card, body .row, body .nav-btn, body .r5, body .post, body .s-item,
  body .toast, body .inp { transition: none; }
}

/* 评论使用更中性的灰色，日夜模式均保持输入区对比度。 */
body .cmt-card{--cmt-soft:#e9eceb;--cmt-item:#f0f2f1;}
html[data-theme="dark"] body .cmt-card{--cmt-soft:#303735;--cmt-item:#242c29;}
body .cmt-card .comment-form textarea,
body .cmt-card .comment-form input[type="text"],
body .cmt-card .comment-form input[type="email"],
body .cmt-card .comment-form input[type="url"]{background:var(--cmt-soft);}
body .cmt-card .cmt-item{background:var(--cmt-item);border-radius:10px;}
/* Only the document scrolls at the page edge. Hidden overflow on body used to
   create a second scroll container and detach the sticky header from viewport. */
html{height:auto!important;min-height:100%;overflow-x:clip!important;overflow-y:auto!important;}
html body{overflow:visible!important;}
html body.admin-bar:not(.sm-kind-search):not(.sm-kind-space){height:auto!important;}
body>.r1{position:sticky;top:0;flex-shrink:0;z-index:40;}
body.admin-bar>.r1{top:var(--wp-admin--admin-bar--height,32px);}
body.admin-bar #wpadminbar{position:fixed!important;}
@media(max-width:1024px){html body{height:auto!important;min-height:100vh;}body.admin-bar{min-height:calc(100vh - var(--wp-admin--admin-bar--height,46px));}}
@media(max-width:782px){body.admin-bar>.r1{top:var(--wp-admin--admin-bar--height,46px);}}
