:root {
  --bg: #eef0f6; --bg-end: #e2e0f0; --card: #ffffff; --field: #f6f7fb;
  --text: #1b1f24; --muted: #5c6670;
  --border: #dcdfe6; --accent: #4f008c; --accent-text: #ffffff;
  --hover: #f3ecfa; --danger: #b3261e;
  --shadow: 0 2px 10px rgba(0,0,0,.08); --shadow-lg: 0 8px 28px rgba(60,20,110,.14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14121a; --bg-end: #0e0d13; --card: #1d1b26; --field: #15131c;
    --text: #e8eaed; --muted: #9aa4ae;
    --border: #34303f; --accent: #b388ff; --accent-text: #121417;
    --hover: #2a2340; --danger: #ff8a80;
    --shadow: 0 2px 10px rgba(0,0,0,.5); --shadow-lg: 0 8px 28px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --bg: #14121a; --bg-end: #0e0d13; --card: #1d1b26; --field: #15131c;
  --text: #e8eaed; --muted: #9aa4ae;
  --border: #34303f; --accent: #b388ff; --accent-text: #121417;
  --hover: #2a2340; --danger: #ff8a80;
  --shadow: 0 2px 10px rgba(0,0,0,.5); --shadow-lg: 0 8px 28px rgba(0,0,0,.55);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1:focus { outline: none; }
html, body { min-height: 100%; }
body { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-end) 100%) fixed; }

/* Page with ads: one column on phones and tablets; ad | content | ad on wide screens. */
.page { display: grid; grid-template-columns: minmax(0, 1fr); padding: 16px 12px 32px; }
.page-single { padding: 16px 12px 32px; }
.ad-side { display: none; }
.ad-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); min-width: 250px; }
@media (min-width: 1320px) {
  .page { grid-template-columns: 300px minmax(0, 640px) 300px; justify-content: center; column-gap: 24px; }
  .ad-side { display: block; width: 300px; position: sticky; top: 16px; align-self: start; }
}

/* The Site Finder card: branded header on top, content below. */
.wrap { width: 100%; max-width: 640px; margin: 0 auto; }
.finder {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; padding: 0 20px 24px;
}
.finder-head {
  margin: 0 -20px 20px; padding: 22px 20px 18px; color: #fff;
  background: linear-gradient(135deg, #3b0068 0%, #4f008c 55%, #7b2cbf 100%);
  border-bottom: 3px solid #ff375e;
}
.finder-head h1 { color: #fff; font-size: 1.5rem; margin: 0 0 4px; letter-spacing: .2px; }
.finder-head .sub { color: rgba(255,255,255,.85); margin: 0; }
.finder input[type="search"], .finder input[type="password"] { background: var(--field); }
.finder #list { box-shadow: none; border: 1px solid var(--border); }
.finder .card { box-shadow: none; background: var(--hover); border: 1px solid var(--border);
                border-left: 4px solid var(--accent); }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }
input[type="search"], input[type="password"] {
  width: 100%; font-size: 1.1rem; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  outline: none; font-family: inherit;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
#count { color: var(--muted); font-size: .85rem; margin: 8px 2px; min-height: 1.2em; }
#list { list-style: none; margin: 0; padding: 0; border-radius: 10px; overflow: hidden;
        background: var(--card); box-shadow: var(--shadow); }
#list li .row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  width: 100%; padding: 11px 14px; margin: 0; text-align: left;
  border: 0; border-top: 1px solid var(--border); border-radius: 0;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
#list li:first-child .row { border-top: 0; }
#list li .row:hover, #list li.active .row, #list li .row.selected { background: var(--hover); }
#list li .row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#detail { margin-top: 14px; }
.id { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.id mark { background: transparent; color: var(--accent); font-weight: 700; }
.loc { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.card {
  display: none; margin-top: 18px; padding: 16px; border-radius: 10px;
  background: var(--card); box-shadow: var(--shadow);
}
.card.show { display: block; }
.card h2 { margin: 0 0 2px; font-size: 1.15rem; }
#dId { font-family: ui-monospace, Menlo, Consolas, monospace; }
.meta { color: var(--muted); margin: 0 0 12px; font-size: .95rem; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-block; padding: 10px 14px; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--accent); color: var(--accent); font-weight: 600; font-size: .95rem;
  background: transparent; cursor: pointer; font-family: inherit;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:active { transform: translateY(1px); }
.hint { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.hint.err { color: var(--danger); }
form.login { display: flex; gap: 8px; margin-top: 10px; }
form.login input { flex: 1; }

/* Device-specific buttons: App.razor adds the android / ios / desktop class to <html>. */
.only-android, .only-ios { display: none; }
.android .only-android, .ios .only-ios { display: block; }
.android a.only-android, .ios a.only-ios { display: inline-block; }

/* Rewarded-ad gate: full-screen "watch an ad to unlock" overlay. */
.gate-backdrop {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(24, 10, 44, .6); backdrop-filter: blur(6px);
}
.gate-card {
  width: 100%; max-width: 420px; padding: 28px 22px 22px; text-align: center;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
  border-top: 4px solid #4f008c;
}
.gate-logo { width: 72px; height: 72px; border-radius: 50%; }
.gate-card h2 { margin: 14px 0 6px; font-size: 1.3rem; }
.gate-text { margin: 0; color: var(--text); }
.gate-note { margin: 10px 0 0; padding: 6px 10px; border-radius: 8px; font-size: .85rem;
             background: var(--hover); color: var(--muted); }
.gate-btn { width: 100%; margin-top: 18px; padding: 14px; font-size: 1.05rem; }
.gate-btn:disabled { opacity: .6; cursor: default; }
.gate-status { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); font-size: .95rem; }
.gate-status.err { color: var(--danger); }
.gate-fine { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.pass-note { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .8rem; }
.pass-note:empty { display: none; }
input:disabled { opacity: .6; }
