:root {
  color-scheme: light;
  --bg: #f4efe7;
  --bg-2: #e9edf4;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffaf2;
  --ink: #16202a;
  --muted: #66707c;
  --border: rgba(34, 44, 58, 0.12);
  --border-strong: rgba(34, 44, 58, 0.2);
  --accent: #2447ff;
  --accent-strong: #1d38c7;
  --accent-soft: rgba(36, 71, 255, 0.11);
  --success: #0f8a6b;
  --success-soft: rgba(15, 138, 107, 0.12);
  --warning: #9c6108;
  --warning-soft: rgba(156, 97, 8, 0.12);
  --shadow: 0 22px 55px rgba(19, 28, 40, 0.11);
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --body-font: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --display-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono-font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(36, 71, 255, 0.14), transparent 24rem),
    radial-gradient(circle at 90% 15%, rgba(15, 138, 107, 0.11), transparent 22rem),
    linear-gradient(180deg, var(--bg), #f7f4ee 35%, #f3efe9);
  font: 15px/1.55 var(--body-font);
}

body::before {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(22, 32, 42, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 32, 42, 0.015) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  content: "";
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 80%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-strong);
}

code {
  padding: 0.1rem 0.3rem;
  border: 1px solid rgba(22, 32, 42, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  font-family: var(--mono-font);
  font-size: 0.92em;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-card,
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy {
  padding: clamp(24px, 4vw, 40px);
}

.hero-card {
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 243, 236, 0.95));
}

.hero-copy::after,
.hero-card::after {
  position: absolute;
  inset: auto -8% -36% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 71, 255, 0.13), transparent 70%);
  content: "";
  pointer-events: none;
}

.hero-card::after {
  inset: -36% auto auto -12%;
  background: radial-gradient(circle, rgba(15, 138, 107, 0.12), transparent 72%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font: 700 12px/1.2 var(--mono-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display-font);
  letter-spacing: -0.04em;
}

h1 {
  max-width: 14ch;
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 0.94;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  line-height: 1.05;
}

h3 {
  font-size: clamp(1.15rem, 2.3vw, 1.65rem);
  line-height: 1.1;
}

h4 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.2;
}

.lede {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.55vw, 1.15rem);
}

.hero-card-label {
  margin: 0 0 14px;
  color: var(--muted);
  font: 700 12px/1.2 var(--mono-font);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.feature-list li {
  position: relative;
  padding-left: 20px;
  color: var(--ink);
}

.feature-list li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.card {
  padding: 22px;
}

.auth-panel {
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-head.compact {
  margin-bottom: 16px;
}

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

.auth-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.tab {
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover {
  background: rgba(36, 71, 255, 0.08);
  color: var(--ink);
}

.tab.is-active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 10px 20px rgba(36, 71, 255, 0.24);
}

.auth-form {
  display: grid;
  gap: 14px;
  max-width: 430px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink);
}

.field span {
  font-weight: 650;
}

.field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.field input:focus {
  outline: none;
  border-color: rgba(36, 71, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 71, 255, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.86rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 650;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(36, 71, 255, 0.28);
}

.button:disabled {
  opacity: 0.56;
  cursor: progress;
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 12px 24px rgba(36, 71, 255, 0.22);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.6);
}

.status {
  min-height: 1.5rem;
  margin: 14px 0 0;
  color: var(--muted);
}

.status.is-error {
  color: #a13d3d;
}

.page-status {
  margin-top: 0;
  margin-bottom: 18px;
  padding: 0 2px;
}

.main {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: visible;
  z-index: 10;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(36, 71, 255, 0.32);
  background: white;
}

.icon-button:disabled {
  opacity: 0.56;
  cursor: progress;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button svg path {
  fill: none;
}

.account-menu-wrap {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: 0 14px 32px rgba(19, 28, 40, 0.16);
}

.account-menu-item {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 650;
}

.account-menu-item:hover:not(:disabled) {
  background: var(--accent-soft);
}

.settings-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.settings-card {
  width: min(620px, 100%);
  overflow: visible;
  padding: clamp(24px, 5vw, 42px);
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
}

.settings-title {
  max-width: none;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1;
}

.settings-lede {
  margin-bottom: 24px;
}

.settings-form {
  max-width: none;
}

.settings-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font: 650 12px/1 var(--mono-font);
}

.empty-state {
  margin: 0;
  padding: 1rem 1rem 1rem 1.1rem;
  border: 1px dashed rgba(102, 112, 124, 0.26);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
}

.device-workspace,
.device-panel,
.device-section {
  min-width: 0;
}

.device-tabs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin: 0 -4px 18px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.device-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 76px));
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-weight: 650;
}

.device-tab > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-tab:hover:not(:disabled) {
  border-color: rgba(36, 71, 255, 0.32);
  color: var(--ink);
}

.device-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 18px rgba(36, 71, 255, 0.2);
}

.device-tab-count {
  display: inline-grid;
  min-width: 1.55rem;
  min-height: 1.55rem;
  place-items: center;
  padding: 0 0.38rem;
  border-radius: 999px;
  background: rgba(36, 71, 255, 0.1);
  font: 700 11px/1 var(--mono-font);
}

.device-tab.is-active .device-tab-count {
  background: rgba(255, 255, 255, 0.2);
}

.device-panel {
  display: grid;
  gap: 18px;
}

.device-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.6rem;
  border-radius: 999px;
  background: rgba(36, 71, 255, 0.08);
  color: var(--ink);
  font: 650 12px/1 var(--mono-font);
}

.chip.success {
  background: var(--success-soft);
  color: var(--success);
}

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

.open-tabs {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.open-tab {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  border: 1px solid rgba(22, 32, 42, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.open-tab a,
.history-table a {
  color: var(--ink);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.open-tab a:hover,
.history-table a:hover {
  color: var(--accent-strong);
}

.tab-url {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.history-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.history-time-column {
  width: 190px;
}

.history-url-column {
  width: 40%;
}

.history-table th,
.history-table td {
  min-width: 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
}

.history-table th {
  border-bottom: 1px solid var(--border-strong);
  background: rgba(36, 71, 255, 0.04);
  color: var(--muted);
  font: 700 11px/1.2 var(--mono-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.history-table td {
  border-bottom: 1px solid var(--border);
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-table time,
.history-title-cell {
  color: var(--muted);
}

.history-url-cell a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.load-more-row:empty {
  display: none;
}

.hero,
.toolbar,
.device-workspace {
  animation: rise-in 500ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.is-hidden {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(36, 71, 255, 0.32);
  outline-offset: 2px;
}

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

@media (max-width: 720px) {
  .page {
    width: min(100% - 18px, 1180px);
    padding-top: 16px;
  }

  .hero-copy,
  .hero-card,
  .card {
    border-radius: 20px;
  }

  .device-section {
    padding: 14px;
  }

  .history-time-column {
    width: 120px;
  }

  .history-url-column {
    width: 36%;
  }

  .history-table th,
  .history-table td {
    padding: 10px 8px;
    font-size: 0.83rem;
  }
}
