/* css/time_trial_special.css */

/* scoped */
.ttSpecial{
  background: #070707;
  min-height: calc(100vh - 70px);
  padding: 18px 16px 24px;
  color: #fff;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* grid like screen2 */
.ttGrid{
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1200px){
  .ttGrid{ grid-template-columns: 1fr; }
  .ttRight{ position: static; }
}

.ttCard{
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  overflow: hidden;
}

.ttLeft{ min-width: 0; }
.ttRight{
  position: sticky;
  top: 88px; /* header height-ish */
  display: grid;
  gap: 12px;
}

/* HUD */
.raceHud{
  padding: 14px 14px 12px;
  margin-bottom: 12px;
}
.hudTop{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.hudTitle{
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hudIcon{ opacity: .9; }
.hudMe{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  opacity: .95;
}
.hudMeItem b{ font-family: "Orbitron", sans-serif; }

.hudCols{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px){
  .hudCols{ grid-template-columns: 1fr; }
}

.hudColTitle{
  font-weight: 800;
  opacity: .9;
  margin-bottom: 6px;
}
.hudList{
  display: grid;
  gap: 8px;
  min-height: 38px;
}
.hudNote{
  margin-top: 10px;
  font-size: 13px;
  opacity: .75;
}

/* rows (used by game_special.js) */
.raceHud__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.06);
}
.raceHud__left{
  display:flex;
  gap:10px;
  align-items:center;
  min-width: 0;
}
.raceHud__pos{
  font-family:"Orbitron", sans-serif;
  font-weight:900;
  opacity:.95;
  min-width: 44px;
}
.raceHud__name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 220px;
  font-weight:700;
}
.raceHud__right{
  display:flex;
  align-items:center;
  gap:10px;
  font-family:"Orbitron", sans-serif;
}
.raceHud__time{ opacity:.92; }
.raceHud__gap{ opacity:.78; }

/* canvas wrap */
.ttCanvasWrap{ margin-bottom: 12px; }
.ttCanvasHeader{
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.ttTrackLine{
  display: grid;
  gap: 2px;
}
.ttTrackName{
  font-weight: 900;
  font-family: "Orbitron", sans-serif;
}
.ttPlayerName{
  font-size: 13px;
  opacity: .8;
}
.ttBackLink{
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  opacity: .9;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.2);
}
.ttBackLink:hover{ opacity: 1; }

/* canvas */
#game{
  display: block;
  width: 100%;
  height: auto;
  background: #0c0c0c;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* bottom bar under canvas */
.ttBottomBar{
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
}
@media (max-width: 720px){
  .ttBottomBar{ grid-template-columns: 1fr; }
}

.ttTimes{
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ttTimes .sep{ opacity: .35; }
.ttStatus{
  grid-column: 1 / -1;
  font-size: 13px;
  opacity: .8;
}
.ttRestartBtn{
  justify-self: end;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, #ff3a2f, #b50b05);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}
.ttRestartBtn:hover{ filter: brightness(1.05); }

/* TOP20 PB belt */
.ttTop20{
  padding: 12px 14px 14px;
}
.ttTop20Header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom: 10px;
}
.ttTop20Title{
  font-weight: 900;
  font-family: "Orbitron", sans-serif;
}
.ttTop20Note{
  font-size: 12px;
  opacity: .65;
}
.ttTop20Row{
  display:flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.ttTop20Row::-webkit-scrollbar{ height: 8px; }
.ttTop20Row::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
}
.ttMuted{ opacity: .7; }

.ttTopItem{
  min-width: 260px;
  max-width: 360px;
  flex: 0 0 auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  padding: 10px 12px;
  display:flex;
  justify-content:space-between;
  gap: 12px;
}
.ttTopLeft{
  display:flex;
  gap:10px;
  min-width: 0;
  align-items:center;
}
.ttTopPos{
  font-family:"Orbitron", sans-serif;
  font-weight:900;
  opacity:.95;
  min-width: 46px;
}
.ttTopName{
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ttTopRight{
  text-align:right;
  font-family:"Orbitron", sans-serif;
}
.ttTopPts{
  font-weight: 900;
  opacity: .95;
}
.ttTopTime{
  opacity:.85;
  font-weight:700;
}

/* right side cards */
.ttSideCard{
  padding: 14px;
}
.ttSideTitle{
  font-family:"Orbitron", sans-serif;
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 10px;
}
.ttSideMeta{
  display:grid;
  gap: 8px;
  margin-bottom: 10px;
}
.ttSideMetaRow{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  font-size: 13px;
  opacity: .92;
}
.ttSideMetaRow b{
  font-family:"Orbitron", sans-serif;
  font-weight: 900;
}
.ttControlsHint{
  margin-top: 10px;
  font-size: 12px;
  opacity: .75;
  line-height: 1.45;
}
.kbd{
  display:inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.24);
  font-weight: 900;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
}

.ttCtaBtn{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, #ff3a2f, #b50b05);
  border: 1px solid rgba(255,255,255,0.14);
}
.ttCtaBtn:hover{ filter: brightness(1.05); }

.ttWingCard{
  padding: 14px;
}
.ttWingTitle{
  font-family:"Orbitron", sans-serif;
  font-weight: 900;
  margin-bottom: 10px;
}
.ttWingRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 12px;
  font-size: 13px;
  opacity: .9;
}
.ttWingVal{
  font-family:"Orbitron", sans-serif;
  font-weight: 900;
}
.ttWingLabel{ font-weight: 800; }

.ttWingCard input[type="range"]{
  width: 100%;
  margin-top: 8px;
}

.ttSideActions{
  padding: 14px;
  display:grid;
  gap: 10px;
}
.ttSideRestart{
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
  color: #fff;
  cursor:pointer;
}
.ttSideRestart:hover{ background: rgba(0,0,0,0.36); }

.ttSideBack{
  text-align:center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  color:#fff;
  text-decoration:none;
  font-weight: 800;
  opacity: .9;
}
.ttSideBack:hover{ opacity: 1; }

/* touch controls */
.ttTouch{
  padding: 14px;
  display:none; /* pokaż na mobile */
}
@media (max-width: 900px){
  .ttTouch{ display:block; }
}
.ttTouchTitle{
  font-family:"Orbitron", sans-serif;
  font-weight: 900;
  margin-bottom: 10px;
}
.ttTouchGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ttTouchBtn{
  padding: 14px 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
  color: #fff;
  font-weight: 900;
  cursor:pointer;
}
.ttTouchBtn.isDown{
  outline: 2px solid rgba(255,0,0,0.8);
  box-shadow: 0 0 0 3px rgba(255,0,0,0.18);
}

/* optional: styles used by game_special.js fallback leaderboard list (screen1) */
.topItem{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.10);
}
.topItem__left{ display:flex; gap:10px; min-width:0; align-items:center; }
.topItem__pos{ font-family:"Orbitron", sans-serif; font-weight:900; min-width:46px; }
.topItem__name{ font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topItem__right{ text-align:right; font-family:"Orbitron", sans-serif; }
.topItem__pts{ font-weight:900; }
.topItem__time{ opacity:.85; }

/* highlight states (JS adds these classes) */
.is-me{ border-color: rgba(255,0,0,0.55) !important; box-shadow: 0 0 0 2px rgba(255,0,0,0.12) inset; }
.is-p1{ border-color: rgba(255,215,0,0.55) !important; }
.is-p2{ border-color: rgba(192,192,192,0.55) !important; }
.is-p3{ border-color: rgba(205,127,50,0.55) !important; }

/* =========================
   TOP 20 (PB) — nicer colors
   target: .ttTopItem inside #top20PB
   ========================= */

#top20PB.ttTop20Row{
  gap: 12px;
}

/* base card */
.ttTopItem{
  position: relative;
  border-radius: 18px;
  padding: 12px 14px;
  min-width: 270px;
  max-width: 360px;

  border: 1px solid rgba(255,255,255,0.10);
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.03) 45%, rgba(0,0,0,0.25) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0.38));
  box-shadow:
    0 14px 28px rgba(0,0,0,0.50),
    inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, filter .15s ease;
}

.ttTopItem:hover{
  transform: translateY(-1px);
  box-shadow:
    0 18px 34px rgba(0,0,0,0.58),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

/* subtle shine */
.ttTopItem::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: radial-gradient(70% 60% at 15% 0%, rgba(255,255,255,0.10), transparent 60%);
  pointer-events:none;
  opacity:.9;
}

/* content typography */
.ttTopPos{
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 15px;
  opacity: .95;
  letter-spacing: .2px;
}

.ttTopName{
  font-weight: 800;
  font-size: 15px;
}

.ttTopRight{
  font-family: "Orbitron", sans-serif;
}

.ttTopPts{
  font-weight: 900;
  font-size: 14px;
}

.ttTopTime{
  font-weight: 800;
  opacity: .92;
}

/* ===== Podium colors ===== */

/* #1 – gold */
.ttTopItem.is-p1{
  border-color: rgba(255, 214, 82, 0.55);
  background:
    radial-gradient(120% 140% at 10% 0%, rgba(255, 214, 82, 0.28) 0%, rgba(255, 214, 82, 0.10) 40%, rgba(0,0,0,0.30) 100%),
    linear-gradient(180deg, rgba(60,45,0,0.25), rgba(0,0,0,0.45));
}
.ttTopItem.is-p1 .ttTopPts{ color: rgba(255, 214, 82, 0.95); }

/* #2 – silver */
.ttTopItem.is-p2{
  border-color: rgba(210, 220, 235, 0.45);
  background:
    radial-gradient(120% 140% at 10% 0%, rgba(210, 220, 235, 0.22) 0%, rgba(210, 220, 235, 0.08) 40%, rgba(0,0,0,0.30) 100%),
    linear-gradient(180deg, rgba(25,30,40,0.28), rgba(0,0,0,0.45));
}
.ttTopItem.is-p2 .ttTopPts{ color: rgba(210, 220, 235, 0.95); }

/* #3 – bronze */
.ttTopItem.is-p3{
  border-color: rgba(214, 143, 78, 0.50);
  background:
    radial-gradient(120% 140% at 10% 0%, rgba(214, 143, 78, 0.24) 0%, rgba(214, 143, 78, 0.08) 40%, rgba(0,0,0,0.30) 100%),
    linear-gradient(180deg, rgba(55,28,10,0.30), rgba(0,0,0,0.45));
}
.ttTopItem.is-p3 .ttTopPts{ color: rgba(214, 143, 78, 0.95); }

/* ===== Top10 highlight (subtle red accent) ===== */
.ttTopItem.is-top10{
  border-color: rgba(255, 60, 60, 0.22);
}

/* ===== My result highlight (red ring + glow) ===== */
.ttTopItem.is-me{
  border-color: rgba(255, 40, 40, 0.70) !important;
  box-shadow:
    0 18px 38px rgba(0,0,0,0.62),
    0 0 0 2px rgba(255, 40, 40, 0.20) inset,
    0 0 22px rgba(255, 40, 40, 0.18);
}

/* optional: tiny badge dot for "me" */
.ttTopItem.is-me::after{
  content:"";
  position:absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 40, 40, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 40, 40, 0.18);
}

/* responsive: tighter cards */
@media (max-width: 600px){
  .ttTopItem{ min-width: 240px; }
}

.lapBubble{
  position:absolute;
  left: 22px;
  bottom: 118px; /* nad dolnym paskiem z czasami */
  z-index: 40;

  min-width: 260px;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 16px;

  border: 1px solid rgba(255,255,255,0.14);
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.04) 42%, rgba(0,0,0,0.35) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0.55));
  box-shadow: 0 18px 40px rgba(0,0,0,0.60);
  backdrop-filter: blur(6px);

  color:#fff;
  transform: translateY(10px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: auto;
}

.ttCanvasWrap{ position: relative; } /* ważne, żeby absolute liczyło się do wrappera */

.lapBubble.is-show{
  opacity: 1;
  transform: translateY(0);
}

.lapBubble__title{
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 14px;
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 6px;
}

.lapBubble__time{
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .2px;
}

.lapBubble__delta{
  margin-top: 6px;
  font-size: 13px;
  opacity: .92;
}

.lapBubble__delta b{
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
}

.lapBubble.is-good{
  border-color: rgba(80, 255, 160, 0.42);
  box-shadow: 0 18px 40px rgba(0,0,0,0.60), 0 0 18px rgba(80,255,160,0.12);
}
.lapBubble.is-bad{
  border-color: rgba(255, 80, 80, 0.42);
  box-shadow: 0 18px 40px rgba(0,0,0,0.60), 0 0 18px rgba(255,80,80,0.12);
}
.lapBubble.is-pb{
  border-color: rgba(255, 214, 82, 0.55);
  box-shadow: 0 18px 40px rgba(0,0,0,0.60), 0 0 22px rgba(255,214,82,0.14);
}

.lapBubble__close{
  position:absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.25);
  color:#fff;
  cursor:pointer;
  display:grid;
  place-items:center;
  opacity: .85;
}
.lapBubble__close:hover{ opacity: 1; }

@media (max-width: 720px){
  .lapBubble{
    left: 12px;
    right: 12px;
    min-width: unset;
    bottom: 122px;
  }
}

.ttCanvasWrap{ position:relative; }