:root {
  --bg: #090b10;
  --panel: #11151d;
  --panel-2: #171c26;
  --line: #29313d;
  --muted: #8993a3;
  --text: #f3f5f7;
  --accent: #f5b83d;
  --shadow: 0 22px 65px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.app-shell { min-height: 100vh; max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.topbar { height: 78px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand { color: var(--text); text-decoration: none; font: 700 23px/1 'Barlow Condensed', sans-serif; letter-spacing: .02em; }
.search-panel { margin-top: 48px; padding: 24px; border: 1px solid var(--line); background: rgba(17, 21, 29, .88); box-shadow: var(--shadow); }
.search-row { display: flex; gap: 13px; align-items: end; }
label { display: block; flex: 1; }
label > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
input, select { width: 100%; height: 48px; padding: 0 14px; color: var(--text); border: 1px solid var(--line); border-radius: 2px; outline: none; background: var(--panel-2); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245, 184, 61, .1); }
input::placeholder { color: #657080; }
select { appearance: auto; }
.name-field { flex: 1; }
.search-button { height: 48px; min-width: 110px; border: 0; border-radius: 2px; color: #1a1308; background: var(--accent); font-weight: 800; letter-spacing: .06em; transition: transform .15s, background .15s; }
.search-button:hover { background: #ffd16b; transform: translateY(-1px); }
.filters-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; margin-top: 18px; }
.status { min-height: 25px; padding: 24px 0 0; color: var(--muted); }
.status.error { color: #ff9a8f; }
.status.loading { color: var(--accent); }
.hidden { display: none !important; }
.results-section, .profile-section { margin-top: 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
h2, h3 { margin: 0; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; letter-spacing: .02em; }
h2 { font-size: 38px; line-height: 1; }
.result-count { color: var(--muted); font-size: 12px; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 13px; }
.result-card { position: relative; display: flex; flex-direction: column; min-height: 192px; padding: 19px; border: 1px solid var(--line); background: var(--panel); transition: border-color .15s, transform .15s; }
.result-card:hover, .result-card.selected { border-color: var(--accent); transform: translateY(-2px); }
.result-top { display: flex; justify-content: space-between; gap: 10px; }
.result-name { font: 700 27px/1 'Barlow Condensed', sans-serif; overflow-wrap: anywhere; }
.level-badge { color: var(--accent); font-size: 11px; font-weight: 800; white-space: nowrap; }
.result-meta { display: grid; gap: 5px; margin-top: auto; padding-top: 22px; color: var(--muted); font-size: 13px; }
.result-meta b { color: var(--text); font-weight: 600; }
.open-profile { width: 100%; margin-top: 18px; padding: 10px 12px; border: 1px solid #4e5968; color: var(--text); background: transparent; font-weight: 700; }
.open-profile:hover { border-color: var(--accent); color: var(--accent); }
.profile-card { display: grid; grid-template-columns: 180px 1fr; gap: 26px; padding: 26px; border: 1px solid var(--line); background: var(--panel); }
.profile-avatar { width: 180px; height: 180px; object-fit: cover; border: 1px solid var(--line); background: #0b0e14; }
.profile-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.profile-name { font-size: clamp(40px, 6vw, 64px); line-height: .9; }
.profile-subtitle { margin-top: 10px; color: var(--muted); }
.profile-cp { color: var(--accent); font: 700 28px/1 'Barlow Condensed', sans-serif; text-align: right; white-space: nowrap; }
.profile-cp small { display: block; color: var(--muted); font: 700 10px/1.4 Inter, sans-serif; letter-spacing: .1em; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 28px; }
.detail { padding: 13px; border-left: 2px solid var(--accent); background: var(--panel-2); }
.detail span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.detail b { display: block; margin-top: 4px; font-size: 14px; }
.profile-block { margin-top: 22px; }
.profile-block h3 { margin-bottom: 10px; color: var(--accent); font-size: 22px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 7px 9px; color: #c7ced8; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; }
.chip b { color: var(--text); }
.back-button { margin-bottom: 16px; padding: 9px 12px; border: 1px solid var(--line); color: var(--muted); background: transparent; font-size: 12px; }
.back-button:hover { color: var(--text); border-color: var(--accent); }
.result-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 18px; }
.result-actions .open-profile { grid-column: 1 / -1; margin-top: 0; }
.open-new-tab, .copy-markdown, .text-button { display: inline-flex; align-items: center; justify-content: center; padding: 9px 12px; border: 1px solid var(--line); color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; text-decoration: none; }
.open-new-tab:hover, .copy-markdown:hover, .text-button:hover { border-color: var(--accent); color: var(--accent); }
.copy-markdown.copied { border-color: #8bd6a3; color: #8bd6a3; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.profile-actions .back-button { margin-bottom: 0; }
.history-section { margin-top: 30px; }
.history-section .section-heading { margin-bottom: 12px; }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); color: var(--text); text-align: left; background: var(--panel); }
.history-item:hover { border-color: var(--accent); }
.history-item b, .history-item small { display: block; }
.history-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.history-arrow { color: var(--accent); font-size: 18px; }
@media (max-width: 700px) {
  .app-shell { padding: 0 16px; }
  .topbar { height: 64px; }
  .search-panel { margin-top: 32px; padding: 16px; }
  .search-row, .filters-row { display: grid; grid-template-columns: 1fr; }
  .search-button { width: 100%; }
  .profile-card { grid-template-columns: 1fr; }
  .profile-avatar { width: 100%; height: 210px; }
  .profile-header { display: block; }
  .profile-cp { margin-top: 18px; text-align: left; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
