/* 账户中心（登录后）。平面设计，不用渐变；颜色全部来自 theme.css（浅色 / 深色）。
   结构：顶栏 + 左侧导航 + 内容区；内容按「分组 → 行」排列，像系统设置页。 */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.acct-body {
  margin: 0;
  min-height: 100vh;
  background: var(--m-bg);
  color: var(--m-text);
  font: 14px/1.55 var(--m-font);
  -webkit-font-smoothing: antialiased;
}
.acct-body a { color: inherit; }
.acct-body svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ── 顶栏 ─────────────────────────────────────────────── */
.acct-top {
  position: sticky; top: 0; z-index: 20;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px;
  background: var(--m-bg);
  border-bottom: 1px solid var(--m-line);
}
.acct-brand { margin: 0; font-size: 16px; }
.acct-top-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acct-me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-me-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--m-muted); }

/* 分段控件（外观切换） */
.seg {
  display: inline-flex; gap: 2px; padding: 2px;
  border: 1px solid var(--m-line); border-radius: 8px; background: var(--m-surface-2);
}
.seg button {
  height: 26px; min-width: 30px; padding: 0 8px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--m-muted);
  cursor: pointer;
}
.seg button:hover { color: var(--m-text); }
.seg button[aria-checked="true"] { background: var(--m-surface); color: var(--m-text); box-shadow: 0 0 0 1px var(--m-line); }
.seg svg { width: 15px; height: 15px; }

/* ── 布局 ─────────────────────────────────────────────── */
.acct-layout {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px;
  padding: 28px 24px 80px;
}
.acct-nav { position: sticky; top: 84px; align-self: start; display: grid; gap: 2px; }
.acct-nav a {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--m-muted); text-decoration: none;
}
.acct-nav a:hover { background: var(--m-hover); color: var(--m-text); }
.acct-nav a[aria-current="page"] { background: var(--m-selected); color: var(--m-text); font-weight: 500; }

.acct-main { min-width: 0; max-width: 760px; }
.acct-page { display: grid; gap: 28px; }
.acct-page-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.acct-main > .identity-message { margin: 0 0 20px; }

/* ── 分组与行 ─────────────────────────────────────────── */
.section { display: grid; gap: 10px; margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head p { margin: 0; color: var(--m-muted); font-size: 13px; flex-basis: 100%; }

.group {
  margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--m-line); border-radius: 10px;
  background: var(--m-surface);
}
.row {
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; padding: 14px 18px;
  border-top: 1px solid var(--m-line);
}
.group > .row:first-child,
.group > :first-child > .row:first-child,
.group > :not([hidden]):first-child .row { border-top: 0; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 500; overflow-wrap: anywhere; }
.row-desc { margin: 2px 0 0; color: var(--m-muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
p.row-desc { margin: 0; }
.row-desc b { color: var(--m-text); font-weight: 600; }
.row-control { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.row > b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.row-top { align-items: flex-start; }
.row-stack { flex-direction: column; align-items: stretch; gap: 8px; }
.row-stack .row-control { justify-content: flex-start; margin-top: 4px; }
.row-footer { justify-content: space-between; background: var(--m-bg-subtle); border-radius: 0 0 10px 10px; }
.row-footer .row-desc { flex: 1; }
.mono { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 输入控件 */
.row-field input,
.row-field select,
.row-field textarea {
  width: 280px; max-width: 100%;
  height: 34px; padding: 0 10px;
  border: 1px solid var(--m-input-line); border-radius: 8px;
  background: var(--m-surface); color: var(--m-text);
  font: 14px var(--m-font); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.row-field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.row-field select { padding-right: 6px; }
.row-field input:hover, .row-field select:hover, .row-field textarea:hover { border-color: var(--m-line-strong); }
.row-field input:focus, .row-field select:focus, .row-field textarea:focus { border-color: var(--m-accent); box-shadow: 0 0 0 3px var(--m-info-bg); }
.row-field input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--m-danger); }
#email-input, #delete-username { width: 220px; }

/* ── 按钮、标签 ───────────────────────────────────────── */
.acct-btn,
#binding-rows button {
  height: 32px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--m-line-strong); border-radius: 8px;
  background: var(--m-surface); color: var(--m-text);
  font: 500 13px var(--m-font); text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.acct-btn:hover, #binding-rows button:hover { background: var(--m-hover); }
.acct-btn:focus-visible, #binding-rows button:focus-visible, .acct-link:focus-visible,
.acct-nav a:focus-visible, .seg button:focus-visible, .tag-copy:focus-visible, .avatar-edit:focus-visible { outline: 2px solid var(--m-focus); outline-offset: 2px; }
.acct-btn:disabled, #binding-rows button:disabled { opacity: .45; cursor: not-allowed; }
.acct-btn-primary { background: var(--m-accent); border-color: var(--m-accent); color: var(--m-on-accent); }
.acct-btn-primary:hover { background: var(--m-accent-hover); border-color: var(--m-accent-hover); }
.acct-btn-quiet, #binding-rows button.ghost-btn { border-color: transparent; background: transparent; }
.acct-btn-quiet:hover { background: var(--m-hover); }
.acct-btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.acct-btn-danger { color: var(--m-danger); border-color: var(--m-danger-line); }
.acct-btn-danger:hover { background: var(--m-danger-bg); }

.acct-link { padding: 0; border: 0; background: none; cursor: pointer; color: var(--m-link) !important; font: inherit; font-size: 13px; text-decoration: none; }
.acct-link:hover { text-decoration: underline; }

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 99px; background: var(--m-surface-2); color: var(--m-muted);
  font-size: 12px; font-weight: 500; white-space: nowrap; vertical-align: 1px;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.pill-ok { background: var(--m-ok-bg); color: var(--m-ok); }
.pill-warn { background: var(--m-warn-bg); color: var(--m-warn); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 6px;
  border: 1px solid var(--m-line); background: var(--m-surface-2);
  color: var(--m-muted); font: 12px var(--m-font);
}
.tag b { color: var(--m-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tag-copy { cursor: pointer; }
.tag-copy:hover { border-color: var(--m-line-strong); }
.tag-copy svg { width: 12px; height: 12px; }
.tag-warn { background: var(--m-warn-bg); border-color: transparent; color: var(--m-warn); }

/* ── 头像 ─────────────────────────────────────────────── */
.avatar, .avatar-initial {
  border-radius: 50%; overflow: hidden; flex: none;
  display: grid; place-items: center;
  background: var(--m-selected); color: var(--m-text); font-weight: 600; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

.idcard-avatar { position: relative; width: 76px; height: 76px; flex: none; }
.idcard-avatar img, .avatar-initial { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; font-size: 30px; }
.avatar-edit {
  position: absolute; right: -4px; bottom: -4px;
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--m-line-strong); background: var(--m-surface); color: var(--m-text);
  cursor: pointer;
}
.avatar-edit:hover { background: var(--m-hover); }
.avatar-edit svg { width: 15px; height: 15px; }

/* ── 概览 ─────────────────────────────────────────────── */
.profile-card { display: flex; align-items: flex-start; gap: 20px; padding: 22px; }
.profile-card-text { flex: 1; min-width: 0; }
.profile-card-text h2 { margin: 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.profile-card-sub { margin: 2px 0 0; color: var(--m-muted); overflow-wrap: anywhere; }
.profile-card-sub .dot { margin: 0 6px; color: var(--m-faint); }
.profile-card-bio { margin: 10px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.profile-card-bio.empty { color: var(--m-faint); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--m-line); border-radius: 10px; background: var(--m-surface); }
.stat { display: grid; gap: 2px; padding: 14px 18px; border-left: 1px solid var(--m-line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat span { color: var(--m-muted); font-size: 12px; }
.stat b { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.check-icon {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.check-ok .check-icon { background: var(--m-ok-bg); color: var(--m-ok); }
.check-todo .check-icon { background: var(--m-warn-bg); color: var(--m-warn); }

.method-badge {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--m-surface-2); color: var(--m-muted); font-size: 13px; font-weight: 700;
}

/* ── 绑定行（app.js 生成：.binding-row > p + .actions） ─── */
.binding-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--m-line); }
.binding-row p { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.binding-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
#binding-confirmation { background: var(--m-info-bg); }

/* ── 游戏 ─────────────────────────────────────────────── */
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--m-surface-2); color: var(--m-text); font-weight: 600; font-size: 13px;
}

/* ── 危险 ─────────────────────────────────────────────── */
.group-danger { border-color: var(--m-danger-line); }

/* 复制等轻提示 */
.acct-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  padding: 8px 14px; border-radius: 8px;
  background: var(--m-text); color: var(--m-bg); font-size: 13px;
  transition: opacity .15s, transform .15s;
}
.acct-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 响应式 ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .acct-layout { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 60px; }
  .acct-nav {
    position: sticky; top: 56px; z-index: 10;
    display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 8px 16px;
    background: var(--m-bg); border-bottom: 1px solid var(--m-line);
  }
  .acct-nav::-webkit-scrollbar { display: none; }
  .acct-nav a { flex: none; height: 34px; }
  .acct-nav svg { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--m-line); }
}
@media (max-width: 600px) {
  .acct-top { padding: 0 16px; gap: 8px; }
  .acct-brand > span:last-child, .acct-me { display: none; }
  .profile-card { flex-wrap: wrap; padding: 18px; }
  .profile-card > .acct-btn { width: 100%; }
  .row { flex-wrap: wrap; padding: 14px 16px; }
  .row-field { flex-direction: column; align-items: stretch; gap: 8px; }
  .row-field input, .row-field select, .row-field textarea, #email-input, #delete-username { width: 100%; }
  .row-field .row-control { justify-content: flex-start; }
  .row-control { justify-content: flex-start; }
  .row-footer { flex-direction: column; align-items: stretch; }
  .binding-row { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
}
