:root {
  color-scheme: light;
  --ink: #17182a;
  --muted: #6d728b;
  --canvas: #f3f5fb;
  --card: #ffffff;
  --line: #e6e8f2;
  --accent: #5b5ce6;
  --accent-ink: #ffffff;
  --warn: #e07a1f;
  --alert: #e5484d;
  --alert-soft: #fff1f3;
  --ok: #0f8f6a;
  --shadow: 0 16px 40px rgba(36, 40, 80, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  line-height: 1.55;
}

/* Viewport-fixed soft mesh (concept A) — pure white top for iPhone island. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    /* Keep the top band pure white so the brand mark doesn't bleed into the mesh. */
    linear-gradient(180deg, #ffffff 0%, #ffffff 28%, rgba(255, 255, 255, 0) 46%),
    /* Soft mesh glows — kept below the white cap so they don't tint the top. */
    radial-gradient(ellipse 80% 55% at 12% 42%, rgba(140, 150, 255, 0.28), transparent 58%),
    radial-gradient(ellipse 70% 50% at 100% 48%, rgba(91, 92, 230, 0.18), transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(70, 72, 190, 0.45), transparent 58%),
    radial-gradient(ellipse 55% 40% at 78% 72%, rgba(180, 190, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #ffffff 28%, #f7f8ff 48%, #e4e7ff 72%, #8f93eb 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  /* Keep grain off the pure-white top (island + brand area). */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 26%, #000 48%);
  mask-image: linear-gradient(180deg, transparent 0%, transparent 26%, #000 48%);
}

.wrap {
  width: min(44rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 4rem;
}

.mast {
  margin: -2.2rem 0 1.35rem;
  padding: 2.2rem 0 1.05rem;
  background: #ffffff;
}

.mark {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.8rem;
  object-fit: cover;
  box-shadow: none;
}

.panel {
  display: grid;
  gap: 0.9rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.deploy-info {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}
.deploy-info[hidden] { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
}

.account-bar[hidden] { display: none; }

.account-meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.account-email {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-limit {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.account-logout {
  flex: 0 0 auto;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.login-gate {
  min-height: 100dvh;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 0 0 3.5rem;
}

.login-gate[hidden] { display: none; }

.login-stage {
  width: min(26rem, 100%);
  display: grid;
  gap: 0;
}

.login-mast {
  padding: 2.75rem 1.25rem 1.55rem;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 72%, rgba(255, 255, 255, 0));
  animation: login-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-brand {
  gap: 0.9rem;
}

.login-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 0.95rem;
}

.login-brand h1 {
  font-size: clamp(1.85rem, 5.5vw, 2.15rem);
  letter-spacing: -0.055em;
}

.login-lead {
  margin: 1.15rem 0 0;
  max-width: 16.5em;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.45;
}

.login-lead-sub {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.login-form {
  display: grid;
  gap: 0.85rem;
  margin: 0.35rem 1.15rem 0;
  padding: 1.2rem 1.15rem 1.15rem;
  border: 1px solid rgba(230, 232, 242, 0.95);
  border-radius: 1.45rem;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(36, 40, 80, 0.08);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: login-rise 0.7s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-form .field {
  gap: 0.4rem;
}

.login-form label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #3d425c;
}

.login-form input[type="email"] {
  padding: 0.88rem 0.95rem;
  border-radius: 0.95rem;
  font-size: 1.02rem;
  background: rgba(255, 255, 255, 0.96);
}

#login-submit {
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.88rem 1.1rem;
  font-size: 0.98rem;
  letter-spacing: -0.015em;
  box-shadow: 0 10px 24px rgba(91, 92, 230, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

#login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(91, 92, 230, 0.34);
}

#login-submit:active:not(:disabled) {
  transform: translateY(0);
}

#login-submit:disabled {
  filter: saturate(0.75);
  opacity: 0.72;
}

.login-status {
  margin: 0.1rem 0 0;
  min-height: 1.35em;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
}

.login-status.is-ok {
  color: #1f6b3a;
  font-weight: 600;
}

.login-status.is-error {
  color: #9e2a2b;
  font-weight: 600;
}

@keyframes login-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-mast,
  .login-form {
    animation: none;
  }
  #login-submit,
  #login-submit:hover:not(:disabled) {
    transition: none;
    transform: none;
  }
}

h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.note, .foot {
  color: var(--muted);
  font-size: 0.9rem;
}

.notify-panel .section {
  margin: 0;
  font-size: 1rem;
}

.notify-panel .note code,
.settings-modal .note code {
  font-size: 0.78em;
}

.settings-status {
  font-weight: 600;
  color: #2f3550;
}

.settings-shortcuts {
  display: grid;
  gap: 0.55rem;
  margin: 0.95rem 0 0;
}

.settings-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.62rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 16px rgba(36, 40, 80, 0.05);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.settings-chip:hover {
  border-color: #c9cbf5;
  box-shadow: 0 0 0 3px rgba(91, 92, 230, 0.1);
}

.settings-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

button.settings-chip .settings-chip-icon,
.settings-chip-icon {
  flex: 0 0 1.5rem;
  width: 1.5rem !important;
  height: 1.5rem !important;
  max-width: 1.5rem;
  max-height: 1.5rem;
  display: block;
  color: #8b91a8 !important;
  opacity: 0.95;
  overflow: visible;
}

.settings-chip-title {
  flex: 0 0 auto;
  font-size: 0.9rem;
}

.settings-chip-value {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-modal {
  width: min(28rem, calc(100vw - 1.5rem));
  max-height: min(90vh, 40rem);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 1.2rem;
  background: transparent;
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: contain;
}

.settings-modal::backdrop {
  background: rgba(23, 24, 42, 0.42);
  overscroll-behavior: none;
  touch-action: none;
}

.settings-modal-shell {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.05rem 1.1rem;
  /* Solid fill — translucent white let card favicons bleed through the body. */
  background: #ffffff;
  max-height: min(90vh, 40rem);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
}

.settings-modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
}

.settings-modal-head .section {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.site-detail-heading-row {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-detail-heading-row .section {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.site-detail-heading-row.is-editing .section {
  display: none;
}

.site-detail-title-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #f7f8fc;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  box-shadow: none;
}

.site-detail-title-input:focus,
.site-detail-title-input:focus-visible {
  outline: none;
  border-color: rgba(91, 92, 230, 0.45);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(91, 92, 230, 0.12);
}

button.site-detail-rename {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  min-width: 2.15rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #8b90a7;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

button.site-detail-rename:hover,
button.site-detail-rename:focus-visible {
  color: var(--accent);
  background: #f3f4ff;
  border-color: #e4e7f8;
  outline: none;
  box-shadow: none;
}

button.site-detail-rename:disabled {
  opacity: 0.45;
  cursor: default;
}

button.site-detail-rename svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.site-detail-heading-row.is-editing button.site-detail-rename {
  color: var(--accent);
  background: #eef0ff;
  border-color: #dfe3fb;
}

.settings-modal-body {
  display: grid;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.settings-discard {
  width: min(24rem, calc(100vw - 1.5rem));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 1.1rem;
  background: transparent;
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.settings-discard::backdrop {
  background: rgba(23, 24, 42, 0.5);
  overscroll-behavior: none;
  touch-action: none;
}

.settings-discard-shell {
  gap: 0.75rem;
}

.settings-discard-actions {
  display: grid;
  gap: 0.5rem;
}

#auto-check-hour {
  max-width: 8rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  color: #3c415c;
  font-size: 0.82rem;
  font-weight: 600;
}

.url-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.url-row input {
  flex: 1;
  min-width: 0;
}

.url-row .ghost {
  flex: 0 0 auto;
  white-space: normal;
  max-width: 9.5rem;
  line-height: 1.25;
  font-size: 0.82rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fbfbfe;
  color: var(--ink);
  font: inherit;
  padding: 0.7rem 0.8rem;
}

textarea { min-height: 5rem; resize: vertical; }

.choice-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.choice-option input {
  width: auto;
  margin: 0.2rem 0 0;
}

.selector-recommended {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #eef0ff;
  color: #3c415c;
  font-size: 0.72rem;
  font-weight: 700;
}

.selector-rss {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e7f6ef;
  color: #0f7a52;
  font-size: 0.72rem;
  font-weight: 700;
}

.selector-choice.is-rss {
  border-color: #b9e2cf;
}

.selector-step {
  display: grid;
  gap: 0.55rem;
}
.selector-step[hidden] { display: none; }

.duplicate-step {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: #f7f7fb;
}
.duplicate-step[hidden] { display: none; }

.duplicate-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.duplicate-choice {
  margin: 0;
}

.selector-heading {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  scroll-margin-top: 1rem;
}

.selector-choices {
  display: grid;
  gap: 0.55rem;
}

.selector-choice {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: #fbfbfe;
  cursor: pointer;
}

.selector-choice.is-selected {
  border-color: #b7b8f5;
  box-shadow: 0 0 0 4px rgba(91, 92, 230, 0.12);
}

.selector-choice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.7rem;
  font-size: 0.86rem;
}

.selector-register-btn {
  justify-self: start;
  margin-top: 0.25rem;
  border-radius: 0.7rem;
  padding: 0.48rem 0.9rem;
  font-size: 0.82rem;
  box-shadow: 0 4px 10px rgba(91, 92, 230, 0.18);
}

.selector-sample-more,
.selector-parent-btn {
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.selector-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.selector-code {
  margin: 0;
  color: #3c415c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.selector-sample {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}
.selector-sample[hidden] { display: none; }
.selector-sample li { margin: 0.1rem 0; overflow-wrap: anywhere; }

.selector-page-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.selector-page-label[hidden] { display: none; }

.selector-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
}
.selector-pager[hidden] { display: none; }

#selector-more,
#selector-prev {
  width: fit-content;
}
#selector-more[hidden],
#selector-prev[hidden] { display: none; }

.selector-sample-wrap {
  display: grid;
  gap: 0.35rem;
}

.selector-sample-more {
  width: fit-content;
  justify-self: start;
  background: #eef0ff;
  color: var(--ink);
  border: 1px solid #d0d3f5;
  box-shadow: none;
  border-radius: 0.55rem;
  padding: 0.28rem 0.7rem;
  margin: 0.1rem 0 0;
  min-height: 2rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.selector-related {
  display: grid;
  gap: 0.35rem;
  margin: 0.15rem 0 0;
}

.selector-related-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.selector-parent-btn {
  width: fit-content;
  justify-self: start;
  background: #eef0ff;
  color: var(--ink);
  border: 1px solid #d0d3f5;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #b7b8f5;
  box-shadow: 0 0 0 4px rgba(91, 92, 230, 0.14);
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  padding: 0.62rem 1rem;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(91, 92, 230, 0.22);
}

button.ghost {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.ack {
  background: var(--alert);
  box-shadow: 0 8px 16px rgba(229, 72, 77, 0.22);
}

button:disabled { opacity: 0.5; cursor: wait; }

button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* After global button rules so padding/font/focus cannot stretch or recolor it. */
button.settings-modal-close {
  flex: 0 0 auto;
  align-self: start;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  min-width: 2.9rem;
  min-height: 2.9rem;
  max-width: 2.9rem;
  max-height: 2.9rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f7fb;
  color: var(--ink);
  font-size: 0;
  line-height: 0;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.settings-modal-close svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

button.settings-modal-close:focus,
button.settings-modal-close:focus-visible {
  outline: none;
  box-shadow: none;
}

a { color: inherit; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.register-actions {
  align-items: stretch;
  flex-wrap: nowrap;
}

.register-actions #paste-url {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
  font-size: 0.82rem;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.register-actions #register-submit,
.register-actions #register-cancel {
  flex: 0 0 auto;
  white-space: nowrap;
}

.note { margin: 0; }

#toast {
  color: var(--alert);
  min-height: 0;
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}
#toast:empty { display: none; }

.watch { margin-top: 1.35rem; }

.section-row-lead {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1 1 auto;
  min-width: 0;
}

.section-row-lead .section {
  flex: 1 1 auto;
  min-width: 0;
}

button.list-tools-toggle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  min-width: 2.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #6d728b;
  box-shadow: 0 4px 12px rgba(36, 40, 80, 0.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

button.list-tools-toggle svg {
  display: block;
}

button.list-tools-toggle:hover,
button.list-tools-toggle:focus-visible,
button.list-tools-toggle[aria-expanded="true"],
button.list-select-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: #d7daf5;
  background: #f5f6ff;
  outline: none;
  box-shadow: 0 4px 12px rgba(91, 92, 230, 0.1);
}

button.list-tools-toggle[hidden],
button.list-select-toggle[hidden] { display: none; }

.list-tools {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.list-sort-wrap {
  position: relative;
  flex: 0 0 auto;
}

.list-tools-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 8;
  display: grid;
  gap: 0.55rem;
  width: min(18.5rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.85rem 0.9rem 0.95rem;
  border: 1px solid rgba(230, 232, 242, 0.95);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(36, 40, 80, 0.12);
}

.list-tools-menu[hidden] { display: none; }

.list-tools-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.list-sort-options {
  display: grid;
  gap: 0.3rem;
}

button.list-sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0.62rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

button.list-sort-option::after {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 1.5px solid #d5d8e6;
  background: transparent;
  flex: 0 0 auto;
}

button.list-sort-option[aria-checked="true"] {
  background: #f3f4ff;
  border-color: #e0e3fb;
  color: var(--accent);
}

button.list-sort-option[aria-checked="true"]::after {
  border-color: var(--accent);
  background:
    radial-gradient(circle at center, var(--accent) 0 45%, transparent 46%);
}

button.list-sort-option:hover,
button.list-sort-option:focus-visible {
  background: #f7f8fc;
  outline: none;
  box-shadow: none;
}

.list-select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.7rem;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e0e3fb;
  border-radius: 0.95rem;
  background: linear-gradient(180deg, #fbfbff 0%, #f5f6ff 100%);
}

.list-select-bar[hidden] { display: none; }

.list-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: auto;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.list-select-all input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

#select-cancel.ghost {
  width: auto;
  padding: 0.42rem 0.75rem;
  font-size: 0.84rem;
}

#bulk-delete.ghost.danger {
  width: auto;
  margin-left: auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid #f0c4c8;
  background: transparent;
  color: var(--alert);
  box-shadow: none;
  font-size: 0.84rem;
}

#bulk-delete.ghost.danger:hover:not(:disabled),
#bulk-delete.ghost.danger:focus-visible:not(:disabled) {
  background: var(--alert-soft);
  border-color: #e8a0a6;
}

#bulk-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 0.85rem;
}

.section-row > #check-all {
  width: auto;
  flex: none;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  box-shadow: 0 8px 18px rgba(91, 92, 230, 0.18);
}

h2.section {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.check-progress { margin: 0 0 0.95rem; }
.check-progress[hidden] { display: none; }

.check-progress-label {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.check-progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.check-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s ease;
}

.foot { margin: 0; }

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: 0 0 0.55rem;
  padding: 0.35rem 0.4rem 0.35rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 16px rgba(36, 40, 80, 0.05);
  color: var(--ink);
  min-width: 0;
}

.card:hover {
  border-color: #c9cbf5;
  box-shadow: 0 0 0 3px rgba(91, 92, 230, 0.1);
}

.card.is-updated {
  border-color: #f0b6bb;
  background: linear-gradient(180deg, #fff 0%, #fff7f8 100%);
}

.card.is-selected {
  border-color: #b8baf0;
  background: linear-gradient(180deg, #fff 0%, #f7f8ff 100%);
}

.card-skeleton {
  pointer-events: none;
  gap: 0.7rem;
  padding: 0.7rem 0.75rem;
  box-shadow: 0 4px 12px rgba(36, 40, 80, 0.04);
}

.card-skeleton:hover {
  border-color: var(--line);
  box-shadow: 0 4px 12px rgba(36, 40, 80, 0.04);
}

.skeleton-favicon {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
}

.skeleton-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.45rem;
}

.skeleton-title {
  height: 0.95rem;
  width: min(68%, 16rem);
  border-radius: 999px;
}

.skeleton-flag {
  height: 0.7rem;
  width: min(42%, 9rem);
  border-radius: 999px;
}

.skeleton-chip {
  display: block;
  height: 0.85rem;
  width: 4.2rem;
  border-radius: 999px;
  margin-left: auto;
}

.settings-chip-value.is-skeleton {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 4.2rem;
  color: transparent;
}

.skeleton-wave {
  position: relative;
  overflow: hidden;
  background-color: #d9deec;
  /* iOS Safari: prefer animating the element itself, not ::after. */
  -webkit-animation: skeleton-pulse 1.1s ease-in-out infinite;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}

.skeleton-sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  -webkit-transform: translateX(-130%);
  transform: translateX(-130%);
  -webkit-animation: skeleton-sheen 1.15s linear infinite;
  animation: skeleton-sheen 1.15s linear infinite;
  will-change: transform;
}

@-webkit-keyframes skeleton-pulse {
  0%, 100% { background-color: #d9deec; }
  50% { background-color: #f1f3f9; }
}

@keyframes skeleton-pulse {
  0%, 100% { background-color: #d9deec; }
  50% { background-color: #f1f3f9; }
}

@-webkit-keyframes skeleton-sheen {
  from {
    -webkit-transform: translateX(-130%);
    transform: translateX(-130%);
  }
  to {
    -webkit-transform: translateX(280%);
    transform: translateX(280%);
  }
}

@keyframes skeleton-sheen {
  from {
    -webkit-transform: translateX(-130%);
    transform: translateX(-130%);
  }
  to {
    -webkit-transform: translateX(280%);
    transform: translateX(280%);
  }
}

/* Keep a gentle pulse even with Reduce Motion — this is loading status, not decoration. */
@media (prefers-reduced-motion: reduce) {
  .skeleton-sheen {
    -webkit-animation: none;
    animation: none;
    display: none;
  }
  .skeleton-wave {
    -webkit-animation: skeleton-pulse 1.6s ease-in-out infinite;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
  }
}

.card-select {
  flex: 0 0 auto;
  display: none;
  place-items: center;
  width: 2.2rem;
  height: 2.55rem;
  margin: 0;
  cursor: pointer;
}

.watch.is-selecting .card-select {
  display: grid;
}

.card-select-input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.watch.is-selecting .card-delete {
  display: none;
}

.card-open {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.35rem 0.4rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.card-open:hover,
.card-open:focus-visible {
  background: rgba(91, 92, 230, 0.05);
  outline: none;
  box-shadow: none;
}

.card-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.card-flag {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.card-flag.is-updated {
  color: var(--alert);
}

.card-delete {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: #8b91a8;
  box-shadow: none;
  cursor: pointer;
}

.card-delete svg {
  width: 1.4rem;
  height: 1.4rem;
  display: block;
}

.card-delete:hover,
.card-delete:focus-visible {
  color: var(--alert);
  background: var(--alert-soft);
  outline: none;
  box-shadow: none;
}

.card .site-favicon {
  margin-top: 0;
}

.site-favicon {
  position: relative;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  background: transparent;
  isolation: isolate;
}

.site-favicon-img,
.site-favicon-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.site-favicon-img {
  z-index: 1;
  object-fit: contain;
  background: transparent;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.site-favicon.has-img .site-favicon-fallback,
.site-favicon:has(> .site-favicon-img) .site-favicon-fallback {
  display: none;
}

.site-favicon-fallback {
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.site-detail-modal {
  /* Full-viewport hit target for outside-tap close. Keep UA dialog display
     (do NOT set display:grid/flex on [open] — Safari then lets touches fall
     through to the page behind the top layer). */
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  overscroll-behavior: none;
}

.site-detail-modal::backdrop {
  background: rgba(23, 24, 42, 0.42);
}

.site-detail-modal .settings-modal-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: min(92vh, 48rem);
  overflow: hidden;
  overscroll-behavior: contain;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 1.2rem;
  box-shadow: var(--shadow);
}

.site-detail-modal .settings-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.site-detail-latest-slot {
  /* Grid item wrapper: keep overflow visible so the row can't shrink to 0
     (direct overflow:auto children are treated as min-size 0 and get crushed). */
  min-width: 0;
}

.site-detail-latest {
  margin: 0;
  max-height: 14rem;
  overflow: auto;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fbfbfe;
  color: #2f3550;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-detail-latest-hint {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.site-detail-latest .site-detail-added {
  color: var(--ok);
  font-weight: 600;
}

/* Beat `.status { margin: 0 }` so the label stays below the latest box. */
.status.site-detail-removed-label {
  margin: 0.15rem 0 0;
}

.mode-pill {
  position: static;
  justify-self: start;
  top: auto;
  right: auto;
  z-index: auto;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef1f8;
  color: #4a5168;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.mode-pill.mode-static {
  background: #e8f7f1;
  color: #0f8f6a;
}
.mode-pill.mode-json {
  background: #fff4e8;
  color: #b15b12;
}
.mode-pill.mode-rss {
  background: #e7f6ef;
  color: #0f7a52;
}
.mode-pill.mode-browser {
  background: #eef0ff;
  color: #3c415c;
}
.mode-pill.mode-unknown {
  background: #f3f4f8;
  color: #6d728b;
}

.card.alert {
  background: linear-gradient(180deg, #fff 0%, #fff7f8 100%);
  box-shadow: 0 16px 40px rgba(229, 72, 77, 0.1);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
  padding-right: 4.2rem;
}

.card-head-text {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.card-head .badge {
  flex: 0 0 auto;
  margin-left: auto;
}

.card h3 {
  margin: 0;
  width: fit-content;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.35;
  cursor: text;
  border-radius: 0.4rem;
}

.card h3:hover { background: #f4f6fb; }

input.title-edit {
  width: min(100%, 24rem);
  margin: 0;
  padding: 0.1rem 0.35rem;
  border-radius: 0.45rem;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.35;
  box-shadow: none;
}

.url {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  word-break: break-all;
}

.badge {
  flex: none;
  border-radius: 999px;
  background: var(--alert-soft);
  color: var(--alert);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.28rem 0.65rem;
}

.status, .meta { margin: 0; font-size: 0.86rem; }
.status.bad { color: var(--alert); }
.status.warn { color: var(--warn); }
.status.quiet { color: var(--ok); }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  color: var(--muted);
  min-width: 0;
  max-width: 100%;
}

.meta span {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  border-radius: 0.55rem;
  background: #f4f6fb;
  padding: 0.18rem 0.55rem;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.meta span.meta-selector {
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diffbox {
  display: grid;
  gap: 0.35rem;
}

.alertbox {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem;
  border-radius: 0.95rem;
  background: var(--alert-soft);
}

.alertbox h4 {
  margin: 0;
  font-size: 0.92rem;
}

.prob { margin: 0; color: var(--alert); font-weight: 700; }

.diff {
  margin: 0.1rem 0 0.35rem;
  padding-left: 1.1rem;
}
.diff li { margin: 0.15rem 0; overflow-wrap: anywhere; }
.more { color: var(--muted); }

details { margin: 0; }
summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
}
details form { display: grid; gap: 0.55rem; margin-top: 0.65rem; }

.empty { color: var(--muted); }

@media (max-width: 640px) {
  .section-row { align-items: stretch; flex-direction: column; }
  .section-row > #check-all { width: 100%; }
  .list-select-bar {
    gap: 0.5rem;
  }
  #bulk-delete.ghost.danger { flex: 1 1 auto; margin-left: 0; }
  #select-cancel.ghost { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  button { box-shadow: none; }
  .check-progress-fill { transition: none; }
}

/* Kill global purple button chrome on list/settings controls (Safari-safe). */
#list .card > label.card-select {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  place-items: center;
  width: 2.2rem;
  height: 2.55rem;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

#list .card > button.card-open {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0.35rem 0.4rem;
  border: 0 !important;
  border-radius: 0.65rem !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--ink) !important;
  font: inherit;
  font-weight: 600;
  text-align: left;
  box-shadow: none !important;
  cursor: pointer;
}

#list .card > button.card-delete {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.55rem !important;
  height: 2.55rem !important;
  min-width: 2.55rem;
  min-height: 2.55rem;
  max-width: 2.55rem;
  max-height: 2.55rem;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0.65rem !important;
  background: transparent !important;
  background-color: transparent !important;
  color: #8b91a8 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.watch.is-selecting #list .card > button.card-delete {
  display: none !important;
}

#list .card > button.card-delete svg {
  width: 1.4rem !important;
  height: 1.4rem !important;
  display: block;
  pointer-events: none;
}

button.settings-chip {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.92) !important;
  background-color: rgba(255, 255, 255, 0.92) !important;
  color: var(--ink) !important;
  box-shadow: 0 6px 16px rgba(36, 40, 80, 0.05) !important;
  border: 1px solid var(--line) !important;
  border-radius: 0.85rem !important;
  padding: 0.62rem 0.95rem !important;
}

button.settings-chip .settings-chip-icon {
  width: 1.5rem !important;
  height: 1.5rem !important;
  max-width: 1.5rem !important;
  max-height: 1.5rem !important;
  color: #8b91a8 !important;
  display: block !important;
  flex: 0 0 1.5rem !important;
}
