/* iptv-org look-alike — palette and layout lifted from the original Svelte/Tailwind app */
:root {
  --bg: #f8fafc;          /* slate-50 */
  --card: #ffffff;
  --border: #e5e7eb;      /* gray-200 */
  --text: #4b5563;        /* gray-600 */
  --muted: #6b7280;       /* gray-500 */
  --name: #4b5563;
  --field-bg: #ffffff;
  --field-border: #d1d5db;/* gray-300 */
  --code-bg: #f3f4f6;     /* gray-100 */
  --code-text: #6b7280;
  --row-hover: #f9fafb;   /* gray-50 */
  --accent: #3b82f6;      /* blue-500 */
  --logo: #1f2328;
}
html.dark {
  --bg: hsl(219,23%,15%);    /* primary-850 */
  --card: hsl(219,23%,19%);  /* primary-810 */
  --border: hsl(219,23%,25%);/* primary-750 */
  --text: #ffffff;
  --muted: #9ca3af;          /* gray-400 */
  --name: #ffffff;
  --field-bg: hsl(219,23%,25%);
  --field-border: hsl(219,23%,30%);
  --code-bg: hsl(219,23%,25%);
  --code-text: #d1d5db;      /* gray-300 */
  --row-hover: hsl(219,23%,25%);
  --accent: #60a5fa;         /* blue-400 */
  --logo: #f8fafc;
}

* { box-sizing: border-box; }
html { overflow-y: scroll; scrollbar-gutter: stable; }
html.no-scroll, html.no-scroll body { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mdi { fill: currentColor; display: block; }

/* nav */
nav {
  position: sticky; top: 0; z-index: 20; height: 61px;
  background: var(--bg); display: flex; align-items: center;
  border-bottom: 1px solid transparent;
}
nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 80rem; margin: 0 auto; padding: 0 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--logo); }
.brand svg { height: 30px; width: 30px; }
.brand b { font-family: ui-monospace, monospace; font-weight: 700; font-size: 16px; }
.nav-icons { display: flex; gap: 4px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { color: var(--text); background: var(--row-hover); }

/* layout */
main { min-height: 100vh; }
.wrap { max-width: 960px; margin: 0 auto; padding: 8px 8px 80px; }

/* search */
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 0; bottom: 0; display: flex; align-items: center; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 8px 40px 8px 40px;
  background: var(--field-bg); border: 1px solid var(--field-border); color: var(--text);
  border-radius: 6px; font-size: 14px; outline-color: var(--accent);
}
.search input::placeholder { color: var(--muted); }
.search .clear { position: absolute; right: 6px; top: 6px; bottom: 6px; width: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; display: none; align-items: center; justify-content: center; }
.search .clear.show { display: flex; }

.meta { display: flex; justify-content: space-between; padding: 8px 4px 24px; }
.meta, .meta * { font-family: ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.meta .syntax { background: none; border: 0; cursor: pointer; }
.meta .syntax:hover { text-decoration: underline; color: var(--accent); }

/* country accordion */
.country { margin-bottom: 10px; }
.country-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px 0 14px; cursor: pointer; text-align: left;
  font-weight: 500; color: var(--name); background: var(--card);
  border: 1px solid var(--border); border-radius: 6px;
}
.country.open .country-head { border-radius: 6px 6px 0 0; border-bottom-color: transparent; }
.country-head .left { display: flex; align-items: center; gap: 8px; }
.country-head .flag { width: 28px; text-align: center; font-size: 22px; line-height: 1; }
.country-head .chev { color: var(--muted); transition: transform .15s; }
.country.open .country-head .chev { transform: rotate(180deg); }
.country-body { border: 1px solid var(--border); border-radius: 0 0 6px 6px; overflow: hidden; }

/* channel rows */
.row {
  display: flex; align-items: center; min-height: 64px; cursor: pointer;
  border-bottom: 1px solid var(--border); padding: 8px 0;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--row-hover); }
.row .fav-cell { width: 40px; flex: none; display: flex; align-items: center; justify-content: center; padding-left: 6px; }
.fav { background: none; border: 0; cursor: pointer; padding: 4px; display: inline-flex; color: var(--muted); border-radius: 6px; }
.fav:hover { color: #f5c518; }
.fav.on { color: #f5c518; }
.row .logo-cell { width: 96px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
@media (min-width: 640px) { .row .logo-cell { width: 200px; } }
.row .logo-cell img { max-width: 80px; max-height: 44px; }
.row .logo-cell .noimg { color: var(--muted); opacity: .45; display: inline-flex; align-items: center; }
.row .name-cell { flex: 1; min-width: 0; padding: 0 8px; }
.row .name-cell a { color: var(--name); cursor: pointer; }
.row .name-cell a:hover { color: var(--accent); text-decoration: underline; }
.row .name { display: flex; align-items: center; gap: 8px; }
.row .name .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .code-cell { width: 280px; flex: none; padding: 0 16px; display: none; }
@media (min-width: 1024px) { .row .code-cell { display: flex; } }
.row .link-cell { width: 46px; flex: none; display: flex; align-items: center; justify-content: center; padding-right: 6px; }
.row .copy { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; display: inline-flex; }
.row .copy:hover { color: var(--accent); background: var(--card); }
.row .copy.ok { color: #4caf50; }
code.id { font-family: ui-monospace, monospace; font-size: 13px; color: var(--code-text); background: var(--code-bg); padding: 4px 8px; border-radius: 3px; user-select: all; word-break: break-word; }
.badge { font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 9999px; background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.badge.geo { color: #e0666c; }

.showmore { display: flex; align-items: center; justify-content: center; height: 48px; width: 100%; border: 0; border-top: 1px solid var(--border); background: var(--card); color: var(--accent); cursor: pointer; font-size: 14px; }
.showmore:hover { background: var(--row-hover); }
.empty, .loading { text-align: center; padding: 24px; font-family: ui-monospace, monospace; color: var(--muted); }

/* mini floating player — pinned bottom-right so you can keep browsing while it plays */
#player { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: min(440px, 92vw); display: none; }
#player.show { display: block; }
.player-box { width: 100%; background: #000; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.55); }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--card); cursor: move; }
.player-bar b { color: var(--name); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.player-bar .x { cursor: pointer; color: var(--muted); border: 0; background: none; line-height: 1; padding: 4px; display: inline-flex; border-radius: 6px; }
.player-bar .x:hover { color: var(--name); background: var(--row-hover); }
.player-bar .x.ok { color: #4caf50; }
.player-box video { width: 100%; display: block; background: #000; aspect-ratio: 16/9; }
.player-status { padding: 10px 14px; background: var(--card); color: var(--muted); font-family: ui-monospace, monospace; font-size: 12.5px; min-height: 0; }
