/* ============================================================ Theme tokens */
:root {
  --bg-1: #3b1d6e;
  --bg-2: #221248;
  --bg-3: #160d2c;
  --accent: #a855f7;        /* mode accent (purple at home) */
  --action: #f97316;        /* orange action color, constant */
  --dot: #c084fc;

  --row: rgba(255, 255, 255, .06);
  --row-hover: rgba(255, 255, 255, .12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .55);
  --line: rgba(255, 255, 255, .12);

  --radius: 12px;
  --maxw: 760px;
}

html[data-mode="away"] {
  --bg-1: #7c3a0e;
  --bg-2: #5a2a0a;
  --bg-3: #2e1505;
  --accent: #f97316;
  --dot: #fdba74;
}

/* ================================================================== Base */
* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 48%, var(--bg-3) 100%) fixed;
  background-color: var(--bg-3);
  transition: background-color .45s ease;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

body, .topbar, .search-wrap, main, .foot { max-width: var(--maxw); margin-inline: auto; }

a { color: inherit; text-decoration: none; }

/* =============================================================== Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 22px 4px 14px;
}

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

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 22%, transparent);
  transition: background .45s ease, box-shadow .45s ease;
}

.brand-text h1 { font-size: 20px; font-weight: 800; margin: 0; line-height: 1; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.mode-badge {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 11px; border-radius: 999px;
  background: var(--accent); color: #fff;
  transition: background .45s ease;
}

/* sliding toggle */
.toggle {
  position: relative; display: inline-flex; align-items: center;
  padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(0, 0, 0, .25); cursor: pointer; font: inherit;
}
.toggle-opt {
  position: relative; z-index: 1;
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 5px 14px; transition: color .25s ease;
}
html[data-mode="home"] .toggle-opt[data-mode="home"],
html[data-mode="away"] .toggle-opt[data-mode="away"] { color: #fff; }
.toggle-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px); border-radius: 999px;
  background: var(--action);
  transition: transform .28s cubic-bezier(.4, 1.3, .5, 1), background .45s ease;
}
html[data-mode="away"] .toggle-thumb { transform: translateX(100%); }

/* ================================================================ Search */
.search-wrap { padding: 4px 4px 0; }
#search {
  width: 100%; height: 44px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28); color: #fff;
  font-size: 15px; padding: 0 16px;
  outline: none; transition: border-color .2s ease, background .2s ease;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--action); background: rgba(0, 0, 0, .4); }

/* =============================================================== Sections */
main { display: block; padding-top: 6px; }

.cat { margin-top: 22px; }
.cat-title {
  font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--cat, var(--accent)); margin: 0 4px 8px;
}

.rows { display: flex; flex-direction: column; gap: 7px; }

.row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px;
  background: var(--row);
  border: 1px solid transparent;
  border-left: 3px solid var(--cat, var(--accent));
  border-radius: var(--radius);
  transition: background .15s ease, transform .08s ease, border-color .15s ease;
}
.row:hover { background: var(--row-hover); border-color: var(--line); border-left-color: var(--cat, var(--accent)); }
.row:active { transform: scale(.99); }

.ic {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1;
  background: color-mix(in srgb, var(--cat, var(--accent)) 22%, transparent);
}
.ic img { width: 24px; height: 24px; object-fit: contain; }

.meta { min-width: 0; flex: 1; }
.name { font-size: 15.5px; font-weight: 650; line-height: 1.15; }
.sub  { font-size: 12px; color: var(--muted); margin-top: 2px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.right { margin-left: auto; padding-left: 8px; flex: 0 0 auto; }
.host {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--muted);
}
.tag {
  font-size: 10px; font-weight: 800; letter-spacing: .4px;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.tag-public { background: rgba(52, 211, 153, .2);  color: #6ee7b7; }
.tag-vpn    { background: rgba(255, 255, 255, .16); color: #fff; }

/* ================================================================= Footer */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 26px; padding: 0 4px;
  font-size: 11.5px; color: var(--muted);
}
.foot-hint { text-align: right; }

/* ============================================================ Responsive */
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .sub { white-space: normal; }
  .foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .foot-hint { text-align: left; }
}
