:root {
  --hx-bg: #f6f1e8;
  --hx-surface: #ffffff;
  --hx-text: #102036;
  --hx-muted: #5d6b82;
  --hx-teal: #0f766e;
  --hx-gold: #bb6b1f;
  --hx-indigo: #4f46e5;
  --hx-border: rgba(16, 32, 54, 0.12);
  --hx-shadow: 0 18px 40px rgba(16, 32, 54, 0.1);
  --hx-radius: 20px;
  --hx-font: 'Inter', system-ui, sans-serif;
  --hx-heading: 'Space Grotesk', 'Inter', sans-serif;
}

[data-theme="dark"] {
  --hx-bg: #07101f;
  --hx-surface: #101b30;
  --hx-text: #f4f7fb;
  --hx-muted: #b4c0d4;
  --hx-border: rgba(148, 163, 184, 0.2);
  --hx-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--hx-font);
  color: var(--hx-text);
  background:
    radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.14), transparent 36%),
    radial-gradient(circle at 88% 0%, rgba(187, 107, 31, 0.12), transparent 32%),
    var(--hx-bg);
  line-height: 1.6;
}

.hx-shell { min-height: 100vh; display: flex; flex-direction: column; }
.hx-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--hx-surface) 88%, transparent);
  border-bottom: 1px solid var(--hx-border);
}
.hx-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.hx-brand {
  display: flex; align-items: center; gap: 0.65rem;
  text-decoration: none; color: inherit;
}
.hx-brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--hx-teal), var(--hx-indigo));
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.hx-brand h1 {
  margin: 0; font-family: var(--hx-heading); font-size: 1.05rem;
}
.hx-brand p { margin: 0; font-size: 0.78rem; color: var(--hx-muted); }

.hx-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.hx-nav button, .hx-btn {
  border: 1px solid var(--hx-border);
  background: var(--hx-surface);
  color: var(--hx-text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: 160ms ease;
}
.hx-nav button:hover, .hx-btn:hover { border-color: var(--hx-teal); }
.hx-nav button.active, .hx-btn.primary {
  background: var(--hx-teal); color: #fff; border-color: var(--hx-teal);
}
.hx-btn.ghost { background: transparent; }

.hx-main { flex: 1; max-width: 1180px; margin: 0 auto; width: 100%; padding: 1.25rem; }
.hx-panel {
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-radius);
  box-shadow: var(--hx-shadow);
  padding: 1.25rem;
}
.hx-hero {
  display: grid; gap: 1rem;
  grid-template-columns: 1.2fr 0.8fr;
}
@media (max-width: 860px) {
  .hx-hero { grid-template-columns: 1fr; }
  .hx-nav { display: none; }
  .hx-bottom-nav { display: flex; }
}
.hx-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: color-mix(in srgb, var(--hx-surface) 92%, transparent);
  border-top: 1px solid var(--hx-border);
  padding: 0.5rem; justify-content: space-around; z-index: 50;
}
.hx-bottom-nav button {
  flex: 1; border: 0; background: transparent; color: var(--hx-muted);
  font: inherit; font-size: 0.72rem; padding: 0.35rem;
}
.hx-bottom-nav button.active { color: var(--hx-teal); font-weight: 700; }

.hx-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
@media (max-width: 700px) { .hx-stat-grid { grid-template-columns: repeat(2, 1fr); } }
.hx-stat {
  padding: 0.85rem; border-radius: 16px;
  border: 1px solid var(--hx-border);
  background: color-mix(in srgb, var(--hx-teal) 6%, var(--hx-surface));
}
.hx-stat strong { display: block; font-size: 1.35rem; font-family: var(--hx-heading); }
.hx-stat span { font-size: 0.78rem; color: var(--hx-muted); }

.hx-lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.hx-lesson-card {
  border: 1px solid var(--hx-border); border-radius: 18px; padding: 1rem;
  display: flex; flex-direction: column; gap: 0.65rem;
}
.hx-lesson-card h3 { margin: 0; font-family: var(--hx-heading); font-size: 1rem; }
.hx-progress {
  height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--hx-teal) 12%, transparent);
  overflow: hidden;
}
.hx-progress > span {
  display: block; height: 100%; background: linear-gradient(90deg, var(--hx-teal), var(--hx-gold));
  border-radius: inherit;
}

.hx-dict-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.hx-credit a {
  color: var(--hx-teal);
}

.hx-search {
  width: 100%; padding: 0.85rem 1rem; border-radius: 14px;
  border: 1px solid var(--hx-border); font: inherit; margin-bottom: 1rem;
}
.hx-dict-list { display: grid; gap: 0.65rem; max-height: 58vh; overflow: auto; }
.hx-dict-item {
  padding: 0.85rem; border-radius: 14px; border: 1px solid var(--hx-border);
}
.hx-dict-item strong { color: var(--hx-teal); }
.hx-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--hx-gold) 14%, transparent);
  color: var(--hx-gold); margin-right: 0.35rem;
}

.hx-quiz-options { display: grid; gap: 0.55rem; }
.hx-quiz-options button {
  text-align: left; padding: 0.85rem 1rem; border-radius: 14px;
  border: 1px solid var(--hx-border); background: var(--hx-surface);
  font: inherit; cursor: pointer;
}
.hx-quiz-options button.correct { border-color: #059669; background: #ecfdf5; }
.hx-quiz-options button.wrong { border-color: #dc2626; background: #fef2f2; }

.hx-footer {
  text-align: center; padding: 1.5rem; color: var(--hx-muted); font-size: 0.85rem;
}
.hx-footer a { color: var(--hx-teal); }
