/* BSVKey Live: broadcast look (dark studio, red for live and primary actions). */
:root {
  --bg: #0f0f0f; --surface: #181818; --card: #212121; --card2: #2a2a2a; --line: #303030; --line2: #3f3f3f;
  --text: #f1f1f1; --muted: #aaaaaa; --dim: #717171;
  --red: #ff0033; --red-h: #d9002b; --red-soft: rgba(255, 0, 51, .14);
  --blue: #3ea6ff; --green: #2ba640; --amber: #f5b301;
  --radius: 12px; --font: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.good { color: var(--green); font-weight: 700; } .bad { color: var(--red); font-weight: 700; } .wait { color: var(--muted); }
.hidden { display: none !important; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px; background: rgba(15, 15, 15, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.2px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 22px; border-radius: 6px; background: var(--red); display: grid; place-items: center; }
.brand .logo::after { content: ""; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text); padding: 7px 12px; border-radius: 999px; font-weight: 500; }
.nav a:hover, .nav a.on { background: var(--card2); text-decoration: none; }
.search { flex: 1; max-width: 560px; display: flex; margin-left: auto; }
.search input { flex: 1; min-width: 0; background: #121212; border: 1px solid var(--line2); border-right: 0; border-radius: 999px 0 0 999px; padding: 8px 16px; outline: none; }
.search input:focus { border-color: var(--blue); }
.search button { background: var(--card2); border: 1px solid var(--line2); border-radius: 0 999px 999px 0; padding: 0 18px; cursor: pointer; }
.golive { background: var(--red); color: #fff !important; border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.golive:hover { background: var(--red-h); text-decoration: none; }
.netbadge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.netbadge.test { color: var(--amber); border-color: var(--amber); }

/* Wallet chip (same behaviour as the bsvkey.com top-right wallet) */
.wchip { position: relative; }
.wbtn { display: inline-flex; align-items: center; gap: 7px; background: var(--card2); border: 1px solid var(--line2); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.wbtn:hover, .wbtn[aria-expanded="true"] { border-color: var(--text); }
.wbtn .wdot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.wbtn.on .wdot { background: var(--green); }
.wbtn.on .wlabel { font-family: var(--mono); font-size: 12px; }
.wmenu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: 320px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--radius); padding: 6px; box-shadow: 0 12px 32px rgba(0, 0, 0, .6); }
.wmenu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.wmenu button small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.wmenu button:hover, .wmenu button:focus-visible { background: var(--card2); outline: none; }
.wmenu .whead { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.wmenu .whead b { display: block; font-size: 20px; }
.wmenu .wnote { color: var(--muted); font-size: 11.5px; padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }

/* Layout */
main { max-width: 1480px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 20px; margin: 0 0 6px; } h2 { font-size: 18px; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--card2); border: 1px solid var(--line2); border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--line2); text-decoration: none; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; } .btn.red:hover { background: var(--red-h); }
.btn.white { background: #f1f1f1; color: #0f0f0f; border-color: #f1f1f1; }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], select, textarea { background: #121212; border: 1px solid var(--line2); border-radius: 8px; padding: 9px 10px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
label { display: block; color: var(--muted); font-size: 12.5px; margin: 10px 0 4px; }
.note { color: var(--muted); font-size: 13px; margin-top: 8px; } .note.ok { color: var(--text); } .note.bad { color: var(--red); }

/* Badges */
.live { display: inline-flex; align-items: center; gap: 5px; background: var(--red); color: #fff; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 4px; letter-spacing: .4px; }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.chip { display: inline-block; background: var(--card2); color: var(--text); border-radius: 8px; padding: 5px 12px; font-weight: 500; cursor: pointer; border: 0; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.tag.chain { background: rgba(43, 166, 64, .2); color: #7ee08f; } .tag.anchor { background: rgba(62, 166, 255, .18); color: #9fd2ff; } .tag.free { background: rgba(255, 255, 255, .14); }

/* Cards grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 16px; }
.card { color: var(--text); display: block; }
.card:hover { text-decoration: none; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, #2b0a12, #111 60%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-weight: 800; font-size: 18px; color: rgba(255, 255, 255, .82); }
.thumb .tl { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; }
.thumb .br { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.card:hover .thumb { outline: 2px solid var(--line2); }
.meta { display: flex; gap: 12px; margin-top: 12px; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; }
.meta .t { font-weight: 600; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .s { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.empty { color: var(--muted); padding: 24px; border: 1px dashed var(--line2); border-radius: var(--radius); text-align: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; } th, td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line2); border-radius: var(--radius); max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #f1f1f1; color: #0f0f0f; padding: 10px 16px; border-radius: 8px; font-weight: 600; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }

@media (max-width: 860px) {
  .nav, .brand small { display: none; }
  .search { max-width: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .golive span { display: none; }
}
@media (max-width: 560px) {
  .search { display: none; }
  .wbtn .wlabel { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .wmenu { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .grid { grid-template-columns: 1fr; }
}
