:root{
  --bg:#061022;              /* bleu nuit */
  --panel:#0b1a33;           /* panneau */
  --panel2:#08162c;          /* panneau profond */
  --text:#e9f2ff;
  --muted:#9bb0d2;
  --line:rgba(145,170,220,.18);

  --cyan:#22d3ee;
  --lime:#a3e635;
  --orange:#fb923c;

  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --r1:18px;
  --r2:14px;

  --focus: rgba(34,211,238,.55);
}

/* ==========================================================================
   Base
   ========================================================================== */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background: var(--bg);
}
.hidden{display:none}

/* blueprint grid */
body::before{
  content:"";
  position:fixed; inset:0;
  pointer-events:none;
  background:
    linear-gradient(to right, rgba(145,170,220,.07) 1px, transparent 1px) 0 0/28px 28px,
    linear-gradient(to bottom, rgba(145,170,220,.07) 1px, transparent 1px) 0 0/28px 28px,
    linear-gradient(to right, rgba(145,170,220,.12) 1px, transparent 1px) 0 0/140px 140px,
    linear-gradient(to bottom, rgba(145,170,220,.12) 1px, transparent 1px) 0 0/140px 140px;
  opacity:.55;
  mix-blend-mode:screen;
}

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(6,16,34,.72);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex; align-items:center; gap:12px;
  cursor:pointer; user-select:none;
}
.brand:focus{outline:none}
.brand:focus-visible{outline:3px solid var(--focus); outline-offset:4px; border-radius:16px}

.mark{
  width:46px; height:46px;
  border-radius: 16px;
  display:grid; place-items:center;
  background:
    radial-gradient(120px 60px at 20% 10%, rgba(34,211,238,.35), transparent 60%),
    radial-gradient(120px 60px at 80% 0%, rgba(163,230,53,.22), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid rgba(145,170,220,.22);
  color: var(--text);
  box-shadow: var(--shadow);
}

.brandText{display:flex; flex-direction:column}
.brandName{font-weight:950; letter-spacing:.2px}
.brandTag{font-size:12px; color:var(--muted); margin-top:2px}

.nav{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}

/* ==========================================================================
   Buttons & links
   ========================================================================== */
.btn{
  border:1px solid rgba(145,170,220,.22);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding:10px 12px;
  border-radius: 999px;
  cursor:pointer;
  font-weight:900;
  transition: transform .06s ease, filter .15s ease, background .15s ease;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}
.btn:hover{background: rgba(255,255,255,.07)}
.btn:active{transform: translateY(1px)}
.btn:focus{outline:none}
.btn:focus-visible{outline:3px solid var(--focus); outline-offset:3px}

.btn-ghost{
  box-shadow:none;
  background: transparent;
}

.btn-primary{
  border-color: rgba(34,211,238,.55);
  background:
    linear-gradient(135deg, rgba(34,211,238,.28), rgba(163,230,53,.18));
}
.btn-primary:hover{filter:brightness(1.05)}

.link{
  background:none; border:none; padding:0;
  color: var(--text);
  cursor:pointer;
  font-weight:950;
}
.link:focus{outline:none}
.link:focus-visible{outline:3px solid var(--focus); outline-offset:3px; border-radius:10px}

.linkInline{
  border:none;
  background:none;
  padding:0;
  cursor:pointer;
  font-weight:950;
  color: rgba(233,242,255,.92);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.linkInline:hover{opacity:.85}

/* ==========================================================================
   Layout
   ========================================================================== */
.wrap{max-width:1140px; margin:0 auto; padding:18px}
.view{padding-top:14px}

.homeGrid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:14px;
  align-items:start;
}
@media (max-width: 900px){
  .homeGrid{grid-template-columns:1fr}
}

/* ==========================================================================
   Cards (global)
   ========================================================================== */
.introCard, .searchCard, .sideCard, .filBanner, .calCard, .rowCard{
  border-radius: var(--r1);
  border:1px solid rgba(145,170,220,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Home - Intro
   ========================================================================== */
.introCard{padding:18px}

.kicker{
  display:inline-flex; align-items:center; gap:10px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(34,211,238,.10);
  border:1px solid rgba(34,211,238,.22);
  color: rgba(233,242,255,.92);
  font-weight:950;
  font-size:12px;
}
.kicker::before{
  content:"";
  width:8px;height:8px;border-radius:999px;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  box-shadow: 0 0 0 3px rgba(34,211,238,.12);
}

.introCard h1{
  margin:12px 0 10px 0;
  font-size:32px;
  line-height:1.05;
  letter-spacing:-.4px;
}
.introCard p{margin:0; color:var(--muted); line-height:1.6}

.note{
  margin-top:14px;
  display:flex; align-items:center; gap:10px;
  font-size:12px;
  color: var(--muted);
}
.note .dot{
  width:10px;height:10px;border-radius:999px;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
}

/* chips */
.chips{display:flex; gap:8px; flex-wrap:wrap; margin-top:14px}
.chip{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(145,170,220,.22);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  font-weight:900;
  color: rgba(233,242,255,.92);
}
.chip:hover{background: rgba(255,255,255,.07)}

.chipsTitle{
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   Home - Search & results
   ========================================================================== */
.searchCard{padding:16px}

.searchTop{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom:12px;
}
.searchTitle{font-weight:950; font-size:16px}
.searchHint{font-size:12px; color:var(--muted); margin-top:4px}

/* segmented */
.seg{
  display:flex;
  border:1px solid rgba(145,170,220,.22);
  border-radius:999px;
  overflow:hidden;
  background: rgba(255,255,255,.03);
}
.segBtn{
  padding:8px 10px;
  border:none;
  cursor:pointer;
  background: transparent;
  font-weight:950;
  color: rgba(233,242,255,.80);
}
.segBtn:focus{outline:none}
.segBtn:focus-visible{outline:3px solid var(--focus); outline-offset:-2px}
.segOn{
  background: rgba(34,211,238,.14);
  color: rgba(233,242,255,.96);
}

.searchRow{display:flex; gap:10px; align-items:center}
@media (max-width: 520px){
  .searchRow{flex-direction:column; align-items:stretch}
  .btn{width:100%}
}
.searchInput{
  flex:1;
  padding:12px 14px;
  border-radius: 16px;
  border:1px solid rgba(145,170,220,.22);
  background: rgba(8,22,44,.55);
  color: var(--text);
  outline:none;
  font-weight:850;
}
.searchInput::placeholder{color: rgba(155,176,210,.80); font-weight:650}
.searchInput:focus{border-color: rgba(34,211,238,.45)}
.searchInput:focus-visible{outline:3px solid var(--focus); outline-offset:2px}

.resultsMeta{margin:12px 0 10px 0; font-size:12px; color:var(--muted)}
.resultsList{display:flex; flex-direction:column; gap:10px}

.rowCard{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border-radius: var(--r2);
  padding:12px;
  cursor:pointer;
  transition: transform .08s ease, background .18s ease, box-shadow .18s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
.rowCard:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 34px rgba(0,0,0,.30);
}

.rowLeft{
  display:flex;
  align-items:center;
  gap:12px;
}

.swatch{
  width:14px;height:14px;border-radius:999px;
  border:1px solid rgba(145,170,220,.22);
  background: linear-gradient(135deg, rgba(34,211,238,.75), rgba(163,230,53,.65));
  box-shadow: 0 0 0 4px rgba(34,211,238,.08);
}

.rowThumb{
  width:56px;
  height:42px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  flex:0 0 auto;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}
.rowThumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.rowTitle{font-weight:950}
.rowSub{font-size:12px; color:var(--muted); margin-top:3px}
.rowRight{display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end}

.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(145,170,220,.18);
  background: rgba(8,22,44,.35);
  color: rgba(233,242,255,.88);
  font-weight:900;
}

.emptyHint{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(145,170,220,.18);
  font-size:12px;
  color: var(--muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer{
  padding:18px 0;
  color: var(--muted);
  font-size:12px;
  text-align:center;
}

/* ==========================================================================
   Filament page
   ========================================================================== */
.crumbs{display:flex; align-items:center; gap:10px; color:var(--muted); margin:6px 0 10px}
.sep{opacity:.45}

.filBanner{
  padding:16px;
  border-radius: var(--r1);
  background:
    radial-gradient(900px 280px at 20% 0%, rgba(34,211,238,.16), transparent 60%),
    radial-gradient(900px 280px at 80% 0%, rgba(163,230,53,.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

.filHeader{
  display:flex;
  align-items:center;
  gap:16px;
  margin-bottom:14px;
}
.filThumb{
  width:110px;
  height:82px;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  flex:0 0 auto;
  box-shadow: 0 14px 34px rgba(0,0,0,.25);
}
.filThumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.filHeadText h2{
  margin:0;
  line-height:1.1;
}

.filTitle{font-size:24px; font-weight:980; letter-spacing:-.2px}
.filSub{color:var(--muted); margin-top:6px}
.filBadges{display:flex; gap:8px; flex-wrap:wrap; margin-top:12px}
.filActions{display:flex; gap:10px; flex-wrap:wrap; margin-top:12px}

.contentGrid{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:14px;
  margin-top:14px;
}
@media (max-width: 980px){
  .contentGrid{grid-template-columns:1fr}
}

/* left filters */
.sideCard{
  padding:14px;
  position:sticky;
  top:86px;
  border-radius: var(--r1);
}
@media (max-width: 980px){
  .sideCard{position:relative; top:auto}
}
.sideTitle{font-weight:980; margin-bottom:12px}
.lbl{display:block; font-size:12px; color:var(--muted); margin:10px 0 6px}
select{
  width:100%;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(145,170,220,.22);
  background: rgba(8,22,44,.55);
  color: var(--text);
  font-weight:900;
  outline:none;
}
select:focus{border-color: rgba(34,211,238,.45)}
select:focus-visible{outline:3px solid var(--focus); outline-offset:2px}
.sideStats{display:flex; gap:8px; flex-wrap:wrap; margin-top:12px}

/* main list */
.mainHead{margin-bottom:10px}
.mainTitle{font-weight:980}
.mainHint{font-size:12px; color:var(--muted); margin-top:4px}

.calList{display:flex; flex-direction:column; gap:10px}
.calCard{
  border-radius: var(--r2);
  padding:12px;
  background: rgba(255,255,255,.04);
  border:1px solid rgba(145,170,220,.18);
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
}

.calHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.calName{font-weight:980}
.calMeta{color:var(--muted); font-size:12px; margin-top:4px}

.kv{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px}

.calBottom{
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  margin-top:12px;
  padding-top:10px;
  border-top:1px solid rgba(145,170,220,.16);
}

.small{font-size:12px; color:var(--muted)}
.vote{display:flex; gap:8px; flex-wrap:wrap}
.vote .btn{padding:8px 10px; box-shadow:none}

/* ==========================================================================
   Tests (chips + panel déroulant)
   ========================================================================== */
.testsBar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.testChip{
  padding:7px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  font-size:12px;
  font-weight:900;
  transition: transform .12s ease, background .12s ease, filter .12s ease;
}
.testChip:hover{
  background: rgba(34,211,238,.14);
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.testChip:active{transform: translateY(0px)}
.testChip:focus{outline:none}
.testChip:focus-visible{outline:3px solid var(--focus); outline-offset:2px}

.testPanel{
  margin-top:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  overflow:hidden;

  animation: panelIn .16s ease-out;
  transform-origin: top;
}

@keyframes panelIn{
  from { opacity: 0; transform: translateY(-6px) scaleY(.98); }
  to   { opacity: 1; transform: translateY(0) scaleY(1); }
}

.testPanelHead{
  padding:10px 12px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(255,255,255,.10);
}

.testPanelTitle{font-weight:980}
.testPanelHint{font-size:12px; color:var(--muted)}

.testPanelBody{
  padding:12px;
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:12px;
}

.testPanelImg{
  width:140px;
  height:105px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  object-fit:cover;
  display:block;
  background: rgba(0,0,0,.15);
}

.testPanelDetails .kvLine{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:6px 0;
  border-bottom:1px dashed rgba(255,255,255,.10);
}
.testPanelDetails .kvLine:last-child{border-bottom:none}
.testPanelDetails span{color:var(--muted)}

/* responsive tests */
@media (max-width: 640px){
  .testPanelBody{
    grid-template-columns: 1fr;
  }
  .testPanelImg{
    width: 100%;
    height: 170px;
  }
  .testsBar{
    justify-content: flex-start;
  }
}
