/* ==========================================================================
   SimpleWordWin — Apple 风格
   参考 emilkowalski/skills 的 apple-design：即时反馈、连续动画、
   材质层次、光学字号、克制用色。
   ========================================================================== */

:root {
  --sw-accent: #0071e3;

  --ink: #1d1d1f;
  --ink-2: #3a3a3c;
  --muted: #86868b;
  --line: rgba(0, 0, 0, .1);
  --line-strong: rgba(0, 0, 0, .16);
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .08);
  --glass: rgba(255, 255, 255, .72);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
  --shadow-m: 0 10px 40px rgba(0, 0, 0, .10);
  --shadow-l: 0 30px 80px rgba(0, 0, 0, .18);

  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;
  --r-xl: 28px;

  --spring: cubic-bezier(.32, .72, 0, 1);
  --fast: 160ms var(--spring);
  --med: 320ms var(--spring);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --ink: #f5f5f7;
  --ink-2: #d2d2d7;
  --muted: #86868b;
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .2);
  --canvas: #000000;
  --surface: #1c1c1e;
  --surface-2: #232325;
  --fill: rgba(120, 120, 128, .24);
  --fill-2: rgba(120, 120, 128, .16);
  --glass: rgba(28, 28, 30, .72);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-m: 0 10px 40px rgba(0, 0, 0, .5);
  --shadow-l: 0 30px 80px rgba(0, 0, 0, .7);
}

[data-accent="purple"] { --sw-accent: #7a5cff; }
[data-accent="pink"] { --sw-accent: #e8578f; }
[data-accent="orange"] { --sw-accent: #f2761f; }
[data-accent="green"] { --sw-accent: #1a9e6c; }
[data-accent="graphite"] { --sw-accent: #5b6472; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

/* 底层渐变画布：玻璃层透出颜色，深浅两套 */
html {
  background-color: #eef1f7;
  background-image:
    radial-gradient(1200px 620px at 10% -10%, color-mix(in srgb, var(--sw-accent) 26%, transparent), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(255, 130, 190, .26), transparent 64%),
    radial-gradient(1100px 760px at 50% 112%, rgba(96, 170, 255, .30), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  transition: background-color var(--med);
}

html[data-theme="dark"] {
  background-color: #05070c;
  background-image:
    radial-gradient(1200px 620px at 10% -10%, color-mix(in srgb, var(--sw-accent) 42%, transparent), transparent 64%),
    radial-gradient(900px 520px at 92% 4%, rgba(190, 70, 160, .28), transparent 66%),
    radial-gradient(1100px 760px at 50% 112%, rgba(50, 90, 200, .34), transparent 66%);
}

body {
  margin: 0;
  background-color: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  transition: background-color var(--med), color var(--med);
}

body.has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(2px);
  z-index: 0;
  pointer-events: none;
}

[data-theme="light"] body.has-bg::before { background: rgba(255, 255, 255, .55); }

body > * { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.022em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: var(--sw-accent); text-decoration: none; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.title-xl { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.03em; }
.title-lg { font-size: 22px; }
.title-md { font-size: 17px; }

.card {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .82));
  background-color: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-l);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 1px 2px rgba(16, 24, 40, .05),
    0 22px 46px -28px rgba(16, 24, 40, .38);
  backdrop-filter: blur(22px) saturate(190%);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
}

[data-theme="dark"] .card {
  background-image: linear-gradient(180deg, rgba(42, 45, 54, .88), rgba(26, 29, 36, .82));
  background-color: rgba(32, 34, 42, .85);
  border-color: rgba(255, 255, 255, .09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 1px 2px rgba(0, 0, 0, .5),
    0 26px 60px -30px rgba(0, 0, 0, .8);
}

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--fast), background-color var(--fast), border-color var(--fast), opacity var(--fast);
}

.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--sw-accent) 72%, #ffffff),
    color-mix(in srgb, var(--sw-accent) 92%, #000000));
  background-color: var(--sw-accent);
  border-color: transparent;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .45),
    0 10px 24px -12px color-mix(in srgb, var(--sw-accent) 70%, transparent);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 14px 28px; font-size: 16px; border-radius: 999px; }
.btn.small { padding: 6px 14px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }

.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--fill-2);
  border-radius: 999px;
  isolation: isolate;
}

.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .14), 0 4px 10px -6px rgba(16, 24, 40, .3);
  transition: transform 340ms var(--spring), width 340ms var(--spring), opacity 180ms linear;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .seg-thumb {
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 8px -4px #000;
}

.seg {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  transition: color 200ms var(--spring);
}

.seg:hover { color: var(--ink-2); }

.seg.is-on {
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  box-shadow: none;
}

[data-theme="dark"] .seg.is-on { background: transparent; }

.field { display: block; margin-bottom: 16px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .56);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background-color var(--fast);
}

input:focus {
  border-color: var(--sw-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sw-accent) 18%, transparent);
  background: var(--surface);
}

.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.hint b { color: var(--sw-accent); }

.error {
  padding: 10px 14px;
  border-radius: var(--r-m);
  background: color-mix(in srgb, #ff3b30 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #ff3b30 30%, transparent);
  color: color-mix(in srgb, #ff3b30 86%, var(--ink));
  font-size: 13px;
  margin-bottom: 14px;
}

[data-theme="dark"] .error {
  background: color-mix(in srgb, #ff453a 18%, var(--surface));
  border-color: color-mix(in srgb, #ff453a 40%, transparent);
  color: #ff8a84;
}

/* ---------- 登录 ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card { width: min(420px, 100%); padding: 32px; border-radius: var(--r-xl); box-shadow: var(--shadow-m); }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--sw-accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: -.02em;
}
.mark.small { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }

#auth-tabs { width: 100%; margin-bottom: 22px; }
#auth-tabs .seg { flex: 1; }

.turnstile { margin-bottom: 16px; }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }

.rail {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .32));
  background-color: rgba(255, 255, 255, .40);
  border-color: rgba(255, 255, 255, .7);
  backdrop-filter: blur(26px) saturate(190%);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-top { display: flex; align-items: center; gap: 10px; }
.rail-user { display: flex; flex-direction: column; min-width: 0; }
.rail-user strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail-points {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--fill-2);
}
.rail-points strong { font-size: 28px; letter-spacing: -.03em; }

.rail-actions { display: flex; flex-direction: column; gap: 4px; }

.rail-btn {
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--r-s);
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--fast), color var(--fast);
  display: block;
  width: 100%;
}
.rail-btn:hover { background: var(--fill-2); }
.rail-btn.is-on { background: var(--fill); color: var(--ink); font-weight: 600; }
.rail-btn.subtle { font-size: 13px; color: var(--muted); }

.rail-foot { margin-top: auto; display: flex; gap: 6px; }
.rail-foot .rail-btn { width: auto; flex: 1; text-align: center; }

.stage { padding: 26px 30px 60px; min-width: 0; }

.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

.view { max-width: 880px; margin: 0 auto; }

/* ---------- 主页 ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 32px;
  border-radius: var(--r-xl);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.hero-copy p { margin-top: 8px; font-size: 14.5px; }
.hero-copy b { color: var(--ink); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 22px; letter-spacing: -.02em; }

.list-card { padding: 18px 20px 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

.rows { display: flex; flex-direction: column; }
.rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.rows li:last-child { border-bottom: 0; }
.rows .w { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .tag { font-size: 11px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; }
.rows .tag.exam { color: var(--sw-accent); }
.rows .score { font-family: var(--mono); font-size: 12px; }
.rows .pass { color: #30a46c; }
.rows .fail { color: #ff3b30; }
.rows time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ---------- 社区 ---------- */
.members { display: flex; flex-direction: column; }
.member { border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }

.member-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  cursor: pointer;
  border-radius: var(--r-s);
  transition: background-color var(--fast);
}
.member-head:hover { background: var(--fill-2); }

.member-rank { width: 26px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.member-stat { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.member-chev { color: var(--muted); font-size: 12px; transition: transform var(--fast); }
.member.open .member-chev { transform: rotate(90deg); }

.member-history { padding: 4px 4px 14px 40px; display: none; }
.member.open .member-history { display: block; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 6px; }

/* ---------- 弹层 ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sheet.full { padding: 22px; align-items: center; }

.sheet-card {
  width: min(460px, 100%);
  padding: 26px;
  border-radius: var(--r-xl);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .78));
  background-color: rgba(255, 255, 255, .8);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 #fff, 0 40px 90px -30px rgba(16, 24, 40, .5);
  backdrop-filter: blur(34px) saturate(200%);
  -webkit-backdrop-filter: blur(34px) saturate(200%);
}

[data-theme="dark"] .sheet-card {
  background-image: linear-gradient(180deg, rgba(44, 47, 56, .92), rgba(26, 28, 35, .86));
  background-color: rgba(30, 32, 40, .86);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 40px 90px -30px #000;
}

.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 会话 ---------- */
.session {
  width: min(920px, 100%);
  max-height: min(86vh, 940px);
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 255, 255, .8);
  background-image: linear-gradient(180deg, #ffffff, #f6f7fa);
  background-color: #ffffff;
  box-shadow: inset 0 1px 0 #fff, var(--shadow-l);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="dark"] .session {
  border-color: rgba(255, 255, 255, .1);
  background-image: linear-gradient(180deg, #262932, #1a1d24);
  background-color: #202329;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), var(--shadow-l);
}

.session-body { overflow-y: auto; }

.session-head { padding: 18px 24px 0; }
.session-progress { height: 4px; border-radius: 999px; background: var(--fill); overflow: hidden; }
#session-bar { height: 100%; width: 0; background: var(--sw-accent); border-radius: inherit; transition: width var(--med); }
.session-meta { display: flex; justify-content: space-between; margin-top: 8px; }

.session-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  padding: 40px 24px 32px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.word-xl {
  font-size: clamp(32px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--ink);
  line-height: 1.1;
}
.phone { font-family: var(--mono); color: var(--muted); font-size: 14px; }
.trans { font-size: clamp(18px, 2.4vw, 24px); color: var(--ink-2); line-height: 1.6; }
.trans div + div { margin-top: 4px; }

.session-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.spell-input {
  width: min(420px, 100%);
  padding: 16px 18px;
  font-size: 22px;
  text-align: center;
  letter-spacing: .06em;
  border-radius: var(--r-l);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.spell-input:focus { border-color: var(--sw-accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sw-accent) 16%, transparent); }
.spell-input.wrong { border-color: #ff3b30; box-shadow: 0 0 0 5px rgba(255, 59, 48, .14); }

.answer-reveal {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--sw-accent);
  transition: opacity .8s linear;
}
.answer-reveal.fading { opacity: 0; }
.answer-reveal.sticky {
  padding: 8px 18px;
  border-radius: var(--r-m);
  background: color-mix(in srgb, var(--sw-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sw-accent) 40%, transparent);
  font-weight: 600;
  transition: none;
}

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

/* ---------- 考试 ---------- */
.exam-wrap { width: 100%; max-width: 820px; margin: 0 auto; padding: 18px 24px 40px; }
.exam-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.exam-timer { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; }
.exam-timer.low { color: #ff3b30; }

.q { padding: 18px 20px; margin-bottom: 12px; }
.q-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.q-prompt { font-size: 20px; font-weight: 600; margin-bottom: 12px; letter-spacing: -.02em; }
.q-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.opt {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--fast), background-color var(--fast), transform var(--fast);
}
.opt:hover { border-color: var(--sw-accent); }
.opt:active { transform: scale(.985); }
.opt.is-on { border-color: var(--sw-accent); background: color-mix(in srgb, var(--sw-accent) 12%, transparent); }

.speak-btn {
  border: 0;
  background: var(--fill);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: transform var(--fast), background-color var(--fast);
}
.speak-btn:hover { background: var(--fill); }
.speak-btn:active { transform: scale(.96); }

.swatches { display: flex; gap: 10px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid transparent;
  background: var(--sw);
  cursor: pointer;
  transition: transform var(--fast), border-color var(--fast);
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-on { border-color: var(--ink); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(0);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 80;
  color: var(--ink);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .86));
  background-color: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 #fff, 0 12px 32px -12px rgba(16, 24, 40, .45);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="dark"] .toast {
  color: var(--ink);
  background-image: linear-gradient(180deg, rgba(44, 47, 56, .96), rgba(28, 30, 38, .9));
  background-color: rgba(34, 36, 44, .94);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 32px -12px #000;
}

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: sticky; top: 0; height: auto; flex-direction: row; align-items: center;
    gap: 12px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .rail-top, .rail-points { flex: 0 0 auto; }
  .rail-points { flex-direction: row; align-items: baseline; gap: 6px; padding: 6px 10px; }
  .rail-points strong { font-size: 16px; }
  .rail-actions { flex-direction: row; gap: 2px; }
  .rail-btn { white-space: nowrap; padding: 7px 10px; font-size: 13px; }
  .rail-foot { margin: 0; }
  .stage { padding: 18px 16px 40px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .q-options { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------- 渐变高光 / 次级玻璃 ---------- */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: -60% -10% auto -10%;
  height: 240%;
  background: radial-gradient(58% 58% at 18% 0%, color-mix(in srgb, var(--sw-accent) 22%, transparent), transparent 70%),
              radial-gradient(46% 46% at 96% 10%, rgba(255, 130, 190, .18), transparent 72%);
  pointer-events: none;
}
.hero > * { position: relative; }

.rail-points {
  background-image: linear-gradient(160deg, color-mix(in srgb, var(--sw-accent) 18%, transparent), transparent 72%),
                    linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .3));
  background-color: rgba(255, 255, 255, .35);
  border: 1px solid rgba(255, 255, 255, .6);
  backdrop-filter: blur(14px);
}

[data-theme="dark"] .rail-points {
  background-image: linear-gradient(160deg, color-mix(in srgb, var(--sw-accent) 24%, transparent), transparent 72%);
  background-color: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .08);
}

.opt {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .5));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[data-theme="dark"] .opt {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
}

.opt.is-on {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--sw-accent) 22%, rgba(255, 255, 255, .5)),
    color-mix(in srgb, var(--sw-accent) 14%, rgba(255, 255, 255, .4)));
  border-color: var(--sw-accent);
}





.spell-input {
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(16px);
}

[data-theme="dark"] .spell-input { background: rgba(255, 255, 255, .06); }

.speak-btn {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .45));
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .speak-btn {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
}

.rail-foot .rail-btn {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .25));
  backdrop-filter: blur(12px);
}
[data-theme="dark"] .rail {
  background-image: linear-gradient(180deg, rgba(34, 37, 46, .74), rgba(16, 18, 24, .58));
  background-color: rgba(20, 22, 28, .58);
  border-color: rgba(255, 255, 255, .08);
}

[data-theme="dark"] .rail-btn:hover { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .rail-btn.is-on { background: rgba(255, 255, 255, .12); }
[data-theme="dark"] .rail-foot .rail-btn {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .07);
}
/* ---------- 品牌 logo ---------- */
.brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 24px;
}

.brand-word {
  height: 62px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.rail-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}

.only-dark { display: none; }
[data-theme="dark"] .only-dark { display: block; }
[data-theme="dark"] .only-light { display: none; }
/* ---------- 每轮结束的模式选择 ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(600px, 100%);
}

.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  text-align: left;
  border-radius: var(--r-l);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  background-image: linear-gradient(180deg, var(--surface), var(--surface-2));
  color: var(--ink);
  box-shadow: var(--shadow-s);
  cursor: pointer;
  transition: transform var(--fast), border-color var(--fast), background-color var(--fast);
}

.mode-btn strong { font-size: 15.5px; letter-spacing: -.01em; color: var(--ink); }
.mode-btn span { font-size: 12.5px; color: var(--muted); }
.mode-btn:hover { border-color: var(--sw-accent); }
.mode-btn:active { transform: scale(.98); }

.mode-btn.is-on {
  border-color: var(--sw-accent);
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--sw-accent) 16%, var(--surface)),
    color-mix(in srgb, var(--sw-accent) 8%, var(--surface)));
}

.mode-btn.is-on strong { color: var(--ink); }
/* ---------- 连续曲率圆角（Apple squircle） ----------
   支持 corner-shape 的浏览器（Chromium 139+）用超椭圆，
   不支持的浏览器回落到普通圆角。 */
@supports (corner-shape: squircle) {
  /* G2：实心元件用连续曲率 */
  .btn,
  .rail-btn,
  .mode-btn,
  .opt,
  .speak-btn,
  .seg,
  .seg.is-on,
  .rail-points,
  .stat,
  .swatch,
  .toast,
  .tag,
  .pill,
  input[type="text"],
  input[type="password"],
  input[type="url"],
  input[type="number"],
  .spell-input {
    corner-shape: squircle;
  }

  /* 胶囊 / 圆形元件用更高的超椭圆指数 */
  .btn,
  .rail-btn,
  .speak-btn,
  .toast,
  .pill,
  .tag,
  .swatch {
    corner-shape: superellipse(4);
  }

  /* 带 backdrop-filter 的玻璃层保持普通圆角：
     模糊采样的是矩形区域，用超椭圆会出现边缘色差 */
  .card,
  .sheet-card,
  .session,
  .rail,
  #settings-modal .sheet-card {
    corner-shape: round;
  }
}
/* 防御：任何情况下弹层与单词都必须可见 */
.sheet, .sheet-card, .session, .toast, .word-xl, .trans, .phone {
  opacity: 1;
  visibility: visible;
}
.sheet, .sheet-card, .session, .toast {
  animation: none !important;
}
/* ---------- 滚动条适配主题（考试等长列表） ---------- */
.session-body,
.member-history,
.board,
.history,
.rows {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent;
}

.session-body::-webkit-scrollbar,
.member-history::-webkit-scrollbar,
.board::-webkit-scrollbar,
.history::-webkit-scrollbar,
.rows::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.session-body::-webkit-scrollbar-track,
.member-history::-webkit-scrollbar-track,
.board::-webkit-scrollbar-track,
.history::-webkit-scrollbar-track,
.rows::-webkit-scrollbar-track {
  background: transparent;
}

.session-body::-webkit-scrollbar-thumb,
.member-history::-webkit-scrollbar-thumb,
.board::-webkit-scrollbar-thumb,
.history::-webkit-scrollbar-thumb,
.rows::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 20%, transparent);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.session-body::-webkit-scrollbar-thumb:hover,
.member-history::-webkit-scrollbar-thumb:hover,
.board::-webkit-scrollbar-thumb:hover,
.history::-webkit-scrollbar-thumb:hover,
.rows::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  background-clip: content-box;
}

[data-theme="dark"] .session-body,
[data-theme="dark"] .member-history,
[data-theme="dark"] .board,
[data-theme="dark"] .history,
[data-theme="dark"] .rows {
  scrollbar-color: rgba(255, 255, 255, .26) transparent;
}

[data-theme="dark"] .session-body::-webkit-scrollbar-thumb,
[data-theme="dark"] .member-history::-webkit-scrollbar-thumb,
[data-theme="dark"] .board::-webkit-scrollbar-thumb,
[data-theme="dark"] .history::-webkit-scrollbar-thumb,
[data-theme="dark"] .rows::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .24);
  background-clip: content-box;
}
/* ---------- 全局滚动条也跟随主题 ---------- */
html, body {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .26) transparent;
  overflow-x: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 12px; height: 12px; }

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track { background: transparent; }

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .22);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, .36);
  background-clip: content-box;
}

[data-theme="dark"] html,
[data-theme="dark"] body {
  scrollbar-color: rgba(255, 255, 255, .28) transparent;
}

[data-theme="dark"] html::-webkit-scrollbar-thumb,
[data-theme="dark"] body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .26);
  background-clip: content-box;
}

[data-theme="dark"] html::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .4);
  background-clip: content-box;
}
/* ---------- 切换动画（Apple design：短、可中断、跟随手势不抢戏） ---------- */
.view {
  animation: view-in 260ms var(--spring);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet {
  opacity: 1;
  transition: opacity 220ms var(--spring);
}

.sheet-card,
.session {
  transform: translateY(0) scale(1);
  transition: transform 280ms var(--spring), opacity 220ms var(--spring);
}

/* 打开时的一段轻微上浮，状态由 JS 打点，动画结束即停在最终状态 */
.sheet.is-entering .sheet-card,
.sheet.is-entering .session {
  transform: translateY(14px) scale(.985);
  opacity: 0;
}

.sheet.is-entering { opacity: 0; }

/* 主题切换时颜色过渡，避免生硬跳变 */
.card,
.btn,
.rail,
.rail-btn,
.seg,
.opt,
.mode-btn,
input,
.stat,
.toast,
.sheet-card,
.session,
.topbar,
.rail-points {
  transition-property: background-color, border-color, color, box-shadow, transform;
  transition-duration: 220ms;
  transition-timing-function: var(--spring);
}

@media (prefers-reduced-motion: reduce) {
  .view, .sheet, .sheet-card, .session { animation: none !important; transition-duration: 1ms !important; }
}
/* ---------- 登录页主题切换按钮 ---------- */
.auth-theme {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .62));
  background-color: rgba(255, 255, 255, .72);
  color: var(--ink);
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 8px 24px -14px rgba(16, 24, 40, .35);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: transform var(--fast), border-color var(--fast), background-color var(--fast), color var(--fast);
}

.auth-theme:hover { border-color: var(--sw-accent); color: var(--sw-accent); }
.auth-theme:active { transform: scale(.94); }

[data-theme="dark"] .auth-theme {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
  background-color: rgba(28, 31, 38, .82);
  border-color: rgba(255, 255, 255, .14);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 24px -14px #000;
}
/* ---------- 深色输入框底色修正 ---------- */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
  color: var(--ink);
}

[data-theme="dark"] input::placeholder { color: rgba(255, 255, 255, .38); }
/* ---------- 主题切换图标（SVG，跟随主题着色） ---------- */
.ico-sun, .ico-moon { display: block; }
.ico-sun { display: none; }
[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }

.auth-theme svg,
#btn-theme svg { pointer-events: none; }