:root {
  --bg: #0a0a12;
  --bg2: #11111f;
  --panel: rgba(20,20,36,0.92);
  --text: #e8e8f4;
  --muted: #8a8aa6;
  --border: rgba(255,255,255,0.08);
  --accent: #5B8DEF;
  --shadow: 0 10px 40px rgba(0,0,0,0.5);
  --radius: 16px;
}
[data-theme="light"] {
  --bg: #eef1f8;
  --bg2: #e3e7f2;
  --panel: rgba(255,255,255,0.92);
  --text: #1a1a2e;
  --muted: #5a5a7a;
  --border: rgba(0,0,0,0.1);
  --shadow: 0 10px 30px rgba(60,60,120,0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: radial-gradient(1200px 800px at 70% -10%, #1a1230 0%, transparent 60%),
              radial-gradient(900px 700px at 0% 110%, #102040 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: Sora, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
[data-theme="light"] body {
  background: radial-gradient(1000px 700px at 80% -10%, #d8e0ff 0%, transparent 60%),
              radial-gradient(800px 600px at 0% 110%, #d6f0ff 0%, transparent 55%),
              var(--bg);
}

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,20,40,0.6), rgba(20,20,40,0));
  backdrop-filter: blur(8px);
  position: relative; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-dot {
  width: 38px; height: 38px; border-radius: 12px;
  background: conic-gradient(from 0deg, #5B8DEF, #FF4FD8, #FF8C42, #43C6A8, #5B8DEF);
  box-shadow: 0 0 24px rgba(91,141,239,0.5);
  flex: none;
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.tag { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.search-wrap {
  position: relative; flex: 1; max-width: 460px; margin-left: auto;
}
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#search {
  width: 100%; height: 44px;
  padding: 0 16px 0 42px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: 500 14px Sora, sans-serif;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91,141,239,0.18); }
[data-theme="light"] #search { background: rgba(255,255,255,0.7); }

.suggest {
  position: absolute; top: 50px; left: 0; right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px; z-index: 50;
  max-height: 320px; overflow-y: auto;
}
.sug-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: transparent;
  color: var(--text); border-radius: 10px; cursor: pointer;
  font: 500 14px Sora, sans-serif;
}
.sug-row:hover { background: rgba(255,255,255,0.06); }
.sug-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sug-row .sug-gen { margin-left: auto; font-size: 11px; color: var(--muted); font-family: JetBrains Mono, monospace; }

.chips {
  display: flex; gap: 8px; padding: 12px 18px;
  overflow-x: auto; overflow-y: hidden;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.chips::-webkit-scrollbar { height: 4px; }
.chips::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font: 500 12.5px Sora, sans-serif;
  cursor: pointer; white-space: nowrap;
  transition: all .18s;
  opacity: 0.65;
}
.chip:hover { opacity: 1; transform: translateY(-1px); }
.chip.on {
  opacity: 1; background: color-mix(in srgb, var(--c) 22%, transparent);
  border-color: var(--c);
  box-shadow: 0 0 0 1px var(--c), 0 6px 18px color-mix(in srgb, var(--c) 35%, transparent);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

.stage {
  position: relative;
  display: flex;
  height: calc(100vh - 154px);
  height: calc(100dvh - 154px);
}
#net { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted);
  background: rgba(10,10,20,0.5); padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  pointer-events: none; text-align: center; max-width: 90%;
}

.panel {
  position: absolute; right: 14px; top: 14px; bottom: 14px;
  width: 340px; max-width: 88vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow-y: auto;
  z-index: 20;
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 6px; }

.panel-empty { padding: 26px 22px; }
.panel-empty-icon {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 14px;
  background: conic-gradient(from 30deg, #5B8DEF, #FF4FD8, #FF8C42, #43C6A8, #5B8DEF);
  box-shadow: 0 0 26px rgba(255,79,216,0.3);
}
.panel-empty h2 { margin: 0 0 8px; font-size: 20px; }
.panel-empty p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.legend-mini { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.legend-mini li { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.legend-mini .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.panel-content { padding: 22px; }
.panel-head { display: flex; align-items: flex-start; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 22px; line-height: 1.2; flex: 1; font-weight: 800; }
.p-close {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer;
}
.p-close:hover { background: rgba(255,255,255,0.1); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.tag {
  font-size: 11px; font-weight: 600; padding: 5px 10px;
  border-radius: 12px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  transition: transform .15s;
}
.tag:hover { transform: translateY(-1px); }

.meta { font-size: 12px; color: var(--muted); margin: 0 0 12px; font-family: JetBrains Mono, monospace; }
.desc { font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; color: var(--text); opacity: 0.92; }

.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.link-btn {
  display: flex; align-items: center; justify-content: center;
  height: 44px; border-radius: 12px; text-decoration: none;
  font: 600 13px Sora, sans-serif; color: #fff;
  border: 1px solid var(--border); transition: transform .15s, box-shadow .2s;
}
.link-btn.yt { background: linear-gradient(135deg, #ff0033, #cc0033); }
.link-btn.sp { background: linear-gradient(135deg, #1db954, #168a40); }
.link-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }

.sim-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.similar-grid { display: grid; gap: 8px; }
.sim-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text); cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform .15s, border-color .2s;
}
.sim-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c);
}
.sim-card:hover { transform: translateX(2px); border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.sim-name { font: 600 14px Sora, sans-serif; }
.sim-gen { font: 500 11px JetBrains Mono, monospace; color: var(--muted); }

.foot {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 18px;
  font-size: 11px; color: var(--muted);
  font-family: JetBrains Mono, monospace;
  pointer-events: none;
  z-index: 5;
}
.foot-hint { opacity: 0.7; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .brand-text .tag { display: none; }
  .search-wrap { max-width: none; order: 3; flex-basis: 100%; }
  .chips { padding: 10px 12px; }
  .stage { height: calc(100dvh - 168px); flex-direction: column; }
  .panel { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 46vh; }
  .panel[data-empty="true"] { max-height: 40vh; }
  .hint { display: none; }
  .foot { display: none; }
  .legend-mini { grid-template-columns: 1fr; }
}
