/* Ultra M3U Maker — responsive + TV mode + fast lists */
:root{
  --bg:#0b0d12;
  --card:#121622;
  --muted:#97a1b6;
  --text:#eef2ff;
  --line:#24304a;
  --accent:#5eead4;
  --accent2:#60a5fa;
  --danger:#fb7185;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;

  --tap: 44px;
  --fs: 14px;
  --fs2: 12px;
  --h1: 22px;
}

html,body{height:100%}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:var(--sans);
  font-size: var(--fs);
  background: radial-gradient(1000px 600px at 20% 0%, rgba(96,165,250,.12), transparent),
              radial-gradient(1000px 600px at 70% 10%, rgba(94,234,212,.10), transparent),
              var(--bg);
  color:var(--text);
}

.wrap{max-width:1200px;margin:0 auto;padding:18px}
.header{padding-top:22px}
.brand{display:flex;gap:14px;align-items:center}
.grow{flex:1; min-width:0}
.logo{
  width:44px;height:44px;border-radius:12px;
  background: linear-gradient(135deg, rgba(94,234,212,.18), rgba(96,165,250,.18));
  display:grid;place-items:center;
  border:1px solid rgba(94,234,212,.25);
  box-shadow: var(--shadow);
  font-size:18px;
}
h1{margin:0;font-size:var(--h1);letter-spacing:.2px}
.sub{margin:6px 0 0;color:var(--muted);font-size:var(--fs2);line-height:1.35}
code{font-family:var(--mono);font-size:.95em}

.card{
  background:rgba(18,22,34,.92);
  border:1px solid rgba(36,48,74,.85);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.card.inner{margin-top:12px}
.hidden{display:none !important}

.tabs{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.tab{
  min-height: var(--tap);
  background:transparent;
  color:var(--muted);
  border:1px solid rgba(36,48,74,.9);
  border-radius:999px;
  padding:10px 14px;
  cursor:pointer;
  font-weight:800;
}
.tab.active{
  color:var(--text);
  border-color: rgba(94,234,212,.35);
  background: rgba(94,234,212,.08);
}

.panel{display:none}
.panel.active{display:block}

.h2{margin:0;font-size:16px}
.label{display:block;margin:10px 0 6px;font-weight:900;font-size:13px;color:#d7ddf0}
.row{display:flex;gap:10px;align-items:center}
.row.between{justify-content:space-between;flex-wrap:wrap}
.row.tools{flex-wrap:wrap}

.grid2{display:grid;grid-template-columns:1fr;gap:12px}
.grid3{display:grid;grid-template-columns:1fr;gap:10px}

@media (min-width: 980px){
  .grid2{grid-template-columns: 1.12fr .88fr;}
  .grid3{grid-template-columns: 1fr 1fr 1fr;}
}

.input, .textarea, select.input{
  width:100%;
  min-height: var(--tap);
  background: rgba(11,13,18,.7);
  border: 1px solid rgba(36,48,74,.9);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline:none;
}
.input.small{width:240px;max-width:100%}
.textarea{font-family:var(--mono);font-size:12px;line-height:1.45;resize:vertical; padding:12px}
.input:focus, .textarea:focus, select.input:focus{
  border-color: rgba(96,165,250,.55);
  box-shadow: 0 0 0 3px rgba(96,165,250,.12);
}

.btn{
  min-height: var(--tap);
  border:1px solid rgba(36,48,74,.9);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:900;
  white-space:nowrap;
}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.primary{
  border-color: rgba(94,234,212,.35);
  background: linear-gradient(135deg, rgba(94,234,212,.14), rgba(96,165,250,.14));
}
.btn.ghost{background:transparent;color:var(--muted)}
.btn:hover:not(:disabled){filter:brightness(1.06)}

.filebtn{position:relative; overflow:hidden}
.filebtn input[type=file]{
  position:absolute; left:0; top:0; opacity:0; cursor:pointer; width:100%; height:100%;
}

.chip{
  min-height: 36px;
  border-radius: 999px;
  padding: 6px 10px;
  border:1px solid rgba(36,48,74,.9);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight:900;
  cursor:pointer;
}

.toggles{display:flex;gap:8px;align-items:center}

.hint{margin:8px 0 0;color:var(--muted);font-size:12px}
.options{display:flex;flex-wrap:wrap;gap:14px;margin-top:12px}
.chk{display:flex;gap:8px;align-items:center;color:var(--muted);font-size:13px}
.chk input{transform:translateY(1px)}

.status{
  margin-top:10px;
  font-size:13px;
  color:var(--muted);
}
.status.error{color: var(--danger)}
.status.ok{color: var(--accent)}

.sep{
  border:none;
  border-top:1px solid rgba(36,48,74,.75);
  margin:14px 0;
}

.listbox{
  margin-top:12px;
  border:1px solid rgba(36,48,74,.85);
  border-radius:14px;
  overflow:hidden;
}
.listhead{
  display:flex;justify-content:space-between;align-items:center;gap:10px;
  padding:10px 12px;
  background: rgba(11,13,18,.55);
  border-bottom:1px solid rgba(36,48,74,.75);
}
.muted{color:var(--muted);font-size:12px}
.pill{
  display:inline-flex;align-items:center;justify-content:center;
  padding:2px 10px;border-radius:999px;
  border:1px solid rgba(94,234,212,.25);
  background: rgba(94,234,212,.08);
  font-size:12px;color:var(--text);
}

.vlist{
  max-height: 360px;
  overflow:auto;
  contain: strict;
}
.vrow{
  display:flex;gap:10px;align-items:flex-start;
  padding:10px 12px;
  border-top:1px solid rgba(36,48,74,.55);
  cursor:pointer;
}
.vrow:hover{background: rgba(255,255,255,.02)}
.vrow:first-child{border-top:none}
.idx{
  color:var(--muted);
  font-family:var(--mono);
  font-size:12px;
  min-width: 72px;
  text-transform:uppercase;
}
.t{flex:1; min-width:0}
.title{font-weight:900;font-size:13px}
.url{color:var(--muted);font-size:12px;word-break:break-all}

.drop{
  margin-top:10px;
  padding:12px;
  border:1px dashed rgba(96,165,250,.45);
  border-radius:14px;
  color:var(--muted);
  background: rgba(96,165,250,.06);
  text-align:center;
  min-height: var(--tap);
}
.drop.drag{border-color: rgba(94,234,212,.55); background: rgba(94,234,212,.06); color: var(--text)}

.note{
  margin-top:10px;
  border:1px solid rgba(36,48,74,.75);
  border-radius:14px;
  padding:10px 12px;
  background: rgba(11,13,18,.35);
}
.note summary{cursor:pointer;font-weight:900}
.note p{margin:8px 0 0;color:var(--muted);font-size:12px}

.warn{
  border:1px solid rgba(251,113,133,.35);
  background: rgba(251,113,133,.06);
  padding:10px 12px;
  border-radius:14px;
  color: var(--text);
}

.pre{
  background: rgba(11,13,18,.7);
  border:1px solid rgba(36,48,74,.9);
  border-radius:12px;
  padding:10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  overflow:auto;
}

.footer{margin:14px 0 6px;color:var(--muted);text-align:center}

/* Dialog */
.dlg{border:none;border-radius:16px;max-width:900px;width:92vw;background:rgba(18,22,34,.98);color:var(--text);box-shadow:var(--shadow)}
.dlg::backdrop{background:rgba(0,0,0,.55)}
.dlgInner{margin:0;padding:12px}
.dlgTop{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px}
.dlgBody{display:grid;gap:10px}
.video{width:100%;max-height:56vh;border-radius:14px;background:black}

/* TV mode (10-foot UI) */
body.tv{
  --fs: 18px;
  --fs2: 15px;
  --h1: 28px;
  --tap: 56px;
}
body.tv .vlist{max-height: 520px}
