/* ═══════════════════════════════════════════════════════════
   Word Shadow —— 深色科技风单词卡界面
   视觉参考：暗色底 + 青色发光词卡 + 卡片底部进度线
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-0: #0b0d12;
  --bg-1: #141821;
  --bg-2: #1b2029;
  --line: #2a3140;
  --line-soft: #212734;

  --teal: #2ee6c8;
  --teal-dim: #1fb8a3;
  --teal-glow: rgba(46, 230, 200, 0.55);
  --blue: #4d6cf5;
  --blue-dim: #3a52c9;

  --text: #e8ecf4;
  --text-dim: #97a1b4;
  --text-faint: #5d6779;

  --radius: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }

/* ═══════════ 准备界面 ═══════════ */

.setup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 20px 40px;
  overflow-y: auto;
  background:
    radial-gradient(1100px 620px at 50% -8%, #1b2436 0%, transparent 62%),
    radial-gradient(760px 460px at 88% 108%, #14262b 0%, transparent 60%),
    var(--bg-0);
}

.setup[hidden] { display: none; }

.setup-card {
  width: min(640px, 100%);
  margin: auto;
  background: linear-gradient(180deg, rgba(27, 32, 41, 0.92), rgba(20, 24, 33, 0.92));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 30px 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.brand { display: flex; gap: 15px; align-items: center; margin-bottom: 20px; }

.brand-mark {
  width: 50px; height: 50px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--teal), var(--blue));
  color: #06121a;
  font-weight: 800; font-size: 19px; letter-spacing: 0.5px;
  box-shadow: 0 8px 26px rgba(46, 230, 200, 0.3);
}

.brand h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: 0.2px; }
.brand p { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }

.field { margin-bottom: 18px; }

.field-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}

.field-head h2 {
  margin: 0; font-size: 14px; font-weight: 650; color: var(--text);
  display: flex; align-items: center; gap: 9px;
}

.step {
  width: 21px; height: 21px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: rgba(46, 230, 200, 0.14);
  color: var(--teal);
  font-size: 12px; font-weight: 700;
}

.link {
  font-size: 12.5px; color: var(--teal); text-decoration: none;
  border-bottom: 1px dashed rgba(46, 230, 200, 0.45);
  padding-bottom: 1px;
}
.link:hover { color: #6ff0d9; }

.drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(11, 13, 18, 0.5);
  transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease);
}
.drop.hot {
  border-color: var(--teal);
  background: rgba(46, 230, 200, 0.07);
  transform: scale(1.006);
}

.drop-inner { padding: 16px 18px; text-align: center; }
.drop-icon { font-size: 22px; margin-bottom: 5px; opacity: 0.85; }
.drop-text { font-size: 13.5px; color: var(--text-dim); }
.drop-hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.inline-btn {
  background: none; border: none; padding: 0;
  color: var(--teal); font-size: 13.5px; text-decoration: underline;
  text-underline-offset: 3px;
}
.inline-btn:hover { color: #6ff0d9; }

.status-line {
  margin-top: 9px; font-size: 12.5px; color: var(--text-dim); min-height: 18px;
}
.status-line.ok { color: var(--teal); }
.status-line.bad { color: #ff7a7a; }

.opts { display: flex; flex-direction: column; gap: 9px; }

.opt {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.opt:hover { border-color: #354052; }
.opt input { margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.opt span { display: flex; flex-direction: column; gap: 2px; }
.opt b { font-size: 13.5px; font-weight: 600; }
.opt i { font-style: normal; font-size: 12px; color: var(--text-faint); }

.opt-slider {
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.18s;
}
.opt-slider.active { opacity: 1; pointer-events: auto; }
.opt-slider label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 9px; }
.opt-slider b { color: var(--teal); font-variant-numeric: tabular-nums; }
.opt-slider input { width: 100%; accent-color: var(--teal); }

.error-line { min-height: 20px; font-size: 12.5px; color: #ff7a7a; margin-bottom: 8px; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  transition: background 0.16s, border-color 0.16s, transform 0.12s var(--ease), opacity 0.16s;
}
.btn:hover:not(:disabled) { background: #232936; border-color: #384154; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; }

.btn.primary {
  background: linear-gradient(140deg, var(--teal-dim), var(--blue-dim));
  border-color: transparent;
  color: #f2fbff;
  box-shadow: 0 8px 26px rgba(77, 108, 245, 0.3);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }

.btn.big { width: 100%; padding: 14px; font-size: 15px; margin-top: 4px; }

.tip {
  margin: 16px 0 0; font-size: 12px; color: var(--text-faint); line-height: 1.75;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.tip b { color: var(--text-dim); }

/* ═══════════ 上课界面 ═══════════ */

.stage {
  position: fixed; inset: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 560px at 50% 34%, #1a2030 0%, transparent 66%),
    linear-gradient(180deg, #0e1118 0%, #0a0c11 100%);
}
.stage[hidden] { display: none; }

.bg-grain {
  position: absolute; inset: 0;
  opacity: 0.4;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.bg-glow {
  position: absolute; left: 50%; top: 50%;
  width: 1200px; height: 760px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(46, 230, 200, 0.055), transparent 72%);
  pointer-events: none;
}

.ripple {
  position: absolute;
  left: 0;
  right: 0;
  top: 62%;
  bottom: 8%;
  width: 100%;
  height: 30%;
  pointer-events: none;
  z-index: 3;
}

/* ─── 顶部 Tab ─── */

.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 62px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  z-index: 5;
  background: linear-gradient(180deg, rgba(10, 12, 17, 0.9), rgba(10, 12, 17, 0));
}

.tabs { display: flex; gap: 9px; flex: 1; overflow: hidden; }

.tab {
  padding: 7px 16px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-faint);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.tab.done { color: var(--text-dim); }
.tab.active {
  color: #f0f4ff;
  background: linear-gradient(140deg, var(--blue-dim), #2f3f9e);
  box-shadow: 0 5px 18px rgba(77, 108, 245, 0.35);
}

.topbar-right { flex: none; }
.clock {
  font-size: 12.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

/* ─── 中文横幅 ─── */

.banner {
  position: absolute;
  left: 0; right: 0;
  top: 70px;
  height: 76px;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 90%, transparent 100%);
}

.banner-track {
  position: absolute;
  left: 0;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transform: translateY(-50%);
  will-change: transform;
}

.banner-item {
  position: static;
  flex: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: clamp(13px, 1.35vw, 22px);
  font-weight: 650;
  letter-spacing: 1px;
  color: #93a3c0;
  background: linear-gradient(180deg, rgba(34, 41, 58, 0.72), rgba(24, 29, 42, 0.72));
  border: 1px solid rgba(100, 125, 180, 0.28);
  white-space: nowrap;
  transition: opacity 0.45s ease, color 0.3s ease, border-color 0.3s ease,
              background 0.3s ease;
}

/* 当前正在读的中文：黑底高亮 */
.banner-item.current {
  color: #ffffff;
  background: #10131a;
  border-color: rgba(46, 230, 200, 0.85);
  box-shadow: 0 0 20px rgba(46, 230, 200, 0.45), 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* 读过的：淡出 */
.banner-item.done {
  opacity: 0.3;
}

/* 还没读到的：更暗 */
.banner-item.pending {
  opacity: 0.55;
}

/* ─── 英文词框（一排，中心在同一条水平线上，上下错开） ─── */

.cards {
  position: absolute;
  left: 0; right: 0;
  top: 168px; bottom: 250px;
  z-index: 4;
  /* 所有框的中心线：框 1、2、3、4 的中心基准都在这条线上 */
  --axis: 50%;
  /* 框高 */
  --box-h: 150px;
}

/* 中心线（只是给人看的参考线） */
.cards::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: var(--axis);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 145, 190, 0.22) 8%, rgba(120, 145, 190, 0.22) 92%, transparent);
  pointer-events: none;
  z-index: 0;
}

.box {
  position: absolute;
  top: var(--axis);
  height: var(--box-h);
  margin-top: calc(var(--box-h) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  /* 深色实线框；相邻的框紧贴无缝 */
  border: 2.5px solid rgba(150, 175, 225, 0.42);
  border-right-width: 0;
  background: rgba(16, 20, 28, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  will-change: transform, opacity;
}
/* 最后一个框补上右边框 */
.box:last-child { border-right-width: 2.5px; }

/* 上下错开：相对中心线，向上/向下偏移「框本身的 1/4 宽度」。
   框 1、3 往上，框 2、4 往下（横向仍是一排，紧贴无缝）。
   错开量由 JS 在量出框的真实宽度后用像素设置（见 buildBoxes 的 applyStagger）。 */

/* 刚跳出来的框：边缘发光 */
.box.jumped {
  border-color: rgba(46, 230, 200, 0.75);
  box-shadow:
    0 0 0 1px rgba(46, 230, 200, 0.28),
    0 0 26px rgba(46, 230, 200, 0.42),
    inset 0 0 26px rgba(46, 230, 200, 0.14);
}

/* 当前正在读的那个：最亮 */
.box.current {
  border-color: var(--teal);
  box-shadow:
    0 0 0 2px rgba(46, 230, 200, 0.4),
    0 0 52px rgba(46, 230, 200, 0.6),
    inset 0 0 34px rgba(46, 230, 200, 0.22);
  background: rgba(20, 42, 44, 0.6);
}

/* 框里的英文单词 */
.box-word {
  font-size: clamp(26px, 3.4vw, 62px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.5px;
  color: #eef4ff;
  text-align: center;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  will-change: transform;
}

/* 当前正在读的那个单词：发光 */
.box.current .box-word {
  color: var(--teal);
  text-shadow:
    0 0 12px rgba(46, 230, 200, 0.75),
    0 0 34px rgba(46, 230, 200, 0.4);
}

/* 跳出框外再落回框内 */
.box-word.hop {
  animation: hop 0.72s cubic-bezier(0.28, 1.5, 0.4, 1) both;
}

@keyframes hop {
  0%   { transform: translateY(0) scale(1); }
  32%  { transform: translateY(-46%) scale(1.22); }
  58%  { transform: translateY(14%) scale(0.92); }
  78%  { transform: translateY(-8%) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

/* 倒计时的框 */
.box.intro {
  border-color: rgba(130, 155, 235, 0.4);
}
.box.intro.jumped {
  border-color: rgba(150, 175, 255, 0.8);
  box-shadow:
    0 0 0 1px rgba(150, 175, 255, 0.3),
    0 0 26px rgba(120, 150, 255, 0.45),
    inset 0 0 26px rgba(120, 150, 255, 0.14);
}
.box.intro.current {
  border-color: #93a9ff;
  box-shadow:
    0 0 0 2px rgba(150, 175, 255, 0.42),
    0 0 52px rgba(120, 150, 255, 0.6),
    inset 0 0 34px rgba(120, 150, 255, 0.22);
}
.box.intro .box-word {
  font-size: clamp(34px, 4.4vw, 82px);
}
.box.intro.current .box-word {
  color: #cfdaff;
  text-shadow: 0 0 16px rgba(150, 175, 255, 0.8), 0 0 44px rgba(120, 150, 255, 0.45);
}

/* ─── 底部栏 ─── */

.bottombar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 74px;
  z-index: 5;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px;
  background: linear-gradient(0deg, rgba(10, 12, 17, 0.94), rgba(10, 12, 17, 0));
}

.status { display: flex; gap: 8px; flex: none; }

.pill {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  background: rgba(46, 230, 200, 0.12);
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill.ghost { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }

.progress-wrap { flex: 1; min-width: 0; position: relative; padding: 14px 0; }

/* 词轴：每个词在进度条上占一段，长词占两倍宽 */
.progress-track {
  position: relative;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: visible;
}

/* 走过的部分 */
.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  box-shadow: 0 0 12px var(--teal-glow);
  transition: width 0.08s linear;
  pointer-events: none;
}

/* 播放游标 */
.progress-cursor {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 14px var(--teal-glow), 0 0 4px rgba(46, 230, 200, 0.9);
  pointer-events: none;
  transition: left 0.08s linear;
}

/* 每个词一个标记 */
.progress-mark {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.25s ease, height 0.25s ease, box-shadow 0.25s ease;
  pointer-events: none;
}

/* 走过的标记：亮起来 */
.progress-mark.past {
  background: rgba(46, 230, 200, 0.75);
}

/* 当前词：最亮 */
.progress-mark.now {
  background: var(--teal);
  height: 20px;
  box-shadow: 0 0 12px var(--teal-glow);
}

/* 标记上的小字（可选，词太密就不显示） */
.progress-mark-label {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
  pointer-events: none;
}

.actions { display: flex; gap: 8px; flex: none; }
.actions .btn { padding: 9px 14px; font-size: 13px; }
#btnPlay { min-width: 92px; }

/* 窄屏适配 */
@media (max-width: 720px) {
  .card-en { font-size: 32px; }
  .card-zh { font-size: 15px; }
  .card { padding: 14px 20px 16px; }
  .bottombar { height: 66px; gap: 12px; padding: 0 14px; }
  .status { display: none; }
  .setup-card { padding: 22px 18px; }
}
