:root {
  color-scheme: dark;
  --bg: #050713;
  --panel: rgba(10, 15, 32, 0.9);
  --panel-strong: #0a1023;
  --line: rgba(176, 201, 255, 0.13);
  --line-strong: rgba(176, 201, 255, 0.25);
  --text: #f5f7ff;
  --muted: #9ba8c5;
  --soft: #6e7a99;
  --accent: #7de8dc;
  --focus: #fff1a9;
  --radius: 18px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr) 34px;
  background:
    radial-gradient(circle at 18% 12%, rgba(71, 84, 177, 0.2), transparent 31%),
    radial-gradient(circle at 79% 17%, rgba(123, 48, 142, 0.13), transparent 28%),
    #050713;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 19, 0.82);
  backdrop-filter: blur(18px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 230px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.03rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.global-audio-status {
  min-width: 108px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #9bb5dc;
  background: rgba(9, 14, 30, 0.72);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.global-audio-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #71809d;
}

.global-audio-status[data-state="playing"] {
  border-color: rgba(126, 241, 207, 0.5);
  color: #7ef1cf;
  background: rgba(24, 90, 77, 0.22);
}

.global-audio-status[data-state="playing"] i {
  background: #7ef1cf;
  box-shadow: 0 0 0 5px rgba(126, 241, 207, 0.12), 0 0 14px rgba(126, 241, 207, 0.8);
  animation: audio-pulse 1.2s ease-in-out infinite;
}

.global-audio-status[data-state="error"] {
  border-color: rgba(255, 159, 159, 0.5);
  color: #ff9f9f;
}

.global-audio-status[data-state="error"] i { background: #ff9f9f; }

@keyframes audio-pulse {
  50% { opacity: 0.45; transform: scale(0.78); }
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  height: 1px;
  background: rgba(225, 235, 255, 0.55);
  transform-origin: left center;
}

.brand-mark::before {
  width: 18px;
  left: 7px;
  top: 21px;
  transform: rotate(-48deg);
}

.brand-mark::after {
  width: 14px;
  left: 16px;
  top: 10px;
  transform: rotate(35deg);
}

.brand-mark i {
  position: absolute;
  display: block;
  border-radius: 999px;
  box-shadow: 0 0 14px currentColor;
}

.brand-mark i:nth-child(1) { width: 7px; height: 7px; left: 4px; top: 20px; color: #5dd9d3; background: currentColor; }
.brand-mark i:nth-child(2) { width: 9px; height: 9px; left: 13px; top: 5px; color: #ff6fae; background: currentColor; }
.brand-mark i:nth-child(3) { width: 6px; height: 6px; right: 0; top: 16px; color: #ffd85a; background: currentColor; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: min(340px, 31vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 21, 43, 0.8);
}

.search-box:focus-within {
  border-color: rgba(125, 232, 220, 0.55);
  box-shadow: 0 0 0 3px rgba(125, 232, 220, 0.08);
}

.search-box svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.9rem;
}

.search-box input::placeholder {
  color: #77829f;
}

.button,
.icon-button,
.view-tab,
.emotion-button,
.tree-star,
.play-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 0.86rem;
  font-weight: 700;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.button.primary {
  color: #08111f;
  background: linear-gradient(135deg, #97fff1, #72bff8);
}

.button.secondary,
.button.ghost {
  color: #dfe8ff;
  border: 1px solid var(--line-strong);
  background: rgba(16, 23, 47, 0.78);
}

.button.ghost {
  white-space: nowrap;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(460px, 1fr) 330px;
}

.left-panel,
.detail-panel {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
  backdrop-filter: blur(18px);
  scrollbar-width: thin;
  scrollbar-color: #293655 transparent;
}

.left-panel {
  border-right: 1px solid var(--line);
  padding: 16px;
}

.detail-panel {
  border-left: 1px solid var(--line);
  padding: 21px;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 8, 21, 0.65);
}

.view-tab {
  min-height: 36px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.85rem;
  font-weight: 700;
}

.view-tab.active {
  color: var(--text);
  background: #19213c;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.2);
}

.filter-section,
.route-section,
.composer-section {
  margin-top: 22px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.section-heading span,
.text-button {
  color: var(--soft);
  font-size: 0.75rem;
}

.text-button {
  padding: 2px;
  background: transparent;
}

.text-button:hover {
  color: var(--accent);
}

.emotion-filters {
  display: grid;
  gap: 5px;
}

.emotion-button {
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #cbd5ef;
  background: transparent;
  text-align: left;
  font-size: 0.83rem;
}

.emotion-button:hover,
.emotion-button.active {
  border-color: var(--line);
  background: rgba(28, 36, 66, 0.76);
}

.emotion-button i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--zone-color);
  box-shadow: 0 0 10px var(--zone-color);
}

.emotion-button small {
  color: var(--soft);
  font-size: 0.72rem;
}

.route-section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.route-section > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.playlist-count {
  margin: -4px 0 10px;
  color: var(--soft);
  font-size: 0.7rem;
}

.route-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: route;
}

.route-item,
.route-placeholder {
  min-height: 42px;
  display: grid;
  grid-template-columns: 26px 1fr 24px;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 12, 27, 0.68);
}

.route-item::before,
.route-placeholder::before {
  counter-increment: route;
  content: counter(route);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #0a1220;
  background: var(--item-color, #52617f);
  font-size: 0.7rem;
  font-weight: 800;
}

.route-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.route-item .playlist-remove {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.route-item .playlist-remove:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.route-item .playlist-track {
  width: 100%;
  min-width: 0;
  height: auto;
  display: grid;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.route-item .playlist-track:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.playlist-track small {
  overflow: hidden;
  color: var(--soft);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-placeholder {
  color: #56617b;
  font-size: 0.75rem;
}

.route-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.composer-section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.composer-section > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.composer-label {
  display: block;
  margin-bottom: 6px;
  color: #cbd5ef;
  font-size: 0.72rem;
  font-weight: 700;
}

#emotionPrompt {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: rgba(5, 9, 22, 0.82);
  font-size: 0.76rem;
  line-height: 1.5;
}

.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.prompt-examples button {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #aebbd6;
  background: rgba(18, 26, 51, 0.72);
  font-size: 0.64rem;
  cursor: pointer;
}

.prompt-examples button:hover {
  border-color: var(--line-strong);
  color: #fff;
}

.composer-controls {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 7px;
  margin-top: 10px;
}

.composer-controls label {
  grid-column: 1 / -1;
  color: var(--soft);
  font-size: 0.67rem;
}

#compositionDuration {
  min-width: 0;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: rgba(5, 9, 22, 0.82);
}

#generateMusic {
  padding: 0 10px;
  font-size: 0.72rem;
}

.emotion-match {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--soft);
  font-size: 0.68rem;
  line-height: 1.4;
}

.emotion-match strong { color: #cbd5ef; }

.emotion-match span {
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--match-color) 50%, transparent);
  border-radius: 999px;
  color: var(--match-color);
  background: color-mix(in srgb, var(--match-color) 10%, transparent);
}

.emotion-match small {
  width: 100%;
  color: var(--muted);
}

.story-button {
  grid-column: 1 / -1;
  min-height: 40px;
  border: 1px solid rgba(158, 123, 255, 0.45);
  color: #f4efff;
  background: linear-gradient(110deg, rgba(91, 140, 255, 0.18), rgba(255, 111, 174, 0.18));
}

.story-button:hover,
.story-button.playing {
  border-color: rgba(210, 191, 255, 0.82);
  background: linear-gradient(110deg, rgba(91, 140, 255, 0.31), rgba(255, 111, 174, 0.28));
}

.audio-status {
  margin-left: auto;
  color: #9bb5dc;
}

.audio-status[data-state="playing"] {
  color: #7ef1cf;
}

.audio-status[data-state="error"] {
  color: #ff9f9f;
}

.canvas-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 34% 36%, rgba(91, 140, 255, 0.08), transparent 27%),
    radial-gradient(circle at 68% 64%, rgba(255, 111, 174, 0.06), transparent 29%),
    #050815;
}

.canvas-toolbar {
  position: absolute;
  z-index: 4;
  top: 14px;
  left: 16px;
  right: 16px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.canvas-toolbar > * {
  pointer-events: auto;
}

.live-summary {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(7, 12, 29, 0.78);
  backdrop-filter: blur(12px);
}

.live-summary strong {
  font-size: 0.95rem;
}

.live-summary span,
.legend span {
  color: var(--muted);
  font-size: 0.75rem;
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(7, 12, 29, 0.78);
  backdrop-filter: blur(12px);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.size-dot {
  display: inline-block;
  border-radius: 999px;
  background: #cbd9ff;
  box-shadow: 0 0 8px rgba(203, 217, 255, 0.7);
}

.size-dot.small { width: 5px; height: 5px; }
.size-dot.medium { width: 8px; height: 8px; }
.size-dot.large { width: 11px; height: 11px; }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: rgba(7, 12, 29, 0.78);
  backdrop-filter: blur(12px);
}

.map-view,
.tree-view {
  position: absolute;
  inset: 0;
}

#starCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#starCanvas.dragging {
  cursor: grabbing;
}

.map-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(7, 12, 29, 0.75);
  backdrop-filter: blur(12px);
  font-size: 0.73rem;
  pointer-events: none;
}

.tree-view {
  overflow: auto;
  padding: 70px 18px 20px;
}

.treemap {
  min-height: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  grid-auto-rows: minmax(230px, 1fr);
  gap: 10px;
}

.tree-zone {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--zone-color) 34%, transparent);
  border-radius: 15px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--zone-color) 13%, #081023), rgba(7, 12, 29, 0.82));
}

.tree-zone header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tree-zone h3 {
  margin: 0;
  font-size: 0.79rem;
}

.tree-zone header span {
  color: var(--muted);
  font-size: 0.68rem;
}

.tree-items {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: stretch;
  gap: 4px;
}

.tree-star {
  flex: var(--weight) 1 23%;
  min-width: 52px;
  min-height: 42px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--zone-color) 24%, transparent);
  border-radius: 8px;
  color: #eef3ff;
  background: color-mix(in srgb, var(--zone-color) calc(8% + var(--rating) * 2%), rgba(8, 14, 31, 0.92));
  text-align: left;
  overflow: hidden;
}

.tree-star:hover,
.tree-star.selected {
  border-color: color-mix(in srgb, var(--zone-color) 75%, white);
  box-shadow: inset 0 0 20px color-mix(in srgb, var(--zone-color) 15%, transparent);
}

.tree-star strong,
.tree-star small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-star strong { font-size: 0.72rem; }
.tree-star small { margin-top: 3px; color: var(--muted); font-size: 0.62rem; }

.toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 12px);
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #eef6ff;
  background: rgba(14, 22, 45, 0.95);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 0.78rem;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-detail {
  min-height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-detail h2 {
  margin: 22px 0 8px;
  color: var(--text);
  font-size: 1rem;
}

.empty-detail p {
  max-width: 250px;
  margin: 0 auto;
  font-size: 0.82rem;
  line-height: 1.65;
}

.empty-orbit {
  position: relative;
  width: 110px;
  height: 110px;
  margin: auto;
  border: 1px solid rgba(129, 158, 216, 0.2);
  border-radius: 50%;
  transform: rotate(-22deg);
}

.empty-orbit::before,
.empty-orbit::after {
  content: "";
  position: absolute;
  inset: 16px -12px;
  border: 1px solid rgba(129, 158, 216, 0.13);
  border-radius: 50%;
}

.empty-orbit::after {
  inset: -12px 18px;
}

.empty-orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #96cfff;
  box-shadow: 0 0 14px #96cfff;
}

.empty-orbit i:nth-child(1) { left: 14px; top: 36px; }
.empty-orbit i:nth-child(2) { right: 17px; top: 17px; background: #ff8cbc; box-shadow: 0 0 14px #ff8cbc; }
.empty-orbit i:nth-child(3) { left: 50px; bottom: 4px; background: #ffe57d; box-shadow: 0 0 14px #ffe57d; }

.star-detail {
  animation: detail-in 220ms ease;
}

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

.detail-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.detail-kicker > span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--detail-color);
  box-shadow: 0 0 12px var(--detail-color);
}

#detailType {
  margin-left: auto;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  font-size: 0.65rem;
}

.star-detail h2 {
  margin: 17px 0 2px;
  font-size: 1.65rem;
  line-height: 1.25;
}

.latin-name {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  font-style: italic;
}

.rating-stars {
  display: flex;
  gap: 3px;
  margin: 13px 0 18px;
}

.rating-stars i {
  width: 7px;
  height: 7px;
  display: block;
  border-radius: 50%;
  background: #2a334e;
}

.rating-stars i.on {
  background: var(--detail-color);
  box-shadow: 0 0 8px var(--detail-color);
}

.story {
  margin: 0;
  padding: 14px 0 17px;
  border-top: 1px solid var(--line);
  color: #d4dcf0;
  font-size: 0.88rem;
  line-height: 1.75;
}

.music-card {
  margin-top: 2px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--detail-color) 28%, transparent);
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--detail-color) 12%, #111a33), rgba(9, 14, 30, 0.92));
}

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

.music-head span,
.music-head strong {
  display: block;
}

.music-head span {
  color: var(--muted);
  font-size: 0.68rem;
}

.music-head strong {
  margin-top: 4px;
  font-size: 0.9rem;
}

.play-button {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07101e;
  background: var(--detail-color);
  box-shadow: 0 0 24px color-mix(in srgb, var(--detail-color) 38%, transparent);
}

.play-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.play-button .stop-icon,
.play-button.playing .play-icon {
  display: none;
}

.play-button.playing .stop-icon {
  display: block;
}

.progress-track {
  height: 3px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--detail-color);
  box-shadow: 0 0 8px var(--detail-color);
}

.music-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 11px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.66rem;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 15px 0;
}

.coordinate-grid div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 13, 28, 0.5);
}

.coordinate-grid dt {
  color: var(--soft);
  font-size: 0.62rem;
}

.coordinate-grid dd {
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 700;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  color: #697591;
  background: #050713;
  font-size: 0.66rem;
  overflow: hidden;
}

footer > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-links {
  display: flex;
  gap: 10px;
}

.footer-links a {
  color: #8e9bb9;
  text-decoration: none;
}

.footer-links a:hover {
  color: #dbe6ff;
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 232px minmax(400px, 1fr) 300px; }
  .treemap { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
  .legend span:nth-child(2) { display: none; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { min-height: 100dvh; grid-template-rows: auto auto auto; }
  .topbar { min-height: 72px; padding: 12px 14px; }
  .brand p { display: none; }
  .search-box { width: min(280px, 48vw); }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 62dvh auto;
  }
  .left-panel,
  .detail-panel { overflow: visible; border: 0; }
  .left-panel { border-bottom: 1px solid var(--line); }
  .detail-panel { border-top: 1px solid var(--line); }
  .filter-section { margin-top: 14px; }
  .emotion-filters { grid-template-columns: repeat(2, 1fr); }
  .route-section { margin-top: 14px; }
  .route-actions { grid-template-columns: 1fr 1fr; }
  .empty-detail { min-height: 260px; }
  footer { min-height: 42px; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .brand { min-width: auto; }
  .brand h1 { font-size: 0.95rem; }
  .top-actions { width: 100%; }
  .global-audio-status { order: 3; width: 100%; }
  .search-box { flex: 1; width: auto; }
  .button.ghost { padding: 0 11px; }
  .workspace { grid-template-rows: auto 68dvh auto; }
  .emotion-filters { grid-template-columns: 1fr 1fr; }
  .emotion-button { padding: 0 7px; font-size: 0.76rem; }
  .legend { display: none; }
  .canvas-toolbar { left: 10px; right: 10px; }
  .map-hint { max-width: calc(100% - 20px); white-space: nowrap; }
  .tree-view { padding: 64px 10px 12px; }
  .treemap { grid-template-columns: 1fr; grid-auto-rows: 250px; }
  .detail-panel { padding: 18px 16px 26px; }
  footer > span:first-child { white-space: normal; line-height: 1.35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
