:root {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #101828;
  background-color: #f6f7fb;
  --accent: #3d5afe;
  --accent-dark: #1c36c4;
  --border: #e4e7ec;
  --muted: #475467;
  --surface: #ffffff;
  --success: #12b76a;
  --error: #f04438;
  --warning: #f79009;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(61, 90, 254, 0.08), transparent 45%),
    var(--background, #f6f7fb);
  color: #101828;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--accent);
}

.hero {
  padding: 48px 6vw 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
}

.hero__content {
  max-width: 640px;
}

.hero__eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero__lead {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.hero__status {
  min-height: 28px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.hero__status[data-status="success"] {
  color: var(--success);
}

.hero__status[data-status="error"] {
  color: var(--error);
}

.hero__status[data-status="warning"] {
  color: var(--warning);
}

.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  min-height: 80vh;
}

.search-section {
  width: 100%;
  max-width: 720px;
  text-align: center;
  margin-bottom: 40px;
  transition: margin-bottom 0.4s ease;
}

.app-title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.input-wrapper {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.input-wrapper:focus-within {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
  border-color: rgba(61, 90, 254, 0.2);
}

.search-box textarea {
  width: 100%;
  border: none;
  background: transparent;
  padding: 20px 60px 20px 24px;
  font-size: 1.1rem;
  border-radius: 24px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  min-height: 68px;
  color: #1d2939;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 4px 12px rgba(61, 90, 254, 0.3);
}

.search-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-50%) scale(1.05);
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.status-message {
  height: 24px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.status-message:not(:empty) {
  opacity: 1;
}

.mindmap-container {
  width: 100%;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.1);
  overflow: auto;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.mindmap-container.hidden {
  display: none;
}

@keyframes slideUpFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .app-title {
    font-size: 2rem;
  }

  .mindmap-container {
    border-radius: 20px;
  }

  .search-box textarea {
    font-size: 1rem;
    padding: 16px 50px 16px 20px;
  }

  .search-btn {
    width: 40px;
    height: 40px;
  }
}

.mindmap-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 320px;
  color: var(--muted);
  font-size: 1rem;
  padding: 48px;
  line-height: 1.6;
}

.mindmap-placeholder.hidden {
  display: none;
}

.mindmap-view {
  position: relative;
  width: 100%;
  min-height: 360px;
  overflow: visible;
}

.mindmap-view.hidden {
  display: none;
}

.mindmap-view .jsmind-inner {
  position: relative;
  overflow: visible;
  width: 100%;
  height: auto;
  outline: none;
  border-radius: 24px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  min-width: max-content;
}

.mindmap-view canvas.jsmind,
.mindmap-view svg.jsmind {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.mindmap-view jmnodes {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
}

.mindmap-view jmnode {
  position: absolute;
  display: block;
  max-width: 340px;
  padding: 12px 18px;
  border-radius: 18px;
  background: #fff;
  color: #1d2939;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
  border: 1px solid rgba(61, 90, 254, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mindmap-view .morph-part {
  font-weight: 600;
  color: #0f172a;
}

.mindmap-view .branch-text {
  display: inline-block;
}

.mindmap-view .branch-synonyms-text,
.mindmap-view .branch-antonyms-text {
  font-weight: 500;
}

.mindmap-view .branch-word_forms-text {
  font-weight: 600;
}

.mindmap-view .branch-collocations-text {
  font-weight: 600;
}

.mindmap-view .translation-label {
  font-weight: 500;
  color: #475467;
}

.mindmap-view .word-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted rgba(61, 90, 254, 0.4);
  cursor: pointer;
}

.mindmap-view .word-link:hover {
  border-bottom-color: var(--accent);
}

.mindmap-view jmnode .node-note {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #667085;
}

.mindmap-view jmnode.root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mindmap-view jmnode.root .root-topic {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mindmap-view jmnode.root .root-word {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.mindmap-view jmnode.root .root-phonetic {
  font-size: 0.85rem;
  color: #667085;
  font-family: monospace;
  margin-top: -8px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.mindmap-view jmnode.root .phonetic-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mindmap-view jmnode.root .phonetic-label {
  font-size: 0.7rem;
  color: #98a2b3;
  font-weight: 600;
  font-family: sans-serif;
}

.mindmap-view jmnode.root .root-translations {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mindmap-view jmnode.root .root-translation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 500;
}

.mindmap-view jmnode.root .translation-pos {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #475467;
}

.mindmap-view jmnode.root .translation-text {
  color: #667085;
  font-weight: 500;
  font-size: 0.85rem;
}

.mindmap-view jmnode:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 42px rgba(15, 23, 42, 0.2);
}

.mindmap-view jmnode.selected {
  border: 1px solid var(--accent);
  box-shadow: 0 25px 45px rgba(61, 90, 254, 0.35);
}

.mindmap-view jmexpander {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(61, 90, 254, 0.4);
  color: rgba(61, 90, 254, 0.8);
  background: #fff;
  line-height: 16px;
  font-size: 0.75rem;
  text-align: center;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-weight: 600;
}

button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(61, 90, 254, 0.3);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

button.primary:not(:disabled):hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.page-footer {
  text-align: center;
  padding: 32px 16px 48px;
  color: var(--muted);
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .translator-form__actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}

.theme-words-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 400px;
}

.theme-word-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.theme-word-text {
  font-weight: 600;
  color: #1d2939;
}

.theme-word-explanation {
  font-size: 0.8rem;
  color: #667085;
}