@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Noto+Sans+SC:wght@300;400;500&display=swap");

:root {
  color-scheme: dark;
  --cyan: #8ff8ff;
  --yellow: #fff06a;
  --line: rgba(168, 229, 239, 0.16);
  --mono: "DM Mono", Consolas, monospace;
  --body: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  color: #f4f7f8;
  font-family: var(--body);
}

button { color: inherit; font: inherit; }

#universe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#universe.is-dragging { cursor: grabbing; }

.space-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.22) 78%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(rgba(4, 11, 18, 0.05), rgba(0, 0, 0, 0.18));
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 22px 28px;
  pointer-events: none;
}

.hud-brand,
.hud-status {
  display: flex;
  align-items: center;
}

.hud-brand { gap: 10px; }

.hud-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.hud-brand strong {
  font: 500 10px var(--mono);
  letter-spacing: 0.18em;
}

.hud-brand small {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: #5a6770;
  font: 400 8px var(--mono);
  letter-spacing: 0.14em;
}

.hud-status {
  gap: 11px;
  color: #5d6870;
  font: 400 8px var(--mono);
  letter-spacing: 0.14em;
}

.hud-status i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #6d7880;
}

.drag-guide {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #7c878d;
  font: 400 9px var(--mono);
  letter-spacing: 0.06em;
  transform: translateX(-50%);
  transition: opacity 500ms ease;
  pointer-events: none;
}

.drag-guide p { margin: 0; }
.drag-arrows { color: var(--cyan); animation: guide 1.5s ease-in-out infinite alternate; }
.drag-arrows:last-child { animation-direction: alternate-reverse; }

@keyframes guide {
  to { transform: translateX(5px); opacity: 0.4; }
}

.corner-note {
  position: fixed;
  bottom: 25px;
  left: 28px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #39454d;
  font: 400 7px var(--mono);
  letter-spacing: 0.15em;
  pointer-events: none;
}

.word-card {
  position: fixed;
  top: 50%;
  right: 34px;
  z-index: 10;
  width: min(350px, calc(100vw - 30px));
  padding: 30px;
  border: 1px solid rgba(142, 245, 255, 0.22);
  background: rgba(3, 8, 14, 0.84);
  box-shadow: 0 20px 90px rgba(0, 0, 0, 0.72), inset 0 0 50px rgba(92, 216, 232, 0.03);
  opacity: 0;
  transform: translate(30px, -50%);
  backdrop-filter: blur(22px);
  pointer-events: none;
  transition: 300ms ease;
}

.word-card.is-open {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

.card-close {
  position: absolute;
  top: 12px;
  right: 13px;
  border: 0;
  background: none;
  color: #657079;
  font: 300 24px/1 var(--mono);
  cursor: pointer;
}

.star-code {
  color: var(--cyan);
  font: 400 8px var(--mono);
  letter-spacing: 0.18em;
}

.word-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.word-heading h1 {
  margin: 0;
  font: 500 39px/1 var(--mono);
  letter-spacing: -0.06em;
}

.word-heading p {
  margin: 8px 0 0;
  color: #77838b;
  font: 300 11px var(--mono);
}

.speak-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(143, 248, 255, 0.22);
  border-radius: 50%;
  background: rgba(143, 248, 255, 0.05);
  color: var(--cyan);
  cursor: pointer;
}

.word-meta { display: flex; align-items: flex-start; gap: 6px; margin-top: 22px; }

.word-meta span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  color: #879198;
  font: 400 8px var(--mono);
}

#wordRoot {
  max-width: 235px;
  overflow-wrap: anywhere;
}

.word-meaning {
  margin: 17px 0 23px;
  font-size: 14px;
}

.word-example {
  padding: 15px;
  border-left: 1px solid var(--yellow);
  background: rgba(255, 255, 255, 0.025);
}

.word-example small { color: var(--yellow); font: 400 7px var(--mono); letter-spacing: 0.16em; }
.word-example p { margin: 9px 0 6px; color: #c0c7cb; font: 300 11px/1.7 var(--mono); }
.word-example span { color: #69747b; font-size: 9px; }

.learn-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(143, 248, 255, 0.35);
  background: rgba(143, 248, 255, 0.06);
  color: var(--cyan);
  font: 400 10px var(--mono);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: 180ms ease;
}

.learn-button:hover {
  background: var(--cyan);
  color: #031014;
  box-shadow: 0 0 28px rgba(143, 248, 255, 0.24);
}

.learn-button.is-learned {
  border-color: rgba(255, 240, 105, 0.35);
  background: rgba(255, 240, 105, 0.08);
  color: var(--yellow);
  cursor: default;
}

.learn-spark {
  font-size: 14px;
  line-height: 1;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 17px;
  background: #000;
}

.loading.is-hidden { display: none; }

.loading span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 20px 5px var(--cyan);
  animation: pulse 900ms ease-in-out infinite alternate;
}

.loading p {
  margin: 0;
  color: #536169;
  font: 400 8px var(--mono);
  letter-spacing: 0.22em;
}

@keyframes pulse { to { transform: scale(1.7); opacity: 0.45; } }

@media (max-width: 700px) {
  .hud { padding: 17px; }
  .hud-brand small, .hud-status { display: none; }
  .corner-note { display: none; }
  .drag-guide { bottom: 18px; width: 100%; justify-content: center; }
  .word-card { top: auto; right: 15px; bottom: 15px; left: 15px; width: auto; transform: translateY(25px); }
  .word-card.is-open { transform: translateY(0); }
}

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