:root {
  color-scheme: light;
  --bg: #f2f2ed;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #ffffff;
  --ink: #22283f;
  --muted: #71737b;
  --line: rgba(70, 75, 113, 0.14);
  --line-strong: rgba(70, 75, 113, 0.24);
  --accent: #118ab2;
  --accent-dark: #0b6d91;
  --mint: #7cd5c7;
  --navy: #464b71;
  --paper: #f2f2ed;
  --shadow: 0 24px 70px rgba(70, 75, 113, 0.14);
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 16%, rgba(124, 213, 199, 0.22), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(17, 138, 178, 0.13), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, var(--paper) 52%, #e9efef 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: calc(100vh - 44px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background: rgba(248, 249, 246, 0.86);
}

.brand-block,
.topbar,
.section-heading,
.action-row,
.utility-row {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 14px;
  min-height: 56px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--navy), #118ab2);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38), 0 12px 24px rgba(70, 75, 113, 0.2);
}

.brand-mark span {
  width: 20px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 4px 9px 9px 4px;
}

.brand-mark::after {
  position: absolute;
  right: 11px;
  bottom: 11px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  content: "";
  transform: rotate(-45deg);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.05;
}

h2 {
  max-width: 620px;
  margin-bottom: 12px;
  font-size: clamp(46px, 5.8vw, 76px);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.1;
}

.source-stack,
.browser-panel,
.filter-panel,
.notice,
.mini-panel,
.result-panel,
.search-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(20px);
}

.source-stack {
  display: grid;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  border-radius: 22px;
}

.source-option {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.source-option:hover {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.source-option.is-active {
  border-color: rgba(17, 138, 178, 0.38);
  background: rgba(124, 213, 199, 0.18);
}

.source-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.source-meta {
  min-width: 0;
}

.source-title {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-kind {
  color: var(--muted);
  font-size: 12px;
}

.source-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(124, 213, 199, 0.2);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.filter-panel {
  padding: 16px;
  border-radius: 22px;
}

.browser-panel {
  padding: 16px;
  border-radius: 22px;
}

.browser-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.browser-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
}

.browser-rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.theme-blue {
  background: #118ab2;
}

.theme-mint {
  background: #7cd5c7;
  color: #22283f;
}

.theme-navy {
  background: #464b71;
}

.theme-ink {
  background: #22283f;
}

.browser-list strong,
.browser-list small {
  display: block;
}

.browser-list strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-list small {
  color: var(--muted);
  font-size: 12px;
}

.panel-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.format-chip {
  position: relative;
  min-width: 0;
}

.format-chip input {
  position: absolute;
  opacity: 0;
}

.format-chip span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.format-chip input:checked + span {
  border-color: rgba(17, 138, 178, 0.42);
  background: rgba(124, 213, 199, 0.2);
  color: var(--accent-dark);
}

.notice {
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
}

.notice strong,
.notice span {
  display: block;
}

.notice strong {
  margin-bottom: 8px;
  font-size: 13px;
}

.notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.privacy-button {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.privacy-button:hover {
  background: rgba(124, 213, 199, 0.16);
}

.search-stage {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 24px;
}

.topbar {
  justify-content: space-between;
  min-height: 38px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 6px rgba(124, 213, 199, 0.2);
}

.ghost-button,
.text-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.ghost-button {
  padding: 9px 12px;
  border-radius: 999px;
}

.ghost-button:hover,
.text-button:hover,
.icon-button:hover {
  background: rgba(124, 213, 199, 0.16);
}

.search-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 0.72fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  min-height: 330px;
  overflow: hidden;
  padding: clamp(30px, 4.6vw, 58px);
  border-radius: 30px;
}

.search-copy {
  z-index: 1;
  max-width: 650px;
}

.search-copy p:last-child {
  max-width: 580px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.search-form {
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 48px rgba(70, 75, 113, 0.09);
}

.search-box {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
}

.search-box input::placeholder {
  color: rgba(110, 110, 115, 0.54);
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(242, 242, 237, 0.84);
}

.mode-row label {
  position: relative;
}

.mode-row input {
  position: absolute;
  opacity: 0;
}

.mode-row span {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mode-row input:checked + span {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 20px rgba(70, 75, 113, 0.18);
}

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

.utility-row {
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
}

.primary-button {
  flex: 1 1 180px;
  border: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 30px rgba(17, 138, 178, 0.24);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  flex: 0 1 auto;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.utility-row .secondary-button {
  flex: 1;
  min-height: 44px;
  background: rgba(242, 242, 237, 0.82);
  color: var(--muted);
  font-size: 13px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  min-height: 0;
}

.result-panel,
.mini-panel {
  border-radius: 24px;
}

.result-panel {
  min-width: 0;
  padding: 22px;
}

.section-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.source-card {
  display: grid;
  gap: 14px;
  min-height: 172px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.source-card.is-active {
  border-color: rgba(17, 138, 178, 0.38);
  background: rgba(124, 213, 199, 0.16);
  box-shadow: inset 0 0 0 1px rgba(17, 138, 178, 0.08);
}

.source-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.source-card h4 {
  margin: 0 0 5px;
  font-size: 16px;
}

.source-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.source-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.source-card .open-link {
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.side-panels {
  display: grid;
  align-content: start;
  gap: 18px;
}

.mini-panel {
  min-width: 0;
  padding: 18px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.saved-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.saved-list button {
  min-width: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(70, 75, 113, 0.09);
  color: var(--muted);
}

.saved-query {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(70, 75, 113, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 18px 44px rgba(70, 75, 113, 0.24);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .workspace,
  .search-panel,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .source-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .search-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .workspace {
    min-height: calc(100vh - 20px);
    border-radius: 24px;
  }

  .sidebar,
  .search-stage {
    padding: 16px;
  }

  .source-stack,
  .format-grid,
  .mode-row {
    grid-template-columns: 1fr;
  }

  .search-panel {
    padding: 24px;
    border-radius: 24px;
  }

  h2 {
    font-size: 42px;
  }

  .search-copy p:last-child {
    font-size: 16px;
  }

  .action-row,
  .utility-row {
    display: grid;
  }

  .secondary-button {
    width: 100%;
  }
}
