/* 账户网关样式：单文件，移动端优先，跟随系统明暗色。
 * 2026-11-17 重做：统一按钮/输入框规格（高 40、圆角 10），各产品的账户站点用该产品的主色
 * （body.product-listen / -jlpt / -eju），账户页左侧分区导航。 */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1d232b;
  --muted: #66707f;
  --border: #dfe3e8;
  --accent: #22406e;
  --accent-soft: #e6ecf5;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e3f6ea;
  --alert-error-bg: var(--danger-soft);
  --alert-ok-bg: var(--ok-soft);
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* 每个产品的账户站点用自己的主色，和应用里一致 */
body.product-listen { --accent: #0d4a3c; --accent-soft: #e2f0e7; }
body.product-jlpt { --accent: #1f4e79; --accent-soft: #e3ecf5; }
body.product-eju { --accent: #22406e; --accent-soft: #e3ebf6; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1f232b;
    --text: #e6e8eb;
    --muted: #98a2b3;
    --border: #2b3039;
    --accent: #8fb0e6;
    --accent-soft: #1d2738;
    --accent-text: #0b1020;
    --danger: #f97066;
    --danger-soft: #3a1c1a;
    --ok: #47cd89;
    --ok-soft: #16311f;
    --shadow: none;
  }
  body.product-listen { --accent: #8fd0aa; --accent-soft: #15291f; --accent-text: #08231c; }
  body.product-jlpt { --accent: #8bb6e3; --accent-soft: #1a2633; }
  body.product-eju { --accent: #8fb0e6; --accent-soft: #1d2738; }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- 顶栏 ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  min-height: 60px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--surface-2);
}

.site-nav a.nav-app {
  color: var(--accent);
  font-weight: 600;
}

.nav-user {
  color: var(--muted);
  font-size: 14px;
  padding: 0 6px;
}

.site-nav .inline-form {
  margin-left: 4px;
}

/* ---- 返回应用：从应用点「账户」「升级」过来时，每页顶部一条 ---- */
.backbar .container {
  padding-top: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px 0 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.back-link::before {
  content: "";
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 2px;
}

.back-link:hover,
.back-link:focus-visible {
  background: var(--accent-soft);
}

main.container {
  flex: 1;
  padding-top: 24px;
  padding-bottom: 48px;
}

h1 {
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 18px;
  line-height: 1.4;
  margin: 28px 0 10px;
}

h3 {
  font-size: 15px;
  margin: 22px 0 8px;
}

.panel > h2:first-child,
.panel > h1:first-child,
.card h2 {
  margin-top: 0;
}

.hero {
  margin: 8px 0 24px;
}

.hero p {
  max-width: 640px;
}

.page-head {
  margin-bottom: 20px;
}

.page-head h1 {
  margin-bottom: 2px;
}

.page-head p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

/* ---- 面板 ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.narrow {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.danger-zone h2 {
  color: var(--danger);
}

/* ---- 表单 ---- */
label {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

input:not([type="hidden"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  width: auto;
}

.field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.field-row input {
  flex: 1;
  min-width: 0;
}

.field-row .button {
  margin-top: 0;
  flex: none;
}

/* ---- 按钮：主 / 次 / 危险，两种尺寸 ---- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, filter 0.15s;
}

.button:hover {
  filter: brightness(1.08);
}

.button:focus-visible,
.site-nav a:focus-visible,
.account-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.button.secondary:hover {
  filter: none;
  border-color: var(--accent);
  color: var(--accent);
}

.button.danger {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  color: var(--danger);
}

.button.danger:hover {
  filter: none;
  background: var(--danger-soft);
}

.button.small {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

form .button {
  margin-top: 20px;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.inline-form .button {
  margin-top: 0;
}

.inline-form input:not([type="hidden"]) {
  width: auto;
  max-width: 180px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

.actions,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.panel-actions {
  margin-top: 16px;
}

.panel-actions .button {
  margin-top: 0;
}

/* ---- 提示 ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 0 0 16px;
  font-size: 14px;
}

.alert-error {
  background: var(--alert-error-bg);
  color: var(--danger);
}

.alert-ok {
  background: var(--alert-ok-bg);
  color: var(--ok);
}

.banner {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  font-size: 14px;
}

.banner .inline-form {
  margin-left: 8px;
}

/* ---- 应用卡片（首页） ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 44px 22px 22px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 28px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-top: 2px solid var(--muted);
  transform: rotate(45deg);
}

a.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

a.card:hover::after {
  border-color: var(--accent);
}

.card h2 {
  margin: 0 0 4px;
}

.card .url {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  word-break: break-all;
}

.card-status {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

div.card::after,
.offer.card::after {
  display: none;
}

.offer .price {
  font-size: 26px;
  font-weight: 700;
  margin: 8px 0;
}

/* ---- 表格 ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag-on {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag-off {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-admin {
  background: var(--danger);
  color: #fff;
}

dl.info {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
}

dl.info dt {
  color: var(--muted);
}

dl.info dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.link-list {
  padding-left: 20px;
}

.link-list li {
  margin: 4px 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

/* ---- 账户页：左侧分区导航 + 右侧各分区 ---- */
.account-layout {
  display: grid;
  gap: 16px;
}

.account-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -20px;
  padding: 10px 20px;
  background: var(--bg);
  scrollbar-width: none;
}

.account-nav::-webkit-scrollbar {
  display: none;
}

.account-nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.account-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.account-nav a.nav-danger {
  color: var(--danger);
}

.account-sections .panel {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  scroll-margin-top: 64px;
}

.panel:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (min-width: 860px) {
  .account-layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .account-nav {
    top: 20px;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: none;
  }

  .account-nav a {
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    padding: 0 12px;
    color: var(--muted);
  }

  .account-nav a:hover {
    background: var(--surface);
    color: var(--text);
  }

  .account-sections .panel {
    scroll-margin-top: 20px;
  }
}

/* ---- 其它 ---- */
.site-footer {
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

.footer-version {
  opacity: 0.7;
}

.legal {
  max-width: 760px;
}

.legal h2 {
  font-size: 18px;
  margin-top: 28px;
}

.legal li {
  margin: 4px 0;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0;
  font-weight: 400;
}

.consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 16px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 16px;
  min-width: 120px;
}

.stat .value {
  font-size: 24px;
  font-weight: 650;
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
}

.reset-link {
  word-break: break-all;
}

/* 蜜罐字段：屏幕外，人看不到也不会用 Tab 进去；机器人往往会填 */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.filters,
.search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.search input:not([type="hidden"]) {
  width: auto;
  flex: 1;
  min-width: 180px;
}

.search .button,
.filters .button {
  margin-top: 0;
}

/* 管理后台模式：导航里的标记和页面顶部的色条，和学员界面一眼区分 */
body.admin-mode .site-header {
  border-bottom: 3px solid var(--danger);
}

@media (max-width: 520px) {
  .container {
    padding: 0 16px;
  }

  .account-nav {
    margin: 0 -16px;
    padding: 10px 16px;
  }

  .panel {
    padding: 18px;
  }

  h1 {
    font-size: 22px;
  }

  .field-row {
    flex-direction: column;
  }
}

/* 登录、注册、找回密码这类窄面板：主按钮占满一行 */
.narrow form > .button:last-child {
  width: 100%;
}
