* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --ink: #202326;
  --muted: #66706b;
  --line: #d9ded9;
  --accent: #c9342f;
  --accent-ink: #ffffff;
  --teal: #117d72;
  --gold: #a46a12;
  --blue: #326aa8;
  --shadow: 0 14px 32px rgba(30, 35, 38, 0.08);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 3vw, 36px) 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.brand-mark span {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
}

.brand-mark span:first-child {
  background: var(--accent);
}

.brand-mark span:last-child {
  background: var(--teal);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
}

.brand p,
.panel-heading p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.text-button {
  min-height: 38px;
  min-width: 54px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-weight: 700;
}

.text-button.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.workspace {
  padding: 20px clamp(16px, 3vw, 36px) 36px;
}

.controls {
  display: grid;
  gap: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) repeat(3, minmax(150px, 0.7fr));
  gap: 10px;
}

.search-box,
.select-box {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.search-box span,
.select-box span {
  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: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(17, 125, 114, 0.28);
  outline-offset: 2px;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px 10px;
  cursor: pointer;
}

.quick-filter.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat-tile {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.stat-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-tile strong {
  font-size: 28px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 420px);
  gap: 16px;
  align-items: start;
}

.results-panel,
.detail-panel {
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  font-size: 18px;
}

.channel-list {
  display: grid;
  gap: 8px;
}

.channel-card {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.channel-card:hover,
.channel-card.is-selected {
  border-color: rgba(201, 52, 47, 0.6);
  box-shadow: var(--shadow);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  overflow: hidden;
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar img + span {
  display: none;
}

.avatar img.is-hidden {
  display: none;
}

.avatar img.is-hidden + span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.avatar[data-tone="slot"] {
  background: linear-gradient(135deg, var(--blue), #25292d);
}

.avatar[data-tone="both"] {
  background: linear-gradient(135deg, var(--accent), var(--gold), var(--teal));
}

.card-main {
  min-width: 0;
}

.card-main h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.card-meta {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
}

.chip.red {
  background: rgba(201, 52, 47, 0.12);
  color: #8c211e;
}

.chip.teal {
  background: rgba(17, 125, 114, 0.12);
  color: #075f56;
}

.chip.gold {
  background: rgba(164, 106, 18, 0.14);
  color: #75500e;
}

.card-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted);
  font-size: 12px;
}

.detail-panel {
  position: sticky;
  top: 98px;
}

.detail-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  min-height: 440px;
}

.detail-empty {
  min-height: 380px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detail-head {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.detail-head h2 {
  font-size: 20px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.detail-head p {
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.detail-link {
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 8px;
  text-decoration: none;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.detail-section {
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.detail-description {
  color: #3d4541;
  line-height: 1.65;
  font-size: 14px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.feature {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 13px;
}

.feature strong {
  color: var(--ink);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seo-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.seo-section h2 {
  font-size: 20px;
  line-height: 1.35;
  margin: 0 0 10px;
}

.seo-section p {
  color: #3d4541;
  line-height: 1.7;
  max-width: 980px;
}

.topic-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.topic-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  text-decoration: none;
  background: var(--surface-2);
  font-weight: 700;
}

.static-channel-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 18px;
  padding-left: 20px;
  margin: 0;
}

.static-channel-links li {
  padding: 6px 0;
}

.static-channel-links a {
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.static-channel-links span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.static-page {
  max-width: 1100px;
  margin: 0 auto;
}

.breadcrumb {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 3px;
}

.breadcrumb a {
  color: inherit;
}

.profile-layout {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.profile-image {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.info-table {
  display: grid;
  grid-template-columns: minmax(130px, 0.28fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.info-table dt,
.info-table dd {
  margin: 0;
  padding: 11px 12px;
  background: var(--surface);
  min-width: 0;
  overflow-wrap: anywhere;
}

.info-table dt {
  color: var(--muted);
  font-weight: 800;
}

.feature-list {
  margin: 12px 0 0;
  padding-left: 20px;
  columns: 2;
}

.empty-results {
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 980px) {
  .search-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .text-button {
    flex: 1;
  }

  .search-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .channel-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .card-actions {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .avatar {
    width: 44px;
    height: 44px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .profile-layout,
  .info-table {
    grid-template-columns: 1fr;
  }

  .feature-list {
    columns: 1;
  }
}
