/* Account Center v1.1 — self-contained commercial UI */
:root {
  --surface: #fcf9f1;
  --ink: #202a24;
  --muted: rgba(32, 42, 36, .7);
  --line: rgba(55, 91, 68, .2);
  --primary: #35644a;
  --primary-deep: #294f3a;
  --primary-soft: #d7eadc;
  --gold: #a47c45;
  --success: #1f7047;
  --danger: #a72d25;
  --warning: #8c6509;
  --reading: rgba(252, 249, 241, .92);
  --popup: rgba(252, 249, 241, .98);
  --display: rgba(252, 249, 241, .16);
  --control: rgba(255, 255, 255, .58);
  --panel-shadow: 0 18px 46px rgba(9, 17, 12, .2);
  --radius-panel: 20px;
  --radius-control: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #26352d;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.wallpaper {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(12, 21, 15, .72) 0%, rgba(12, 21, 15, .3) 48%, rgba(12, 21, 15, .5) 100%),
    linear-gradient(180deg, rgba(8, 14, 10, .06), rgba(8, 14, 10, .48)),
    url(../assets/home/hero-tcm-study.webp) center / cover no-repeat;
}

.wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 28%, rgba(219, 181, 119, .14), transparent 34%),
    linear-gradient(180deg, transparent 42%, rgba(11, 19, 14, .32));
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  width: min(1120px, calc(100% - 28px));
  min-height: 58px;
  margin: 14px auto 0;
  padding: 8px 10px 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 18px;
  background: var(--display);
  box-shadow: 0 12px 34px rgba(9, 17, 12, .18);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}

.brand { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.brand strong {
  font: 600 18px/1 var(--font-serif);
  letter-spacing: .14em;
  white-space: nowrap;
}
.brand span {
  padding-left: 12px;
  color: rgba(255, 255, 255, .78);
  border-left: 1px solid rgba(255, 255, 255, .38);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 13px;
  background: var(--control);
  box-shadow: none;
  text-shadow: none;
}

.nav-links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus-visible { background: rgba(255, 255, 255, .62); }

.page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 38px 0 56px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.account-intro {
  grid-column: 1 / -1;
  max-width: 720px;
  padding: 12px 4px 16px;
  color: rgba(255, 255, 255, .98);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .56);
}

.page-kicker,
.section-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
}

.page-kicker {
  margin-bottom: 10px;
  color: var(--primary-soft);
}

.account-intro h1 {
  margin: 0 0 10px;
  font: 600 clamp(30px, 4vw, 46px)/1.18 var(--font-serif);
  letter-spacing: .04em;
}

.account-intro p {
  margin: 0;
  color: rgba(255, 255, 255, .8);
  font-size: 14px;
  line-height: 1.75;
}

.glass {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--reading);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
}

.section {
  min-width: 0;
  min-height: 248px;
  padding: 22px;
}

.section-heading {
  min-height: 44px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-index {
  flex: 0 0 auto;
  color: rgba(53, 100, 74, .38);
  font: 600 28px/1 var(--font-serif);
}

.section-kicker {
  margin-bottom: 4px;
  color: var(--primary);
  opacity: .72;
}

.section h2 { margin: 0; font: 600 20px/1.15 var(--font-serif); letter-spacing: .04em; }
.section h3 { margin: 0 0 6px; font-size: .95rem; }
.section p { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.7; }

.status-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge-member { background: #e6f4ed; color: var(--success); }
.badge-free { background: #f3efe5; color: var(--muted); }
.badge-expired { background: #fdece8; color: var(--danger); }
.badge-founder { background: #fef9e6; color: var(--gold); border: 1px solid rgba(182, 137, 59, .3); }

.info-line {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}
.info-line strong { color: var(--ink); }
.mono {
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(53, 100, 74, .08);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
}

.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 16px;
  font-weight: 750;
  font-size: 14px;
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible,
.nav-links a:focus-visible,
.modal-close:focus-visible,
.form-field input:focus-visible {
  outline: 3px solid rgba(212, 174, 101, .52);
  outline-offset: 2px;
}
.btn-primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(41, 79, 58, .18);
}
.btn-primary:hover { background: var(--primary-deep); }
.btn-outline {
  color: var(--ink);
  border-color: rgba(55, 91, 68, .24);
  background: rgba(255, 255, 255, .58);
}
.btn-outline:hover { background: rgba(255, 255, 255, .88); }
.btn-success { background: #edf8f1; border-color: #b9dcc8; color: var(--success); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .52; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: 13px; }

.form-field { display: grid; gap: 6px; margin-bottom: 12px; }
.form-field label { color: var(--muted); font-size: 12px; font-weight: 800; }
.form-field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
  outline: none;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 15px;
  letter-spacing: .06em;
}
.form-field input:focus {
  border-color: rgba(53, 100, 74, .56);
  box-shadow: 0 0 0 3px rgba(53, 100, 74, .1);
}
.format-indicator {
  min-height: 18px;
  margin-top: 1px;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
}
.format-indicator.valid { color: var(--success); }
.format-indicator.invalid { color: var(--danger); }

.result-box {
  display: none;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #cfe2c9;
  border-radius: 10px;
  background: #f3fbf1;
  font-size: 14px;
  line-height: 1.6;
}
.result-box.error { border-color: #f2c7c1; background: #fef6f4; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* auth modal */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 24, 18, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-modal-overlay.hidden,
.auth-modal-overlay[hidden] { display: none; }
.auth-modal {
  position: relative;
  width: min(400px, 100%);
  max-height: min(680px, 88vh);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid rgba(55, 91, 68, .22);
  border-radius: 18px;
  background: var(--popup);
  box-shadow: 0 24px 70px rgba(9, 17, 12, .32);
}
.auth-modal h3 { margin: 0 0 18px; font: 600 22px/1.2 var(--font-serif); }
.auth-modal .btn { margin-top: 10px; }
.auth-modal .form-field { margin-bottom: 11px; }
.auth-modal .hint { margin-top: 6px; color: var(--muted); font-size: 12px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}
.modal-close:hover { background: rgba(53, 100, 74, .08); }

/* Account page support dialog keeps primary commercial controls at 44px. */
.suowen-support-close {
  width: 44px;
  height: 44px;
}
.suowen-support-copy,
.suowen-support-action,
.suowen-support-secondary { min-height: 44px; }
.suowen-support-save { min-height: 44px; }

@media (max-width: 768px) {
  .topbar {
    top: 8px;
    width: calc(100% - 16px);
    min-height: 54px;
    margin-top: 8px;
    padding: 6px 7px 6px 13px;
    border-radius: 15px;
  }
  .brand { gap: 0; }
  .brand strong { font-size: 16px; letter-spacing: .08em; }
  .brand span { display: none; }
  .nav-links { gap: 1px; }
  .nav-links a { min-height: 40px; padding: 7px 9px; font-size: 11px; }
  .page {
    width: calc(100% - 20px);
    padding: 24px 0 36px;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .account-intro {
    grid-column: auto;
    padding: 8px 4px 10px;
  }
  .account-intro h1 { margin-bottom: 7px; font-size: clamp(27px, 8vw, 36px); }
  .account-intro p { max-width: 32em; font-size: 13px; line-height: 1.65; }
  .section { min-height: 0; padding: 17px; border-radius: 17px; }
  .section-heading { min-height: 38px; margin-bottom: 11px; }
  .section-index { font-size: 24px; }
  .section h2 { font-size: 18px; }
  .section p { font-size: 13px; }
  .form-field input { font-size: 16px; letter-spacing: .03em; }
  .status-row { gap: 7px; }
}

@media (max-width: 380px) {
  .topbar { padding-left: 11px; }
  .brand strong { font-size: 15px; }
  .nav-links a { padding-inline: 7px; }
  .page { width: calc(100% - 14px); }
  .section { padding: 14px; }
  .section-heading { gap: 9px; }
  .account-intro h1 { font-size: 26px; }
  .auth-modal { padding: 22px 16px 18px; }
  .action-row .btn { flex: 1 1 120px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
