:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-strong: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f2f6fb;
  --surface-tint: #eaf2ff;
  --line: #d7e0ea;
  --line-strong: #b8c6d6;
  --text: #101827;
  --muted: #607086;
  --soft: #8795a8;
  --accent: #2359c7;
  --accent-strong: #163f93;
  --accent-soft: #eaf1ff;
  --green: #17835f;
  --green-soft: #e8f7ef;
  --amber: #9a6a12;
  --amber-soft: #fff3d6;
  --red: #b43737;
  --red-soft: #ffe8e6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 39, 0.06);
  --shadow-md: 0 14px 38px rgba(16, 24, 39, 0.1);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans JP", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #ffffff 0, #fbfcfe 82px, var(--bg) 360px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(35, 89, 199, 0.18);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(280px, 650px) minmax(168px, auto);
  gap: 20px;
  align-items: center;
  padding: 14px clamp(18px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #12213a;
  box-shadow: 0 8px 20px rgba(18, 33, 58, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

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

.brand strong {
  font-size: 18px;
  font-weight: 850;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box,
.language-trigger {
  display: grid;
  gap: 10px;
  align-items: center;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search-box {
  grid-template-columns: 20px 1fr;
  background: var(--surface-soft);
  border: 1px solid transparent;
  color: var(--muted);
}

.search-box:focus-within {
  background: var(--surface);
  border-color: rgba(35, 89, 199, 0.42);
  box-shadow: 0 0 0 4px rgba(35, 89, 199, 0.1);
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.search-box input::placeholder {
  color: #7f8ea1;
  font-weight: 650;
}

.language-dropdown {
  position: relative;
  justify-self: end;
  width: 100%;
  min-width: 164px;
  max-width: 210px;
}

.language-trigger {
  grid-template-columns: 20px minmax(82px, 1fr) 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-weight: 800;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.language-trigger:hover,
.language-dropdown.is-open .language-trigger {
  border-color: rgba(35, 89, 199, 0.48);
  box-shadow: 0 0 0 4px rgba(35, 89, 199, 0.1);
}

.language-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-box svg,
.language-trigger svg,
.site-action svg,
.view-button svg,
.category-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.language-globe {
  color: var(--muted);
}

.language-chevron {
  color: var(--soft);
  transition: transform 160ms ease;
}

.language-dropdown.is-open .language-chevron {
  transform: rotate(180deg);
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: none;
  width: min(232px, calc(100vw - 28px));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.language-dropdown.is-open .language-menu {
  display: grid;
  gap: 2px;
}

.language-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-align: left;
}

.language-option:hover,
.language-option:focus-visible,
.language-option.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: 0;
}

.language-check {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: transparent;
  font-size: 13px;
}

.language-option.is-active .language-check {
  color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 28px;
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 42px) 54px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
}

.side-section,
.site-card,
.filter-bar,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.side-section {
  padding: 14px;
}

.side-title {
  margin-bottom: 10px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-nav {
  display: grid;
  gap: 6px;
}

.category-button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.category-icon {
  color: var(--soft);
}

.category-icon svg {
  width: 18px;
  height: 18px;
}

.category-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--soft);
  font-size: 12px;
  font-weight: 850;
}

.category-button:hover,
.category-button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.category-button.is-active .category-icon {
  color: var(--accent);
}

.category-button.is-active .category-count {
  background: var(--surface);
  color: var(--accent-strong);
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.summary-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 10px 0 0;
}

.section-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 46px;
  font-weight: 900;
  line-height: 1.04;
}

h3 {
  margin-bottom: 7px;
  font-size: 19px;
  font-weight: 850;
  line-height: 1.22;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 10px;
}

.stat {
  min-width: 0;
  padding: 14px 15px;
}

.stat strong {
  display: block;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
}

.segmented,
.view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment-button,
.view-button,
.empty-action {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.segment-button {
  padding: 0 12px;
}

.segment-button:hover,
.segment-button.is-active,
.view-button:hover,
.view-button.is-active {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.filter-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle {
  flex-wrap: nowrap;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.view-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.view-button svg {
  width: 17px;
  height: 17px;
}

.view-button.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.result-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.site-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-width: 0;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.site-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.thumbnail {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #dfe7f0;
  border-bottom: 1px solid var(--line);
}

.thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 300ms ease;
}

.site-card:hover .thumbnail img {
  transform: scale(1.018);
}

.thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.site-body {
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
}

.site-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.site-copy {
  min-width: 0;
}

.site-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  line-height: 1.6;
}

.domain {
  display: inline-block;
  margin-bottom: 8px;
  overflow: hidden;
  max-width: 100%;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-actions {
  display: flex;
  gap: 7px;
}

.site-action {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.site-action:hover,
.site-action:focus-visible {
  background: #12213a;
  border-color: #12213a;
  color: #ffffff;
  outline: 0;
  transform: translateY(-1px);
}

.site-action.primary-action {
  color: var(--accent);
}

.site-action.primary-action:hover,
.site-action.primary-action:focus-visible {
  color: #ffffff;
}

.site-action svg {
  width: 18px;
  height: 18px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 850;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.status.draft {
  color: var(--red);
  background: var(--red-soft);
}

.site-grid.is-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.site-grid.is-list .site-card {
  grid-template-columns: 230px minmax(0, 1fr);
  grid-template-rows: 1fr;
}

.site-grid.is-list .thumbnail {
  aspect-ratio: auto;
  min-height: 156px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.site-grid.is-list .site-body {
  min-height: 156px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 38px 22px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
}

.empty-state span {
  max-width: 420px;
  font-size: 13px;
  line-height: 1.5;
}

.empty-action {
  margin-top: 6px;
  padding: 0 13px;
  background: var(--accent);
  color: #ffffff;
}

.empty-action:hover,
.empty-action:focus-visible {
  background: var(--accent-strong);
  color: #ffffff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(16, 24, 39, 0.16);
  border-radius: var(--radius);
  background: #12213a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 760;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: var(--shadow-md);
}

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

.toast.is-error {
  background: #7a2323;
}

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

@media (max-width: 1180px) {
  .site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    justify-self: start;
  }
}

@media (max-width: 920px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .language-dropdown {
    justify-self: stretch;
    max-width: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .sidebar {
    position: static;
  }

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

  .site-grid.is-list .site-card {
    grid-template-columns: 190px minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 14px;
  }

  .workspace {
    padding: 16px 14px 36px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 32px;
    line-height: 1.12;
  }

  .summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .stat {
    padding: 11px;
  }

  .stat strong {
    font-size: 22px;
  }

  .stat span {
    font-size: 11px;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-tools {
    justify-content: space-between;
  }

  .result-count {
    white-space: normal;
  }

  .category-nav,
  .site-grid {
    grid-template-columns: 1fr;
  }

  .site-grid.is-list .site-card,
  .site-card {
    grid-template-columns: 1fr;
  }

  .site-grid.is-list .thumbnail {
    aspect-ratio: 16 / 10;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .site-grid.is-list .site-body {
    min-height: 0;
  }

  .site-actions {
    flex-direction: column;
  }
}
