:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #18202a;
  --muted: #687486;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-2: #b42318;
  --accent-3: #7c3aed;
  --shadow: 0 12px 32px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.5;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #101820;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(124, 58, 237, 0.88)),
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(255,255,255,.12) 8px 10px);
  font-size: 26px;
  font-weight: 800;
}

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

h1 {
  font-size: 28px;
  line-height: 1.1;
}

.brand p,
.header-meta {
  color: #cbd5e1;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-size: 13px;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 32px 40px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats > div {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
}

.stat-value {
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(150px, 1fr)) minmax(220px, auto);
  gap: 14px;
  align-items: end;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.toggle input {
  width: auto;
  min-height: auto;
}

.toggle span {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  text-transform: none;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.agency-panel,
.results {
  min-width: 0;
}

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

.section-title h2 {
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.agency-list {
  display: grid;
  gap: 8px;
}

.agency-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.agency-button:hover,
.agency-button.active {
  border-color: var(--accent);
  background: #ecfdf5;
}

.agency-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agency-button span {
  color: var(--muted);
}

.result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.vtuber-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 24px 20px, rgba(255,255,255,.55), transparent 14px),
    linear-gradient(135deg, #0f766e, #2563eb 48%, #b42318);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.large {
  width: 128px;
  height: 128px;
  font-size: 42px;
}

.vtuber-body {
  min-width: 0;
}

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

.vtuber-head h3 {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.3;
}

.vtuber-head h3 a {
  color: inherit;
  text-decoration: none;
}

.vtuber-head h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  flex: 0 0 auto;
  max-width: 140px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.review {
  background: #fff7ed;
  color: #9a3412;
}

.description {
  display: -webkit-box;
  min-height: 42px;
  margin-top: 10px;
  color: #384454;
  font-size: 14px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.meta {
  min-width: 0;
  padding: 8px;
  border-radius: 6px;
  background: var(--surface-2);
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.tag-row,
.account-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag,
.account-link {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-link {
  background: #f1f5f9;
  color: #334155;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.profile-page {
  display: grid;
  gap: 24px;
  max-width: 960px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-hero h2 {
  margin: 4px 0 8px;
  font-size: 32px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.profile-facts div {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.profile-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.plain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.plain-list li,
.plain-list a {
  color: var(--text);
}

@media (max-width: 980px) {
  .app-header,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .search-box,
  .toggle-row {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .agency-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  .stats,
  .controls,
  .result-list,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .vtuber-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }

  .profile-hero,
  .profile-facts {
    grid-template-columns: 1fr;
  }
}
