/* LexiBlade — Arcane Forge × Competitive Classroom UI */

:root {
  --bg-deep: #090e1a;
  --bg-panel: #111827;
  --bg-card: #172135;
  --bg-card-hover: #1e2c46;
  --border: rgba(148, 163, 184, 0.18);
  --border-bright: rgba(251, 191, 36, 0.45);
  --text-main: #f1f5f9;
  --text-sub: #94a3b8;
  --text-dim: #64748b;
  --gold: #fbbf24;
  --gold-deep: #d97706;
  --cyan: #38bdf8;
  --emerald: #10b981;
  --rose: #f43f5e;
  --purple: #a855f7;
  --orange: #f97316;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 0%, #172554 0%, var(--bg-deep) 48%, #050811 100%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 5px;
  color: #cbd5e1;
}

.hidden { display: none !important; }
.mt-xs { margin-top: 6px; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 18px; }
.mb-sm { margin-bottom: 12px; }

.app-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: 14px 18px 34px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(17, 24, 39, 0.86);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 21px;
  border-radius: 11px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.brand-en {
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-sub);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
  color: #0b1121;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.badge-pill {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}

.nav-btn.active .badge-pill {
  background: rgba(15, 23, 42, 0.2);
  color: #0b1121;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-chip {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-chip:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
}

/* Views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.22s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, rgba(23, 33, 53, 0.94), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow);
}

.hero-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 5px;
}

.hero-copy h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.hero-copy p {
  font-size: 13px;
  color: var(--text-sub);
}

.hero-loop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(9, 14, 26, 0.65);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.loop-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  flex: 1;
}

.loop-step span {
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
}

.loop-step strong {
  font-size: 13px;
}

.loop-step small {
  font-size: 11px;
  color: var(--text-sub);
}

.loop-arrow {
  color: var(--text-dim);
  font-weight: 700;
}

/* Panels & Lobby Grid */
.lobby-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.panel-head h3 {
  font-size: 15.5px;
  font-weight: 800;
}

.panel-hint {
  font-size: 12px;
  color: var(--text-sub);
}

/* Textbook Grid */
.textbook-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tb-card {
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.tb-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.tb-card.active {
  border-color: var(--gold);
  background: linear-gradient(150deg, rgba(251, 191, 36, 0.14), rgba(23, 33, 53, 0.95));
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 8px 20px rgba(0, 0, 0, 0.3);
}

.tb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tb-level {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.tb-card h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 2px;
}

.tb-badge {
  font-size: 11.5px;
  color: var(--cyan);
  font-weight: 600;
}

.tb-desc {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 5px;
  line-height: 1.4;
}

/* Unit Pills */
.unit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-pill {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
}

.unit-pill:hover {
  border-color: var(--cyan);
}

.unit-pill.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--cyan);
  color: #e0f2fe;
}

/* Preview Weapons */
.preview-weapons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preview-w-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.preview-w-card:hover {
  border-color: var(--gold);
  background: rgba(30, 41, 59, 0.85);
}

.preview-w-meta {
  min-width: 0;
  flex: 1;
}

.preview-w-word {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.preview-w-word strong {
  font-size: 14px;
  color: #fff;
}

.preview-w-word span {
  font-size: 11px;
  color: var(--text-sub);
}

.preview-w-zh {
  font-size: 12px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-w-name {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

/* Launch Settings Panel */
.setting-group {
  margin-bottom: 10px;
}

.setting-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 5px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.16s;
}

.seg-btn strong { font-size: 13px; }
.seg-btn span { font-size: 11px; color: var(--text-sub); }

.seg-btn.active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.14);
}

.summary-box {
  background: rgba(9, 14, 26, 0.65);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}

.summary-row span { color: var(--text-sub); }
.summary-row strong { color: var(--text-main); }

/* Buttons */
.btn-primary, .btn-ghost, .btn-accent {
  border: none;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #0b1121;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.35);
}

.btn-accent:hover { filter: brightness(1.08); }

.btn-ghost {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-weight: 600;
}

.btn-ghost:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
}

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-launch { width: 100%; padding: 14px 18px; font-size: 16px; }

.shortcut-note {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 12px;
  line-height: 1.6;
}

/* ==================== ARENA VIEW ==================== */
.arena-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.hud-left, .hud-center, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  padding: 3px 12px;
  border-radius: 9px;
}

.wave-badge strong {
  display: block;
  font-size: 13.5px;
  color: #fff;
}

.wave-badge span {
  font-size: 11.5px;
  color: var(--text-sub);
}

.wave-dots {
  display: flex;
  gap: 4px;
}

.wdot {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-weight: 700;
}

.wdot.active {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border-color: var(--cyan);
}

.wdot.done {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.hud-stat {
  text-align: center;
  min-width: 52px;
}

.hud-stat span {
  display: block;
  font-size: 10.5px;
  color: var(--text-sub);
}

.hud-stat strong {
  font-size: 15px;
  font-weight: 800;
}

.combo-num { color: var(--orange); }

/* Stage Wrapper */
.stage-wrapper {
  position: relative;
  height: 204px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b1121;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

#arena-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.combatant-bar {
  position: absolute;
  top: 12px;
  width: 270px;
  max-width: 42%;
  background: rgba(9, 14, 26, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 8px 11px;
}

.hero-bar { left: 12px; }
.boss-bar { right: 12px; }

.cbar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 4px;
}

.bar-track {
  height: 9px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track.thin { height: 5px; }

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.bar-fill.hp { background: linear-gradient(90deg, #10b981, #34d399); }
.bar-fill.sp { background: linear-gradient(90deg, #38bdf8, #818cf8); }
.bar-fill.boss { background: linear-gradient(90deg, #e11d48, #fb7185); }
.bar-fill.charge { background: linear-gradient(90deg, #f59e0b, #ef4444); }

.mini-badge {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.24);
  color: #bae6fd;
  margin-left: 4px;
}

.mini-badge.purple { background: rgba(168, 85, 247, 0.28); color: #e9d5ff; }
.mini-badge.fire { background: rgba(249, 115, 22, 0.3); color: #fed7aa; }

.combat-ticker {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(9, 14, 26, 0.82);
  border: 1px solid rgba(251, 191, 36, 0.28);
  font-size: 12.5px;
  color: #fde68a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Control Deck */
.control-deck {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.forge-console {
  background: linear-gradient(155deg, rgba(23, 33, 53, 0.96), rgba(15, 23, 42, 0.98));
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.forge-console.mode-rusting {
  border-color: var(--orange);
  box-shadow: 0 0 22px rgba(249, 115, 22, 0.22);
}

.forge-console.mode-sealed {
  border-color: var(--purple);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.25);
}

.forge-console.shake {
  animation: shakeX 0.32s ease;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  45% { transform: translateX(7px); }
  70% { transform: translateX(-5px); }
}

.forge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.forge-weapon-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-weapon-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(9, 14, 26, 0.8);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.forge-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.status-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-tag.locked { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.status-tag.ready { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.status-tag.rusting { background: rgba(249, 115, 22, 0.25); color: #fdba74; }
.status-tag.sealed, .status-tag.arcane { background: rgba(168, 85, 247, 0.25); color: #e9d5ff; }

.weapon-title-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.pos-tag {
  font-size: 11px;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 5px;
}

.meaning-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.meaning-row h3 {
  font-size: 21px;
  font-weight: 900;
  color: #fff;
}

.phonetic {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  color: #cbd5e1;
}

.btn-speak {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-speak:hover { background: rgba(56, 189, 248, 0.25); }

/* Letter Slots */
.letter-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 46px;
  align-items: center;
}

.letter-box {
  width: 38px;
  height: 44px;
  border-radius: 9px;
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  background: rgba(9, 14, 26, 0.72);
  display: grid;
  place-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 21px;
  font-weight: 900;
  text-transform: lowercase;
  position: relative;
  transition: all 0.12s;
}

.letter-box.hint-ghost {
  color: rgba(148, 163, 184, 0.35);
}

.letter-box.hint-revealed {
  color: rgba(251, 191, 36, 0.58);
  border-color: rgba(251, 191, 36, 0.35);
}

.letter-box.cursor {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.24);
}

.letter-box.ok {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--emerald);
  color: #6ee7b7;
}

.letter-box.bad {
  background: rgba(244, 63, 94, 0.22);
  border-color: var(--rose);
  color: #fda4af;
}

.spell-input-row {
  display: flex;
  gap: 8px;
}

#spell-input {
  flex: 1;
  background: rgba(9, 14, 26, 0.88);
  border: 1.5px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 1px;
  outline: none;
}

#spell-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.btn-cast {
  padding: 10px 18px;
  white-space: nowrap;
}

.forge-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
  flex-wrap: wrap;
}

.tip-text { color: #fde68a; }

/* Grammar Skill Panel */
.skill-panel {
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.skill-panel-head h4 { font-size: 14px; font-weight: 800; }

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.skill-btn {
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: not-allowed;
  opacity: 0.62;
  transition: all 0.18s;
}

.skill-btn.ready {
  opacity: 1;
  cursor: pointer;
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(30, 41, 59, 0.95));
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
  animation: pulseSkill 1.8s infinite;
}

.skill-btn[data-skill="meteor"].ready {
  border-color: var(--purple);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(30, 41, 59, 0.95));
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.35);
}

@keyframes pulseSkill {
  0%, 100% { box-shadow: 0 0 12px rgba(56, 189, 248, 0.25); }
  50% { box-shadow: 0 0 22px rgba(56, 189, 248, 0.55); }
}

.skill-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.skill-name { font-size: 13.5px; font-weight: 800; }
.skill-cost { font-size: 11px; font-weight: 700; color: var(--gold); }
.skill-sub { font-size: 11px; color: var(--text-sub); margin: 2px 0 6px; }

.skill-bar {
  height: 4px;
  background: rgba(9, 14, 26, 0.7);
  border-radius: 999px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #fbbf24);
  width: 0%;
  transition: width 0.25s;
}

/* Weapon Dock (10 Weapons) */
.weapon-dock-section {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.dock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-sub);
  margin-bottom: 8px;
  gap: 8px;
  flex-wrap: wrap;
}

.dock-summary { color: var(--orange); font-weight: 700; }

.weapon-dock {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
}

.dock-slot {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 6px 5px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dock-slot:hover { background: var(--bg-card-hover); }

.dock-slot.selected {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.14);
  transform: translateY(-2px);
}

.dock-slot.rusting {
  border-color: var(--orange);
  animation: alertPulse 1.1s infinite;
}

.dock-slot.sealed {
  border-color: var(--purple);
  animation: sealPulse 1.1s infinite;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(249, 115, 22, 0); }
}

@keyframes sealPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.6); }
  50% { box-shadow: 0 0 0 5px rgba(168, 85, 247, 0); }
}

.dock-slot .dock-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 10px;
}

.dock-slot .dock-word {
  font-size: 11px;
  font-weight: 800;
  color: #e2e8f0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-slot.locked .dock-word { color: var(--text-dim); }

.dock-stars {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: -1px;
}

.dock-dur {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.dock-dur-fill {
  height: 100%;
  background: var(--emerald);
  transition: width 0.25s;
}

.dock-slot.rusting .dock-dur-fill { background: var(--orange); }
.dock-slot.locked .dock-dur-fill { background: var(--text-dim); }

/* ==================== REPORT VIEW ==================== */
.report-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.grade-badge {
  width: 74px;
  height: 74px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fde047, #f97316);
  color: #0b1121;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
}

.report-title-wrap { flex: 1; min-width: 220px; }
.report-title-wrap h2 { font-size: 21px; font-weight: 900; }
.report-title-wrap p { font-size: 13px; color: var(--text-sub); }

.report-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-card {
  background: rgba(9, 14, 26, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  min-width: 84px;
}

.kpi-card span { display: block; font-size: 11px; color: var(--text-sub); }
.kpi-card strong { font-size: 18px; font-weight: 900; color: var(--gold); }

.report-body-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  align-items: start;
}

.report-word-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.rep-word-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.rep-word-body { flex: 1; min-width: 0; }

.rep-word-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.rep-word-top strong { font-size: 15px; color: #fff; }
.rep-stars { color: var(--gold); font-size: 12px; }
.rep-zh { font-size: 12.5px; color: #cbd5e1; margin: 2px 0 5px; }

.rep-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.rep-wrong {
  font-size: 11px;
  color: #fda4af;
  margin-top: 4px;
}

.report-grammar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.rep-gram-item {
  background: rgba(15, 23, 42, 0.78);
  border-left: 3px solid var(--emerald);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.rep-gram-item.wrong { border-left-color: var(--rose); }
.rep-gram-item strong { display: block; margin-bottom: 2px; }
.rep-gram-item p { color: var(--text-sub); }

.leaderboard-submit-box {
  background: rgba(9, 14, 26, 0.65);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  margin-bottom: 12px;
}

.leaderboard-submit-box h4 { font-size: 13.5px; margin-bottom: 8px; }

.submit-row {
  display: flex;
  gap: 8px;
}

.submit-row input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

.report-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==================== CUSTOM / MISTAKES / LEADERBOARD ==================== */
.custom-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

.form-row-two {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.form-row-two input, #custom-words-input, .lb-filters select {
  background: rgba(9, 14, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
}

#custom-words-input {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.6;
}

.custom-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.community-decks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deck-item {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.deck-item h4 { font-size: 14px; font-weight: 800; }
.deck-item p { font-size: 12px; color: var(--text-sub); }

.mistake-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mistakes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.table-wrap { overflow-x: auto; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.lb-table th, .lb-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.lb-table th {
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
}

.lb-filters { display: flex; gap: 8px; align-items: center; }

.empty-hint {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-sub);
  font-size: 13.5px;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 999;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  background: linear-gradient(155deg, #162033, #0d1424);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h3 { font-size: 18px; font-weight: 900; margin-top: 4px; }

.gm-timer-wrap {
  text-align: right;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 6px 12px;
  border-radius: 10px;
}

.gm-timer-wrap span { display: block; font-size: 10.5px; color: #fda4af; }
.gm-timer-wrap strong { font-size: 20px; color: #fb7185; font-family: ui-monospace, monospace; }

.gm-point-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--gold);
  margin-bottom: 10px;
}

.gm-prompt {
  background: rgba(9, 14, 26, 0.78);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.55;
  margin-bottom: 14px;
}

.gm-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.gm-opt-btn {
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.14s;
}

.gm-opt-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.14);
}

.gm-opt-key {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.gm-opt-btn.correct { border-color: var(--emerald); background: rgba(16, 185, 129, 0.22); }
.gm-opt-btn.wrong { border-color: var(--rose); background: rgba(244, 63, 94, 0.22); }

/* Sentence Order Builder */
.order-target-label { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }

.order-slots, .order-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(9, 14, 26, 0.72);
  border: 1px dashed rgba(148, 163, 184, 0.3);
}

.order-chip {
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  color: #e0f2fe;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.order-chip.used { opacity: 0.28; pointer-events: none; }

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

.gm-feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.gm-feedback.fail {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.45);
}

.gm-fb-title { font-size: 15px; font-weight: 900; margin-bottom: 4px; }
.gm-fb-exp { font-size: 13px; color: #e2e8f0; margin-bottom: 10px; }

.pause-card { max-width: 400px; text-align: center; }
.pause-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* Responsive */
@media (max-width: 1060px) {
  .hero-banner, .lobby-grid, .control-deck, .report-body-grid, .custom-grid {
    grid-template-columns: 1fr;
  }
  .weapon-dock {
    grid-template-columns: repeat(5, 1fr);
  }
  .mistakes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .app-shell { padding: 10px 10px 24px; }
  .textbook-grid, .preview-weapons-grid, .report-word-matrix, .mistakes-grid {
    grid-template-columns: 1fr;
  }
  .hero-loop { flex-wrap: wrap; }
  .loop-arrow { display: none; }
  .stage-wrapper { height: 195px; }
  .combatant-bar { width: 46%; padding: 6px 8px; }
  .weapon-dock { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .letter-box { width: 30px; height: 36px; font-size: 17px; }
}
