/* 白屿 · 用户中心. Built on the 光屿 theme tokens, with fallbacks for other themes. */
.byu-main {
  --byu-surface: var(--by-surface, #172024);
  --byu-raised: var(--by-surface-raised, #1d272c);
  --byu-gold: var(--by-gold, #d5aa6a);
  --byu-gold-light: var(--by-gold-light, #efc788);
  --byu-text: var(--by-text, #f0f1ec);
  --byu-muted: var(--by-muted, #bdc4c7);
  --byu-subtle: var(--by-subtle, #8e9a9f);
  --byu-border: var(--by-border, rgba(192, 204, 209, .13));
  --byu-border-strong: var(--by-border-strong, rgba(192, 204, 209, .24));
  --byu-radius: var(--by-radius, 12px);
  margin-bottom: 56px;
}
.byu-icon { width: 17px; height: 17px; flex-shrink: 0; }

/* Header entry */
.byu-header-slot { display: flex; align-items: center; }
.by-header .byu-header-btn { gap: 8px; min-height: 42px; max-width: 168px; padding: 6px 13px 6px 8px; color: #d3e9ee; border-color: #95cbda33; background: #c0e9ff05; }
.by-header .byu-header-btn:hover, .by-header .byu-header-btn:focus-visible { border-color: #95dcec88; background: #8adaff12; color: #eef9fb; }
.by-header .byu-header-btn.is-guest { padding-left: 12px; }
.byu-header-btn .byu-header-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.byu-header-avatar, .byu-avatar { display: inline-grid; flex-shrink: 0; place-items: center; border-radius: 50%; color: #271b0d; font-weight: 700; background: linear-gradient(135deg, #ebc17f, #c99a59); }
.byu-header-avatar { width: 28px; height: 28px; font-size: 13px; }
.byu-header-btn.is-loading .byu-header-avatar { background: #ffffff14; color: transparent; }
.byu-header-avatar.has-img, .byu-avatar.has-img { overflow: hidden; background: #0f1a1e; }
.byu-header-avatar.has-img img, .byu-avatar.has-img img { display: block; width: 100%; height: 100%; }

/* Favorite button on the resource page */
.byu-intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.byu-fav-btn { gap: 7px; }
.byu-fav-btn .byu-icon { width: 16px; height: 16px; transition: fill 160ms ease; }
.byu-fav-btn[aria-pressed="true"] { color: var(--by-gold-light, #efc788); border-color: #d5aa6a99; background: rgba(213, 170, 106, .08); }
.byu-fav-btn[aria-pressed="true"] .byu-icon { fill: currentColor; }
.byu-fav-btn[disabled] { opacity: .6; cursor: progress; }

/* Login and registration */
.byu-auth { width: min(100%, 460px); margin: 44px auto 0; padding: 34px 34px 28px; border: 1px solid var(--byu-border); border-radius: 16px; background: linear-gradient(180deg, #19242a, #141d21); box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
.byu-auth h1 { margin: 0 0 8px; font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif; font-size: 28px; font-weight: 650; letter-spacing: .04em; line-height: 1.35; }
.byu-lead { margin: 0 0 24px; color: var(--byu-muted); font-size: 13px; line-height: 1.8; }
.byu-form { display: grid; gap: 16px; }
.byu-field { display: grid; gap: 7px; margin: 0; }
.byu-field > label { color: #dfe5e6; font-size: 13px; font-weight: 600; }
.byu-field small { color: var(--byu-subtle); font-size: 12px; line-height: 1.6; }
.byu-optional { margin-left: 4px; color: var(--byu-subtle); font-size: 12px; font-weight: 400; }
.byu-form input[type="text"], .byu-form input[type="email"], .byu-form input[type="password"] { width: 100%; min-width: 0; height: 46px; padding: 10px 14px; border: 1px solid rgba(218, 225, 226, .22); border-radius: 9px; outline: 0; color: var(--byu-text); font: inherit; font-size: 15px; background: rgba(10, 17, 20, .55); transition: border-color 160ms ease, box-shadow 160ms ease; }
.byu-form input:focus { border-color: var(--byu-gold); box-shadow: 0 0 0 3px rgba(213, 170, 106, .14); }
.byu-form input:disabled { color: var(--byu-subtle); background: rgba(255, 255, 255, .025); }
.byu-form input[aria-invalid="true"] { border-color: #d77a6a; }
.byu-pass { position: relative; display: block; }
.byu-pass input { padding-right: 64px !important; }
.byu-pass-toggle { position: absolute; top: 50%; right: 6px; min-height: 34px; padding: 4px 10px; border: 0; border-radius: 6px; color: var(--byu-gold); font-size: 12px; background: transparent; transform: translateY(-50%); cursor: pointer; }
.byu-pass-toggle:hover, .byu-pass-toggle:focus-visible { background: rgba(213, 170, 106, .08); }
.byu-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.byu-check { display: inline-flex; align-items: flex-start; gap: 8px; color: var(--byu-muted); font-size: 13px; line-height: 1.6; cursor: pointer; }
.byu-check input { flex-shrink: 0; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--byu-gold); }
.byu-check a, .byu-link, .byu-switch a { color: var(--byu-gold); }
.byu-check a:hover, .byu-link:hover, .byu-switch a:hover { color: var(--byu-gold-light); text-decoration: underline; }
.byu-link { font-size: 13px; }
.byu-submit { width: 100%; min-height: 46px; margin-top: 4px; font-size: 15px; }
.byu-switch { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--byu-border); color: var(--byu-subtle); font-size: 13px; text-align: center; }
.byu-switch a { margin-left: 4px; font-weight: 600; }
.byu-trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.byu-alert { margin: 0 0 18px; padding: 11px 14px; border: 1px solid; border-radius: 9px; font-size: 13px; line-height: 1.7; }
.byu-alert p { margin: 0; }
.byu-alert p + p { margin-top: 4px; }
.byu-alert a { color: inherit; text-decoration: underline; }
.byu-alert-error { color: #f3c6bd; border-color: rgba(215, 122, 106, .45); background: rgba(215, 122, 106, .09); }
.byu-alert-ok { color: #cdebd3; border-color: rgba(128, 196, 146, .4); background: rgba(128, 196, 146, .08); }

/* User center */
.byu-profile { display: flex; align-items: center; gap: 18px; padding: 24px 26px; border: 1px solid var(--byu-border); border-radius: var(--byu-radius); background: linear-gradient(120deg, #1b262c, #141c20 70%); }
.byu-avatar { width: 58px; height: 58px; font-size: 24px; box-shadow: 0 0 0 4px rgba(213, 170, 106, .12); }
.byu-profile-text { min-width: 0; flex: 1; }
.byu-profile h1 { margin: 0 0 4px; overflow: hidden; font-size: 24px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.byu-profile p { margin: 0; color: var(--byu-subtle); font-size: 13px; }
.byu-profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.byu-tabs { display: flex; gap: 6px; margin: 18px 0 22px; padding: 5px; overflow-x: auto; border: 1px solid var(--byu-border); border-radius: 12px; background: #111a1e; scrollbar-width: none; }
.byu-tabs::-webkit-scrollbar { display: none; }
.byu-tabs a { display: inline-flex; flex-shrink: 0; align-items: center; gap: 8px; min-height: 42px; padding: 9px 16px; border-radius: 8px; color: var(--byu-muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color 160ms ease, background 160ms ease; }
.byu-tabs a:hover { color: var(--byu-text); background: rgba(255, 255, 255, .03); }
.byu-tabs a[aria-current="page"] { color: var(--byu-gold-light); background: rgba(213, 170, 106, .1); box-shadow: inset 0 0 0 1px rgba(213, 170, 106, .28); }
.byu-tabs small { min-width: 22px; padding: 1px 7px; border-radius: 10px; color: var(--byu-subtle); font-size: 11px; text-align: center; background: rgba(255, 255, 255, .06); }
.byu-tabs a[aria-current="page"] small { color: #271b0d; background: var(--byu-gold); }
.byu-empty .by-btn { margin-top: 2px; }

.byu-fav { position: relative; display: flex; min-width: 0; flex-direction: column; }
.byu-fav > .by-card { flex: 1; }
.byu-unfav { position: absolute; z-index: 4; top: 10px; right: 10px; margin: 0; }
.byu-unfav-btn { min-height: 30px; padding: 4px 11px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 15px; color: #f0e4d2; font-size: 12px; background: rgba(12, 18, 21, .78); cursor: pointer; backdrop-filter: blur(6px); transition: border-color 160ms ease, color 160ms ease; }
.byu-unfav-btn:hover, .byu-unfav-btn:focus-visible { border-color: var(--byu-gold); color: var(--byu-gold-light); }
.byu-card-plain { padding: 18px; border: 1px solid var(--byu-border); border-radius: var(--byu-radius); background: var(--byu-surface); }
.byu-card-plain h3 { margin: 0; font-size: 15px; }

.byu-panel { padding: 24px 26px; border: 1px solid var(--byu-border); border-radius: var(--byu-radius); background: #151f23; }
.byu-panel > .by-section-title { margin-bottom: 18px; font-size: 20px; }
.byu-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.byu-panel-head .by-section-title { font-size: 20px; }
.byu-inline-form { margin: 0; }
.byu-history { margin: 0; padding: 0; list-style: none; }
.byu-history li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 2px; border-top: 1px solid var(--byu-border); }
.byu-history li:first-child { border-top: 0; }
.byu-history-main { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.byu-history-main a { min-width: 0; overflow-wrap: anywhere; color: var(--byu-text); font-size: 14px; font-weight: 500; }
.byu-history-main a:hover { color: var(--byu-gold-light); }
.byu-history time { flex-shrink: 0; color: var(--byu-subtle); font-size: 12px; }
.byu-chip { display: inline-block; padding: 1px 9px; border: 1px solid rgba(147, 219, 234, .22); border-radius: 10px; color: #b9e3ec; font-size: 11px; line-height: 1.7; }
.byu-muted { color: var(--byu-subtle); font-size: 13px; }
.byu-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.byu-settings .byu-form { max-width: 440px; }
.byu-settings .byu-form > .by-btn { justify-self: start; }
.byu-avatar-panel { grid-column: 1 / -1; }
.byu-avatar-panel .byu-form { max-width: none; }
.byu-avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.byu-avatar-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border: 1px solid var(--byu-border); border-radius: 12px; color: var(--byu-muted); font-size: 13px; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, color 160ms ease; }
.byu-avatar-opt:hover { border-color: var(--byu-border-strong); background: rgba(255, 255, 255, .02); }
.byu-avatar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.byu-avatar-opt img, .byu-avatar-initial { width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 0 0 2px transparent; transition: box-shadow 160ms ease; }
.byu-avatar-initial { display: grid; place-items: center; color: #271b0d; font-size: 22px; font-weight: 700; background: linear-gradient(135deg, #ebc17f, #c99a59); }
.byu-avatar-opt:has(input:checked) { border-color: rgba(213, 170, 106, .6); color: var(--byu-gold-light); background: rgba(213, 170, 106, .07); }
.byu-avatar-opt input:checked ~ img, .byu-avatar-opt input:checked ~ .byu-avatar-initial { box-shadow: 0 0 0 2px #0f171a, 0 0 0 4px var(--byu-gold); }
.byu-avatar-opt input:focus-visible ~ img, .byu-avatar-opt input:focus-visible ~ .byu-avatar-initial { outline: 2px solid var(--byu-gold-light); outline-offset: 5px; }
.byu-danger { grid-column: 1 / -1; border-color: rgba(215, 122, 106, .25); }
.byu-danger > p { margin: -6px 0 16px; }
.byu-btn-danger { justify-self: start; color: #f3c6bd; border-color: rgba(215, 122, 106, .5); background: rgba(215, 122, 106, .08); }
.byu-btn-danger:hover { color: #fff; border-color: #d77a6a; background: rgba(215, 122, 106, .18); }

@media (max-width: 900px) {
  .by-header .byu-header-btn .byu-header-name { display: none; }
  .by-header .byu-header-btn { width: 42px; padding: 6px; }
  .by-header .byu-header-btn.is-guest { width: auto; padding-inline: 12px; }
  .byu-settings { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .by-header .byu-header-btn.is-guest { width: 42px; padding: 9px; }
  .by-header .byu-header-btn.is-guest .byu-header-name { display: none; }
  .byu-auth { margin-top: 18px; padding: 26px 20px 22px; border-radius: 14px; }
  .byu-auth h1 { font-size: 24px; }
  .byu-form input[type="text"], .byu-form input[type="email"], .byu-form input[type="password"] { font-size: 16px; }
  .byu-profile { flex-wrap: wrap; gap: 14px; padding: 18px; }
  .byu-avatar { width: 48px; height: 48px; font-size: 20px; }
  .byu-profile h1 { font-size: 20px; }
  .byu-profile-actions { width: 100%; }
  .byu-profile-actions .by-btn { flex: 1; }
  .byu-tabs { gap: 4px; margin: 14px 0 18px; padding: 4px; }
  .byu-tabs a { flex: 1 1 0; justify-content: center; gap: 5px; min-width: 0; padding-inline: 6px; font-size: 13px; }
  .byu-tabs small { min-width: 18px; padding-inline: 5px; }
  .byu-panel { padding: 18px 16px; }
  .byu-history li { align-items: flex-start; flex-direction: column; gap: 6px; }
  .byu-intro-actions .by-btn { flex: 1; }
  .byu-avatar-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
  .byu-avatar-opt { padding: 10px 4px 8px; font-size: 12px; }
  .byu-avatar-opt img, .byu-avatar-initial { width: 48px; height: 48px; }
}
@media (max-width: 400px) {
  .byu-tabs .byu-icon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .byu-fav-btn .byu-icon, .byu-tabs a, .byu-form input, .byu-unfav-btn, .byu-avatar-opt, .byu-avatar-opt img, .byu-avatar-initial { transition: none; }
}
