:root {
  --bg: #f4f1ea;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #fffdf8;
  --text: #18201d;
  --muted: #66706b;
  --line: rgba(24, 32, 29, 0.11);
  --accent: #175d4d;
  --accent-strong: #0f483b;
  --accent-soft: #dceae4;
  --warm: #d68b50;
  --shadow: 0 20px 60px rgba(31, 46, 40, 0.1);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #111714;
  --surface: rgba(28, 37, 33, 0.82);
  --surface-strong: #1b2521;
  --text: #eef4f0;
  --muted: #a3afa9;
  --line: rgba(238, 244, 240, 0.11);
  --accent: #75c7ad;
  --accent-strong: #a2ddca;
  --accent-soft: #213e35;
  --warm: #eba66f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(214, 139, 80, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 12%, rgba(34, 119, 97, 0.14), transparent 34rem),
    var(--bg);
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-weight: 720;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(23, 93, 77, 0.2);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  backdrop-filter: blur(16px);
}

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

.hero {
  max-width: 820px;
  margin: 78px auto 50px;
  text-align: center;
}

.eyebrow, .kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 12px 0 0;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

.clock {
  margin: 12px 0 34px;
  color: var(--accent);
  font-size: 1.12rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.search {
  display: grid;
  grid-template-columns: 22px auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 9px 8px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.search select {
  max-width: 138px;
  padding: 9px 30px 9px 11px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: var(--accent-soft);
  cursor: pointer;
}

.search select:focus { border-color: var(--accent); }

.search svg {
  width: 21px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search input {
  min-width: 0;
  padding: 11px 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.search input::placeholder { color: var(--muted); }

.search button, .primary-button, .secondary-button, .text-button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 680;
}

.search button, .primary-button {
  padding: 11px 18px;
  color: white;
  background: var(--accent);
}

.search button:hover, .primary-button:hover { background: var(--accent-strong); }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.8fr);
  gap: 20px;
}

.card {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(31, 46, 40, 0.055);
  backdrop-filter: blur(18px);
}

.bookmarks-card { grid-row: span 2; }

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.card h2 {
  margin: 5px 0 0;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.text-button {
  padding: 8px 10px;
  color: var(--accent);
  background: transparent;
}

.text-button:hover { background: var(--accent-soft); }

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bookmark {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
  padding: 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease;
}

.bookmark:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.bookmark-icon {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  place-items: center;
  color: var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.bookmark-copy { min-width: 0; }
.bookmark-name { display: block; overflow: hidden; font-weight: 690; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-host { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }

.bookmark-remove {
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}

.bookmark:hover .bookmark-remove, .bookmark-remove:focus-visible { opacity: 1; }
.bookmark-remove:hover { color: #b34141; background: rgba(179, 65, 65, 0.1); }

.bookmark-form {
  margin: -5px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
}

.bookmark-form label { display: block; margin-bottom: 12px; }
.bookmark-form label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 650; }

.bookmark-form input {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--bg);
}

.bookmark-form input:focus { border-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.secondary-button { padding: 10px 16px; color: var(--text); background: var(--accent-soft); }
.secondary-button:hover { filter: brightness(0.96); }

.timer {
  margin: 20px 0 27px;
  font-size: clamp(3rem, 7vw, 4.8rem);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 1;
}

.timer-duration {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.timer-duration input {
  width: 66px;
  padding: 8px 9px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-strong);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.timer-duration input:focus { border-color: var(--accent); }
.timer-duration input:disabled { cursor: not-allowed; opacity: 0.58; }

.timer-actions { display: flex; gap: 9px; }
.status-dot, .save-state { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

.notes-card textarea {
  width: 100%;
  min-height: 160px;
  padding: 0;
  resize: vertical;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
  line-height: 1.75;
}

.notes-card textarea::placeholder { color: var(--muted); }
.empty-state { margin: 26px 0 4px; color: var(--muted); text-align: center; }

footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 680px); padding-top: 18px; }
  .hero { margin: 54px auto 34px; }
  .dashboard { grid-template-columns: 1fr; }
  .bookmarks-card { grid-row: auto; }
}

@media (max-width: 480px) {
  .brand span:last-child { display: none; }
  .search { grid-template-columns: 20px auto minmax(0, 1fr); padding-right: 14px; }
  .search select { max-width: 92px; padding-right: 22px; }
  .search button { display: none; }
  .bookmark-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 20px; }
  footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero, .card { animation: rise 520ms both; }
  .card:nth-child(2) { animation-delay: 80ms; }
  .card:nth-child(3) { animation-delay: 140ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
