/* ====== Theme tokens ====== */
:root{
  --bg: #0b0c10;
  --panel: rgba(255,255,255,.04);
  --panel2: rgba(255,255,255,.06);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --border: rgba(255,255,255,.10);
  --border2: rgba(255,255,255,.16);

  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow2: 0 8px 20px rgba(0,0,0,.22);

  --radius: 18px;
  --radius2: 14px;

  --focus: rgba(92, 169, 255, .35);

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color-scheme: dark;
}

html[data-theme="light"]{
  --bg: #f6f7fb;
  --panel: rgba(255,255,255,.78);
  --panel2: rgba(255,255,255,.95);
  --text: rgba(10,12,16,.92);
  --muted: rgba(10,12,16,.62);
  --border: rgba(10,12,16,.10);
  --border2: rgba(10,12,16,.16);

  --shadow: 0 10px 30px rgba(10,12,16,.10);
  --shadow2: 0 8px 20px rgba(10,12,16,.08);

  --focus: rgba(0, 115, 255, .22);

  color-scheme: light;
}

/* ====== Base ====== */
*{ box-sizing: border-box; }
body{
  margin:0;
  background:
    radial-gradient(1000px 600px at 10% -10%, rgba(92,169,255,.16), transparent 60%),
    radial-gradient(800px 500px at 90% 0%, rgba(0,200,150,.12), transparent 55%),
    var(--bg);
  color: var(--text);
}

a{ color: inherit; }

.container{
  max-width: 1050px;
  margin: 0 auto;
  padding: 22px;
}

.muted{ color: var(--muted); }

.title{
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.subtitle{ margin: 6px 0 0; }

/* ====== Header / Topbar ====== */
.header{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(0,0,0,.25), rgba(0,0,0,0));
  border-bottom: 1px solid var(--border);
}
html[data-theme="light"] .header{
  background: linear-gradient(to bottom, rgba(255,255,255,.75), rgba(255,255,255,0));
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
}

.brand{ min-width: 0; }

.icon-btn{
  height: 42px;
  width: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow2);
}
.icon-btn:hover{ border-color: var(--border2); transform: translateY(-1px); }
.icon-btn:active{ transform: translateY(0); }
.icon-btn:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ====== Inputs ====== */
.search{
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: var(--panel);
  color: inherit;
  outline: none;
  box-shadow: var(--shadow2);
}
.search:focus{
  border-color: var(--border2);
  box-shadow: 0 0 0 3px var(--focus), var(--shadow2);
}

textarea.search{ resize: vertical; min-height: 44px; }

/* ====== Grid & Cards ====== */
.section{ padding-top: 18px; }
.section-head{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 12px;
}
.section-title{ margin:0; font-size: 16px; letter-spacing: -0.01em; }
.section-count{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 3px 10px;
  border-radius: 999px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.card{
  position: relative;
  display:block;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  color: inherit;
  text-decoration:none;
  box-shadow: var(--shadow2);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover{
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card h3{
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.card p{
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.35;
}

.tags{
  margin-top: 10px;
  display:flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.10);
  padding: 3px 9px;
  border-radius: 999px;
}
html[data-theme="light"] .tag{ background: rgba(255,255,255,.75); }

/* ====== Buttons ====== */
.btn{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow2);
}
.btn:hover{ border-color: var(--border2); transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ====== Footer ====== */
.footer{
  border-top: 1px solid var(--border);
  margin-top: 30px;
}

/* ====== Mobile ====== */
@media (max-width: 600px){
  .container{ padding: 16px; }
  .title{ font-size: 20px; }
  .grid{ grid-template-columns: 1fr; }
  .btn{ width: 100%; }
}
