/* ============================================================
   ChaoKart family extraction
   Safe-first pass: main arena, HUD, and CK pregame family only.
   ============================================================ */

/* chaokart_arena_hud_and_pregame_foundation */
/* ============================
   ChaoKart HUD / setup strip restoration
   ============================ */
#chaokart-arena-panel > .panel-body {
  position: relative;
  padding: 0 !important;
  overflow: hidden;
}

/* chaokart_pregame_body_layout */
#ck-pregame-panel > .panel-body {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
}

#ck-pregame-panel .ck-pregame-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 16px;
}

#ck-pregame-panel .ck-pregame-start-row {
  margin-top: auto;
}

/* chaokart_hud_cleanup */
#chaokart-hud {
  top: 14px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  min-height: 0;
  display: block;
}
#ck-place-display {
  position: absolute;
  left: 0;
  bottom: 4px;
  min-width: 148px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18,28,43,0.92), rgba(8,14,24,0.96));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 8px 20px rgba(0,0,0,0.26);
  color: #fff7cd;
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-align: center;
}
.ck-hud-centerband {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(12,23,37,0.92), rgba(6,12,22,0.96));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 8px 20px rgba(0,0,0,0.24);
}
.ck-hud-metric {
  min-width: 156px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: #edf6ff;
  font-weight: 800;
  font-size: 26px;
}
.ck-hud-metric .ck-label {
  color: #fff0ab;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ck-hud-item-wrap {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(29,45,67,0.96), rgba(10,18,29,0.98));
  border: 1px solid rgba(173, 211, 252, 0.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
#ck-item-icon {
  width: 56px;
  height: 56px;
}
#ck-standings-strip {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 76px;
}
#ck-standings-strip.hidden { display: none !important; }
#ck-standings-strip .ck-mp-slot {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14,24,38,0.94), rgba(6,11,19,0.98));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  overflow: hidden;
}
#ck-standings-strip .ck-mp-slot.self {
  border-color: rgba(255, 238, 156, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 238, 156, 0.28), 0 6px 16px rgba(0,0,0,0.25);
}
#ck-standings-strip .ck-mp-chao {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
}
#ck-standings-strip .ck-mp-place {
  position: absolute;
  left: 4px;
  bottom: 3px;
  min-width: 18px;
  color: #fff5c8;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
#ck-standings-strip .ck-mp-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  padding-left: 22px;
  padding-right: 4px;
  color: #dcecff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
#chaokart-mp-strip,
#chaokart-hud .ck-hud-left,
#chaokart-hud .ck-hud-right,
#chaokart-hud .ck-hud-row,
#chaokart-mp-strip .ck-mp-top,
#chaokart-mp-strip .ck-mp-bottom,
#chaokart-mp-strip .ck-mp-left,
#chaokart-mp-strip .ck-mp-kart,
#chaokart-mp-strip .ck-mp-kart-label,
#chaokart-mp-strip .ck-mp-rings {
  all: unset;
}

/* chaokart_pregame_late_authority */
#ck-pregame-panel {
  padding: 0 !important;
  pointer-events: auto;
}

#ck-pregame-panel > .panel-body {
  overflow: auto;
}

#ck-pregame-panel .ck-pregame-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 16px;
  padding: 20px;
}

#ck-pregame-panel .ck-pregame-strips {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

#ck-pregame-panel .ck-pregame-strip,
#ck-pregame-panel .ck-pregame-start-row,
#ck-pregame-panel .ck-start-btn,
#ck-custom-map-name {
  min-width: 0;
}

#ck-pregame-panel .ck-pregame-strip {
  min-height: 0;
}

#ck-pregame-panel .ck-pregame-start-row {
  margin-top: auto;
  flex: 0 0 auto;
}

/* ===== moved from 03-panel-contract.css: ChaoKart HUD / pregame compat ===== */
/* ============================
   ChaoKart HUD / setup strip restoration
   ============================ */
#chaokart-canvas {
  display: block;
  width: 100%;
  height: calc(100% - 8px);
}
#chaokart-hud,
#chaokart-kartselect,
#chaokart-mp-strip {
  position: absolute;
  z-index: 8;
}
#chaokart-hud {
  top: 10px;
  left: 10px;
  right: 10px;
  min-height: 52px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
}
#chaokart-kartselect {
  inset: 70px 0 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: auto;
  z-index: 20;
}
#chaokart-mp-strip {
  top: 72px;
  left: 10px;
  width: 220px;
  right: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#chaokart-arena-panel.ck-mp-strip-on #chaokart-mp-strip {
  top: 72px;
}
#chaokart-hud .ck-hud-left,
#chaokart-hud .ck-hud-right,
#chaokart-mp-strip,
#chaokart-mp-strip .ck-mp-slot {
  background: rgba(8, 18, 32, 0.88);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.28);
}
#chaokart-hud .ck-hud-left,
#chaokart-hud .ck-hud-right {
  padding: 8px 10px;
}
#chaokart-hud .ck-hud-left {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  gap: 10px;
}
#chaokart-hud .ck-hud-right {
  position: relative;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}
#chaokart-hud .ck-hud-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: 700;
}
#chaokart-hud .ck-label,
#chaokart-mp-strip .ck-mp-place {
  color: #fff6cf;
  font-weight: 800;
  letter-spacing: 0.02em;
}
#ck-item-icon {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}
#ck-pregame-panel.hidden {
  display: none !important;
}
#ck-pregame-panel .ck-pregame-strips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
#ck-pregame-panel .ck-pregame-strip {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.32);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 10px;
}
#ck-pregame-panel .ck-pregame-title {
  color: #ffe66d;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
#ck-pregame-panel button {
  min-height: 54px;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
}
#ck-pregame-panel .ck-pregame-start-row {
  display: flex;
  justify-content: center;
  padding-top: 18px;
}
#ck-pregame-panel .ck-start-btn {
  min-width: 240px;
  min-height: 58px;
  font-size: 24px;
}
#ck-custom-map-name {
  min-height: 26px;
  margin-top: auto;
  color: #a9d6ff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}
#chaokart-mp-strip .ck-mp-slot {
  padding: 8px 10px;
}
#chaokart-mp-strip .ck-mp-top,
#chaokart-mp-strip .ck-mp-bottom,
#chaokart-mp-strip .ck-mp-left {
  display: flex;
  align-items: center;
}
#chaokart-mp-strip .ck-mp-top,
#chaokart-mp-strip .ck-mp-bottom {
  justify-content: space-between;
}
#chaokart-mp-strip .ck-mp-bottom {
  margin-top: 6px;
}
#chaokart-mp-strip .ck-mp-left {
  gap: 6px;
  min-width: 0;
}
#chaokart-mp-strip .ck-mp-name {
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
#chaokart-mp-strip .ck-mp-place {
  font-size: 18px;
  line-height: 1;
}
#chaokart-mp-strip .ck-mp-rings,
#chaokart-mp-strip .ck-mp-kart-label {
  color: #d8e6ff;
  font-size: 12px;
  font-weight: 700;
}
#chaokart-mp-strip .ck-mp-chao {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  flex: 0 0 auto;
}
#chaokart-mp-strip .ck-mp-kart {
  width: 32px;
  height: 18px;
  object-fit: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}
#chaokart-mp-strip .ck-mp-slot.self {
  border-color: rgba(255, 238, 156, 0.75);
  box-shadow: 0 0 0 1px rgba(255, 238, 156, 0.35), 0 4px 16px rgba(0,0,0,0.28);
}
#ck-message {
  position: absolute;
  left: 50%;
  top: 132px;
  transform: translateX(-50%);
  z-index: 10;
}


@media (max-width: 1500px) {
  #ck-pregame-panel .ck-pregame-strips {
    grid-template-columns: 1fr;
  }

  #ck-pregame-panel .ck-pregame-strip {
    min-height: 180px;
  }
}
