
/* KaraoKing — Responsive styles for leaderboard boards (combined + standard) */
:root{
  --kk-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --kk-fg: inherit;
  --kk-dim: rgba(255,255,255,.7);
  --kk-border: rgba(255,255,255,.15);
}

#kkbc-board, #kkb-board { font-family: var(--kk-font); color: var(--kk-fg); }

/* ---------- Combined leaderboard ---------- */
#kkbc-board .kkbc-head{
  margin: 0 0 .5rem 0;
  font-size: .95rem;
  opacity: .8;
}

#kkbc-board .kkbc-rows{
  border: 1px solid var(--kk-border);
  border-radius: 14px;
  overflow: hidden;
}

#kkbc-board .kkbc-row{
  display: grid;
  grid-template-columns: 3.5rem 1fr 7rem 12rem 12rem;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
}
#kkbc-board .kkbc-row + .kkbc-row{ border-top: 1px solid var(--kk-border); }

#kkbc-board .kkbc-header{
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  opacity: .85;
  position: sticky;
  top: 0;
  backdrop-filter: blur(2px);
}

#kkbc-board .rk{
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
#kkbc-board .comb,
#kkbc-board .jury,
#kkbc-board .pub{
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#kkbc-board .name{ line-height: 1.15; }

/* Mobile (≤640px): transform rows into compact cards */
@media (max-width: 640px){
  #kkbc-board .kkbc-row{
    grid-template-columns: 3rem 1fr 4.5rem;
    grid-template-areas:
      "rk name comb"
      ".  meta meta";
    row-gap: .35rem;
  }
  #kkbc-board .rk{ grid-area: rk; }
  #kkbc-board .name{ grid-area: name; font-weight: 600; }
  #kkbc-board .comb{ grid-area: comb; justify-self: end; font-size: 1.15rem; font-weight: 700; }
  #kkbc-board .jury, #kkbc-board .pub{
    grid-area: meta;
    justify-self: start;
    text-align: left;
    display: inline-block;
    margin-right: .6rem;
    padding: .15rem .5rem;
    border: 1px solid var(--kk-border);
    border-radius: 999px;
    font-size: .85rem;
    opacity: .95;
  }
  #kkbc-board .kkbc-header{ display: none; } /* table header not needed on mobile */
}

/* ---------- Standard leaderboard ---------- */
#kkb-board .kkb-row{
  display: grid;
  grid-template-columns: 3rem 1fr 7rem 7rem;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
}
#kkb-board .kkb-row + .kkb-row{ border-top: 1px solid var(--kk-border); }
#kkb-board .kkb-head{
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  opacity: .85;
}
@media (max-width: 640px){
  #kkb-board .kkb-head{ display: none; }
  #kkb-board .kkb-row{ grid-template-columns: 3rem 1fr 5rem; }
  #kkb-board .kkb-row span:nth-child(4){ grid-column: 3/4; justify-self: end; }
}


/* ===== Winner accent (rank #1) ===== */
/* Combined */
#kkbc-board .kkbc-rows .kkbc-header + .kkbc-row{
  position: relative;
  background: linear-gradient(90deg, rgba(255,215,0,.12), transparent 70%);
}
#kkbc-board .kkbc-rows .kkbc-header + .kkbc-row .name::before{
  content:"👑 ";
}
#kkbc-board .kkbc-rows .kkbc-header + .kkbc-row .rk{
  background: linear-gradient(180deg, #ffd700, #f5c518);
  color:#1a1a1a;
  border-radius: 999px;
  width: 2.2rem; height: 2.2rem;
  display: inline-grid; place-items: center;
  justify-self: center;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(0,0,0,.15), inset 0 0 0 1px rgba(255,255,255,.5);
}
#kkbc-board .kkbc-rows .kkbc-header + .kkbc-row .comb{ font-size:1.2rem; font-weight:800; }

/* Standard */
#kkb-board .kkb-head + .kkb-row{
  background: linear-gradient(90deg, rgba(255,215,0,.12), transparent 70%);
}
#kkb-board .kkb-head + .kkb-row span:first-child{
  background: linear-gradient(180deg, #ffd700, #f5c518);
  color:#1a1a1a;
  border-radius: 999px;
  width: 2.2rem; height: 2.2rem;
  display: inline-grid; place-items: center;
  justify-self: center;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(0,0,0,.15), inset 0 0 0 1px rgba(255,255,255,.5);
}
#kkb-board .kkb-head + .kkb-row span:nth-child(3){ font-size:1.1rem; font-weight:800; }

@media (max-width:640px){
  #kkbc-board .kkbc-rows .kkbc-header + .kkbc-row{
    border: 2px solid rgba(255,215,0,.5);
    border-radius: 14px;
    margin: .35rem;
  }
  #kkb-board .kkb-head + .kkb-row{
    border: 2px solid rgba(255,215,0,.5);
    border-radius: 14px;
    margin: .35rem;
  }
}

/* ===== Light/Dark variants ===== */
@media (prefers-color-scheme: light){
  :root{
    --kk-fg:#1a1a1a;
    --kk-dim:rgba(0,0,0,.65);
    --kk-border:rgba(0,0,0,.12);
  }
}
@media (prefers-color-scheme: dark){
  :root{
    --kk-fg:#f6f6f6;
    --kk-dim:rgba(255,255,255,.75);
    --kk-border:rgba(255,255,255,.15);
  }
}
/* Optional: force theme by class on <body> or a wrapper */
.kk-theme-light{ --kk-fg:#1a1a1a; --kk-dim:rgba(0,0,0,.65); --kk-border:rgba(0,0,0,.12); }
.kk-theme-dark{ --kk-fg:#f6f6f6; --kk-dim:rgba(255,255,255,.75); --kk-border:rgba(255,255,255,.15); }



/* ===== PATCH v1.2 — mobile fix for #kkbc-board (no overlap of jury/public) ===== */
@media (max-width:640px){
  #kkbc-board .kkbc-row{
    display: grid;
    grid-template-columns: 3rem 1fr 4.5rem;
    grid-template-areas:
      "rk name comb"
      ".  jury comb"
      ".  pub  comb";
    row-gap: .25rem;
    align-items: center;
  }
  #kkbc-board .rk{ grid-area: rk; }
  #kkbc-board .name{ grid-area: name; font-weight: 600; }
  #kkbc-board .comb{ grid-area: comb; justify-self: end; font-size: 1.15rem; font-weight: 700; }
  #kkbc-board .jury{ grid-area: jury; justify-self: start; text-align: left; }
  #kkbc-board .pub{ grid-area: pub; justify-self: start; text-align: left; }
  #kkbc-board .jury, #kkbc-board .pub{
    display: inline-block;
    margin-right: .6rem;
    padding: .15rem .5rem;
    border: 1px solid var(--kk-border);
    border-radius: 999px;
    font-size: .85rem;
    opacity: .95;
  }
  #kkbc-board .jury::before{ content: "Jury "; opacity: .7; }
  #kkbc-board .pub::before{ content: "Public "; opacity: .7; }
}


/* ===== PATCH v1.3 — force white text on dark background ===== */
#kkbc-board, #kkb-board{
  --kk-fg:#fff;
  --kk-dim:rgba(255,255,255,.85);
  --kk-border:rgba(255,255,255,.2);
  color: var(--kk-fg);
}
#kkbc-board .kkbc-row, #kkbc-board .kkbc-row span,
#kkb-board .kkb-row, #kkb-board .kkb-row span{
  color: var(--kk-fg);
}
#kkbc-board .kkbc-head, #kkbc-board .kkbc-header,
#kkb-board .kkb-head{ color: var(--kk-fg); opacity:.95; }

/* labels on mobile */
@media (max-width:640px){
  #kkbc-board .jury::before, #kkbc-board .pub::before{ color: var(--kk-dim); }
}

/* Keep rank #1 readable on yellow badge */
#kkbc-board .kkbc-rows .kkbc-header + .kkbc-row .rk,
#kkb-board .kkb-head + .kkb-row span:first-child{
  color:#1a1a1a !important;
}


/* ===== PATCH v1.4 — Console (#kkc) styling ===== */
#kkc{
  --kkc-fg:#fff;
  --kkc-border:rgba(255,255,255,.25);
  color:var(--kkc-fg);
}
#kkc p{ margin: .6rem 0; }
#kkc hr{ border:none; border-top:1px solid var(--kkc-border); margin:1rem 0; }

/* Inputs */
#kkc input[type="text"], #kkc input[type="number"],
#kkc input, #kkc textarea{
  appearance:none; -webkit-appearance:none;
  background: rgba(255,255,255,.06);
  color:#fff;
  border:1px solid var(--kkc-border);
  padding:.7rem 1rem;
  border-radius:12px;
  outline:none;
  transition: box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
#kkc input:focus, #kkc textarea:focus{
  border-color:#fff; box-shadow:0 0 0 3px rgba(255,255,255,.15);
}

/* Row with inputs + buttons */
#kkc p:nth-of-type(2){
  display:flex; flex-wrap:wrap; align-items:center; gap:.75rem;
}
#kkc #kkc-artist{ flex:1 1 360px; min-width:260px; }
#kkc #kkc-duration{ width:120px; text-align:center; }
#kkc p:nth-of-type(2) button{ margin-left:.25rem; }

/* Buttons */
#kkc button{
  cursor:pointer;
  border:1px solid var(--kkc-border);
  border-radius:999px;
  padding:.6rem 1.1rem;
  background: transparent;
  color:#fff;
  font-weight:700;
  transition: transform .05s ease, background .2s ease, border-color .2s ease, box-shadow .2s;
  box-shadow: inset 0 0 0 0 rgba(255,255,255,.15);
}
#kkc button:hover{ background: rgba(255,255,255,.08); border-color:#fff; }
#kkc button:active{ transform: translateY(1px); }

/* Primary/secondary feel */
#kkc #kkc-open{ box-shadow: inset 0 0 0 999px rgba(255,255,255,.06); }
#kkc #kkc-close{}

/* Reset buttons (preserve colors but improve contrast) */
#kkc #kkc-reset-current{
  background:#ffe08a !important; color:#1a1a1a !important; border-color:rgba(0,0,0,.05);
}
#kkc #kkc-reset-all{
  background:#ffb3b3 !important; color:#1a1a1a !important; border-color:rgba(0,0,0,.05);
}
#kkc #kkc-reset-current, #kkc #kkc-reset-all{
  font-weight:800; padding:.85rem 1.25rem; border-radius:999px;
}

/* Messages */
#kkc #kkc-msg{ color:#9CFFB0 !important; }
#kkc #kkc-reset-msg{ color:#FFB0B0 !important; }

/* Mobile */
@media (max-width:640px){
  #kkc{ max-width: 100% !important; }
  #kkc #kkc-artist{ flex:1 1 100%; }
  #kkc #kkc-duration{ flex:0 0 120px; }
  #kkc p:nth-of-type(2){ gap:.6rem; }
  #kkc button{ width:auto; }
}


/* ===== PATCH v1.5 — Spinner + Ripple for #kkc buttons ===== */
#kkc button{ position: relative; overflow: hidden; }
#kkc button.is-loading{
  pointer-events:none; opacity:.85;
}
#kkc button.is-loading::after{
  content:""; position:absolute; right:.9rem; top:50%; transform:translateY(-50%);
  width:1em; height:1em;
  border:2px solid rgba(255,255,255,.7);
  border-right-color: transparent;
  border-radius:50%;
  animation: kk-spin .8s linear infinite;
}
@keyframes kk-spin{ to{ transform: translateY(-50%) rotate(360deg);} }

/* Click ripple */
#kkc .kkc-ripple{
  position:absolute; border-radius:50%; pointer-events:none;
  transform: scale(0); opacity:.35; background: currentColor;
  animation: kkc-ripple .5s ease-out; mix-blend-mode: screen;
}
@keyframes kkc-ripple{
  to{ transform: scale(2.8); opacity: 0; }
}


/* ===== PATCH v1.6 — spacing between console buttons ===== */

/* Row with "Ouvrir le vote" + "Clore" */
#kkc p:nth-of-type(2){
  display:flex !important;
  flex-wrap:wrap !important;
  align-items:center !important;
  gap:.9rem !important;
}
#kkc p:nth-of-type(2) > button{ margin:0 !important; }

/* Reset buttons stacked with space */
#kkc p:nth-of-type(5){
  display:flex !important;
  flex-direction:column !important;
  align-items:flex-start !important;
  gap:.7rem !important;
}
/* Fallback spacing if nth-of-type varies */
#kkc #kkc-reset-all{ margin-top:.7rem !important; }

@media (max-width:640px){
  #kkc p:nth-of-type(2){ gap:.7rem !important; }
}
