*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --top-bg: #f7f9fbf2;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #1b1f2a;
  --muted: #5f6472;
  --accent: #3478f6;
  --accent-soft: #e8f0ff;
  --input: #ffffff;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
  --highlight: #fff4cc;
  font-family: "Segoe UI", "SF Pro Text", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --top-bg: #0d1117f2;
  --card: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --muted: #9ca5b3;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.18);
  --input: #0f1621;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --highlight: #786c3d;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
}

/* Font utility classes from Google Fonts bundle */
.cal-sans-regular {
  font-family: "Cal Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
}

/* Replace <uniquifier> and <weight> as needed */
.inter-regular {
  font-family: "Inter", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.dosis-regular {
  font-family: "Dosis", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.kosugi-maru-regular {
  font-family: "Kosugi Maru", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.sono-regular {
  font-family: "Sono", monospace;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "MONO" 1;
}

.unbounded-regular {
  font-family: "Unbounded", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.cabin-sketch-regular {
  font-family: "Cabin Sketch", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.cabin-sketch-bold {
  font-family: "Cabin Sketch", sans-serif;
  font-weight: 700;
  font-style: normal;
}

.doto-regular {
  font-family: "Doto", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "ROND" 0;
}

.dm-sans-regular {
  font-family: "DM Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.dm-mono-light {
  font-family: "DM Mono", monospace;
  font-weight: 300;
  font-style: normal;
}

.dm-mono-regular {
  font-family: "DM Mono", monospace;
  font-weight: 400;
  font-style: normal;
}

.dm-mono-medium {
  font-family: "DM Mono", monospace;
  font-weight: 500;
  font-style: normal;
}

.dm-mono-light-italic {
  font-family: "DM Mono", monospace;
  font-weight: 300;
  font-style: italic;
}

.dm-mono-regular-italic {
  font-family: "DM Mono", monospace;
  font-weight: 400;
  font-style: italic;
}

.dm-mono-medium-italic {
  font-family: "DM Mono", monospace;
  font-weight: 500;
  font-style: italic;
}

.special-gothic-condensed-one-regular {
  font-family: "Special Gothic Condensed One", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.barlow-condensed-regular {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.google-sans-flex-regular {
  font-family: "Google Sans Flex", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 0;
}

.landing .page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 0 22px 60px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #4e9eff, #6ad7ff);
  color: #0c1b3a;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.status {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1d4ed8;
  font-weight: 600;
  white-space: nowrap;
}

.landing .status {
  display: none;
}

.page {
  width: 100%;
  /*max-width: 1180px;
  margin: 0 auto;
  padding: 34px 22px 60px; */
  display: grid;
  gap: 18px;
  align-items: flex-start;
}

.has-search .page {
  align-items: flex-start;
  padding-top: 90px;
}

.search-shell {
  display: grid;
  /* gap: 12px;
  max-width: 880px; */
  width: 100%;
  margin: 0 auto;
  position: relative;
  justify-content: center;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  width: 50vw;
}

.icon-button {
  border: none;
  width: 56px;
  height: 56px;
  background: none;
  color: var(--text);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  transform: translateY(-1px);
}

.apps-toggle {
  display: grid;
  place-items: center;
  font-size: 18px;
}

.account-toggle .avatar-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.dropdown {
  position: absolute;
  top: 64px;
  right: 22px;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(17, 24, 39, 0.14);
  border-radius: 14px;
  padding: 12px;
  z-index: 10;
}

.apps-dropdown {
  left: 22px;
  right: auto;
  width: 320px;
}

.dropdown-title {
  margin: 0 0 10px;
  font-weight: 700;
}

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

.app-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
}

[data-theme="dark"] .app-tile,
[data-theme="dark"] .dropdown,
[data-theme="dark"] .dropdown-item {
  background: var(--card);
}

.dropdown-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  margin-bottom: 8px;
}

.dropdown-item:last-child {
  margin-bottom: 0;
}

.has-search .search-shell {
  position: sticky;
  top: 0;
  z-index: 3;
  /* background: rgba(247, 249, 251, 0.95); */
  background: var(--top-bg);
  padding: 8px 12px 12px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  /* box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06); */
  backdrop-filter: blur(10px);
}

.hero {
  text-align: center;
  display: grid;
  gap: 6px;
}

h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -0.01em;
}

#logo>h1 {
    font-family: 'Google Sans Flex';
    font-weight: 400;
}

.has-search #logo>h1 {
  font-size: 32px;
}

.landing .hero {
  margin-top: -60px;
}

.lede {
  margin: 0;
  color: var(--muted);
}

.search {
  /* margin-top: 4px; */
  display: grid;
  gap: 10px;
  justify-content: center;
}

.search-bar {
  width: 50vw;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--input);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.has-search .search-bar {
  box-shadow: var(--shadow);
}

.search-bar input {
  border: none;
  font: inherit;
  padding: 10px 12px;
  outline: none;
  background: none;
}

.search-bar button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  box-shadow: 0 12px 24px rgba(52, 120, 246, 0.25);
}

.search-bar button:hover {
  transform: translateY(-1px);
}

.search-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.landing .search-options {
  justify-content: center;
}

.has-search .search-options {
  justify-content: flex-start;
}

.search-options label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.search-options input,
.search-options select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 340px;
  gap: 16px;
  align-items: start;
  margin: 0 auto;
  padding: 34px 22px 60px;
  max-width: 1180px;
}

.has-search .layout {
  margin-top: 8px;
}

.landing .layout {
  display: none;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  /* box-shadow: var(--shadow); */
}

.panel.results {
    padding: 0;
    border: none;
    background: none;
}

.results h2 {
  margin: 0 0 12px;
}

.results-feed {
  display: grid;
  gap: 12px;
}

.result {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--card);
  display: grid;
  gap: 6px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pk {
  color: var(--accent);
  font-weight: 700;
}

.time {
  color: var(--muted);
  font-size: 13px;
}

.result-content {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text);
  word-break: break-word;
}

.highlight {
  background: var(--highlight);
  border-radius: 3px;
  padding: 1px 3px;
}

.relay-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

aside.panel.relays {
    position: sticky;
    top: 256px;
}

.relays {
  display: grid;
  gap: 10px;
}

.relay-heading {
  display: grid;
  gap: 2px;
}

.relay-heading>h3 {
    margin: 0;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.relay-list {
  display: grid;
  gap: 0;
}

.relay-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    /* border-radius: 12px; */
    /* border: 1px solid var(--border); */
    border-top: 1px solid var(--border);
    /* background: #fff; */
}

.relay-meta {
  display: grid;
  gap: 3px;
}

.relay-url {
  margin: 0;
  font-weight: 600;
}

.relay-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(95, 100, 114, 0.25);
}

.pulse.good {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.18);
}

.pulse.warn {
  background: #f97316;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.16);
}

.pulse.bad {
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.16);
}

.relay-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle {
  accent-color: var(--accent);
}

.relay-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.relay-add input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.relay-add button {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

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

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .search-bar {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .search-bar button {
    width: 100%;
  }
}

/* Modal + settings */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal {
  width: min(520px, 90vw);
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(17, 24, 39, 0.22);
  padding: 16px 18px 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.setting-group {
  display: grid;
  gap: 8px;
}

.setting-label {
  margin: 0;
  font-weight: 700;
}

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

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  cursor: pointer;
}

[data-theme="dark"] .chip,
[data-theme="dark"] .modal {
  background: var(--card);
}

.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
