:root {
  --bg0: #0a0a14;
  --bg1: #0f1024;
  --text: #eef0f8;
  --text-dim: #8b93a8;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(255, 255, 255, 0.13);
  --c1: #00d4ff;
  --c2: #7c5cff;
  --c3: #ff6bd4;
  --green: #3ddc97;
  --red: #ff6b6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #131228);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 极光背景 */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -2;
  background:
    radial-gradient(620px circle at 22% 28%, rgba(124, 92, 255, .28), transparent 62%),
    radial-gradient(720px circle at 78% 72%, rgba(0, 212, 255, .22), transparent 62%),
    radial-gradient(520px circle at 62% 8%, rgba(255, 107, 212, .14), transparent 60%);
  animation: aurora 16s ease-in-out infinite alternate;
  filter: blur(30px);
}
@keyframes aurora {
  from { transform: translate(-2%, -1.5%) rotate(-2deg) scale(1); }
  to { transform: translate(2%, 1.5%) rotate(2deg) scale(1.06); }
}

#stars { position: fixed; inset: 0; z-index: -1; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* 头部 */
.header { margin-bottom: 26px; }
.header-inner { position: relative; text-align: center; }
.header h1 {
  font-size: 34px;
  letter-spacing: 6px;
  background: linear-gradient(100deg, var(--c1), var(--c2) 55%, var(--c3));
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s ease infinite;
  filter: drop-shadow(0 0 22px rgba(124, 92, 255, .45));
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.subtitle { color: var(--text-dim); margin-top: 8px; font-size: 13.5px; letter-spacing: 1px; }

.icon-btn {
  position: absolute;
  right: 0;
  top: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
  backdrop-filter: blur(10px);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover {
  color: var(--text);
  border-color: rgba(0, 212, 255, .55);
  box-shadow: 0 0 16px rgba(0, 212, 255, .3);
  transform: rotate(40deg);
}
.icon-btn.btn-sm { width: 34px; height: 34px; }

/* 卡片（玻璃拟态） */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.draw-card { text-align: center; position: relative; }

/* 抽词 */
.word-display {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 8px;
  padding: 18px;
  color: var(--text-dim);
  word-break: break-all;
  user-select: none;
  transition: color .2s;
}
.word-display.active {
  background: linear-gradient(120deg, var(--c1), var(--c2) 60%, var(--c3));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 4s ease infinite;
  filter: drop-shadow(0 0 26px rgba(124, 92, 255, .55));
}
.word-display.shuffling { animation: shuffle .12s linear infinite; }
.word-display.settled { animation: pop .5s cubic-bezier(.2, 1.5, .4, 1); }

@keyframes shuffle {
  0% { transform: translateX(-4px) rotate(-2deg) scale(1.04); opacity: .5; filter: blur(2px); }
  100% { transform: translateX(4px) rotate(2deg) scale(1.04); opacity: .5; filter: blur(2px); }
}
@keyframes pop {
  0% { transform: rotateX(90deg) scale(.4); opacity: 0; filter: blur(6px); }
  60% { transform: rotateX(-8deg) scale(1.08); opacity: 1; filter: blur(0); }
  100% { transform: rotateX(0) scale(1); }
}

.draw-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  transition: all .18s;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--c1), var(--c2) 50%, var(--c3));
  background-size: 220% 220%;
  animation: gradientShift 5s ease infinite;
  padding: 14px 46px;
  font-size: 18px;
  box-shadow: 0 8px 30px rgba(124, 92, 255, .4);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 40px rgba(124, 92, 255, .55);
}
.btn-primary:not(:disabled):active { transform: translateY(-1px) scale(1); }
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .4), transparent);
  transform: skewX(-25deg);
}
.btn-primary:not(:disabled):hover::after { animation: shine .8s ease; }
@keyframes shine { to { left: 160%; } }

.btn-glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  padding: 10px 26px;
}
.btn-glass:not(:disabled):hover {
  border-color: rgba(0, 212, 255, .6);
  color: var(--c1);
  box-shadow: 0 0 18px rgba(0, 212, 255, .25);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  padding: 8px 16px;
  font-size: 13px;
  letter-spacing: 1px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-sm { font-size: 13px; padding: 8px 14px; letter-spacing: 1px; }
.btn-big { padding: 12px 38px; }

.hint { color: var(--text-dim); font-size: 12.5px; margin-top: 14px; letter-spacing: .5px; }

/* 计时区 */
.timers-card { text-align: center; }
.timers {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.timer-box {
  background: rgba(8, 10, 20, .45);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 22px 28px 20px;
  min-width: 200px;
  flex: 1;
  max-width: 290px;
  transition: all .3s;
}
.timer-box.running {
  border-color: rgba(61, 220, 151, .6);
  box-shadow: 0 0 24px rgba(61, 220, 151, .2), inset 0 0 30px rgba(61, 220, 151, .06);
}
.timer-label {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.timer-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim); display: inline-block;
  transition: all .3s;
}
.timer-dot.on {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: blink 1s ease infinite;
}
@keyframes blink { 50% { opacity: .25; } }

.timer-value {
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
  letter-spacing: 2px;
  transition: all .3s;
}
.timer-box.running .timer-value {
  background: linear-gradient(120deg, var(--green), #8ff0c8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(61, 220, 151, .5));
}
.timer-box.limit {
  border-color: rgba(255, 107, 107, .55);
  box-shadow: 0 0 24px rgba(255, 107, 107, .18), inset 0 0 30px rgba(255, 107, 107, .05);
}
.timer-box.limit .timer-value {
  background: linear-gradient(120deg, var(--red), #ffb86b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 107, 107, .5));
}

.timer-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.timer-toggle { min-width: 84px; }

.timer-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .07);
  margin-top: 16px;
  overflow: hidden;
}
.timer-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  box-shadow: 0 0 8px rgba(0, 212, 255, .5);
  transition: width .25s linear;
}
.timer-box.limit .timer-progress-fill {
  background: linear-gradient(90deg, var(--red), #ffb86b);
  box-shadow: 0 0 8px rgba(255, 107, 107, .5);
}

/* 词库弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 6, 12, .65);
  backdrop-filter: blur(8px);
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.modal-panel {
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(16, 18, 32, .88);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 26px;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  animation: modalIn .3s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes modalIn {
  from { transform: translateY(26px) scale(.94); opacity: 0; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 19px;
  letter-spacing: 2px;
  background: linear-gradient(100deg, var(--c1), var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.modal-header .icon-btn { position: static; width: 34px; height: 34px; }
.modal-header .icon-btn:hover { transform: rotate(90deg); }

.bank-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.checkbox-label { color: var(--text-dim); font-size: 12.5px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.checkbox-label input { accent-color: var(--c2); }

.bank-add { display: flex; gap: 10px; margin-bottom: 18px; }
.text-input {
  flex: 1;
  background: rgba(8, 10, 20, .5);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all .2s;
}
.text-input:focus { border-color: var(--c1); box-shadow: 0 0 14px rgba(0, 212, 255, .2); }

.word-list { display: flex; flex-wrap: wrap; gap: 10px; }
.word-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 10, 20, .5);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 6px 10px;
  transition: border-color .2s;
}
.word-item:hover { border-color: rgba(0, 212, 255, .4); }
.word-item input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 5em;
}
.word-item input:focus { border-bottom: 1px solid var(--c1); }
.word-item .del {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 8px;
  transition: all .15s;
}
.word-item .del:hover { color: var(--red); background: rgba(255, 107, 107, .12); }
.word-list.empty .empty-hint { color: var(--text-dim); font-size: 14px; }

/* toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 22, 38, .9);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 11px 24px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 99;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .5);
  backdrop-filter: blur(14px);
  letter-spacing: 1px;
}

.hidden { display: none !important; }

@media (max-width: 520px) {
  .word-display { font-size: 34px; min-height: 120px; letter-spacing: 4px; }
  .timer-box { min-width: 100%; max-width: none; }
  .header h1 { font-size: 26px; letter-spacing: 4px; }
}
