/* Family Kart */
.kt-track { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #46a05a; border-radius: 12px; padding: 6px; }
.kt-track img { width: 86px; height: 48px; object-fit: cover; border-radius: 8px; }
.kt-track b { display: block; font-size: 15px; } .kt-track small { color: var(--muted); font-size: 12px; }
.kt-track b.kt-solo { font-size: 22px; letter-spacing: .5px; }
.kt-mine { font-size: 13px; color: var(--muted); text-align: center; } .kt-mine b { color: var(--ink); }
.kt-about p { font-size: 14px; line-height: 1.45; margin: 0 0 8px; }
.kt-soon { color: var(--muted); font-size: 13px !important; }

.kt-game { display: flex; flex-direction: column; gap: 6px; max-width: 900px; margin: 0 auto; background: #e9dfc9; border-radius: 18px; padding: 8px;
  box-shadow: 6px 9px 0 rgba(60,45,30,.18); user-select: none; -webkit-user-select: none; touch-action: none; }
.kt-game[hidden] { display: none; }
.kt-lap { font-weight: 900; font-size: 16px; background: #46a05a; color: #fff; border-radius: 8px; padding: 2px 9px; }
.kt-lap:empty { display: none; }
.kt-time { flex: 1; font: 800 18px ui-monospace, Menlo, Consolas, monospace; }
.kt-best { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.kt-screen { position: relative; border-radius: 14px; overflow: hidden; border: 3px solid #3b2f22; background: #8fd0ff; aspect-ratio: 5 / 3; }
#kCanvas, #k3d, #kFx { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.kt-speed { position: absolute; left: 8px; bottom: 6px; font: 900 16px Ubuntu, sans-serif; color: #fff; text-shadow: 0 2px 0 #000, 0 0 4px #000; }
.k-flash { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font: 900 54px Ubuntu, sans-serif; color: #ffe066;
  -webkit-text-stroke: 3px #3b2f22; text-shadow: 0 5px 0 #3b2f22; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s; pointer-events: none; }
.k-flash.on { opacity: 1; transform: scale(1); }
.kt-wrong { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; top: 14%; background: #d65c54; color: #fff; font-weight: 900; font-size: 18px;
  padding: 4px 12px; border-radius: 10px; border: 2px solid #fff; animation: pop .5s infinite alternate; }
.kt-wrong[hidden] { display: none; }
.kt-load { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15em; letter-spacing: .02em; color: #fff; background: radial-gradient(ellipse at center, #2a2236 0%, #120e18 100%); }
.kt-balrog { height: 120px; image-rendering: pixelated; animation: ktBalrog 2.6s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }   /* 👹 Balrog dances left and right while the room loads (he faces the way he moves) */
@keyframes ktBalrog { 0% { transform: translateX(-70px) scaleX(1); } 49.9% { transform: translateX(70px) scaleX(1); } 50% { transform: translateX(70px) scaleX(-1); } 99.9% { transform: translateX(-70px) scaleX(-1); } 100% { transform: translateX(-70px) scaleX(1); } }
.kt-dots::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: ktDots 1.2s steps(4) infinite; }
@keyframes ktDots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.kt-load[hidden] { display: none; }
.kt-result { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92%, 360px); }
.k-laps { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; font: 700 14px ui-monospace, Menlo, Consolas, monospace; }
.k-laps .b { color: #2e7d32; } .k-laps .b::after { content: " ⚡"; }
@media (hover: hover) and (pointer: fine) { .kt-pad { display: none; } }
@media (max-width: 900px) {
  .kt.racing { padding: 4px; }
  .kt.racing .kt-h { display: none; }
  .kt-game { min-height: calc(100dvh - 8px); padding: 4px; border-radius: 12px; }
}
@media (max-width: 900px) and (orientation: portrait) { .kt-screen { aspect-ratio: auto; flex: 1 1 auto; min-height: 220px; } }
@media (max-width: 900px) and (orientation: landscape) { .kt-screen { width: min(100%, calc((100dvh - 150px) * 5 / 3)); margin: 0 auto; } }
@media (max-width: 560px) { .k-flash { font-size: 40px; } .kt-best { display: none; } }
.kt-board li { display: flex; align-items: center; gap: 6px; }
.kt-board img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.kt-board b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-board span { font: 700 13px ui-monospace, Menlo, Consolas, monospace; } .kt-board small { color: var(--muted); font-size: 11px; }
.k-rank { color: var(--ink) !important; font-weight: 700; }
.kt-rotate { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: #2d2832; color: #fff; font: 800 20px Ubuntu, sans-serif; text-align: center; padding: 20px; }
.kt-rotate span { font-size: 64px; animation: ktspin 1.6s ease-in-out infinite; }
@keyframes ktspin { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
.kt-rotate[hidden] { display: none; }
/* phones sideways: the track fills the screen, buttons sit over its bottom corners */
@media (pointer: coarse) and (orientation: landscape) {
  .kt.racing .kt-game { position: fixed; inset: 0; z-index: 50; max-width: none; min-height: 0; margin: 0; padding: 0; border-radius: 0; gap: 0; box-shadow: none; }
  .kt.racing .kt-screen { position: absolute; inset: 0; width: auto; margin: 0; border: 0; border-radius: 0; aspect-ratio: auto; }
  .kt.racing .kt-speed { left: 50%; transform: translateX(-50%); bottom: 12px; }
}
.kt-full { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; top: 64%; z-index: 4; background: rgba(45,40,50,.85); color: #fff; font-weight: 800;
  padding: 5px 12px; font-size: 14px; border-radius: 12px; pointer-events: none; animation: pop .6s infinite alternate; white-space: nowrap; }
.kt-full[hidden] { display: none; }
.kt-bag { font-weight: 800; font-size: 14px; white-space: nowrap; }
#kFx { pointer-events: none; image-rendering: auto; }
/* arcade HUD over the track (Mario Kart PC style) */
.kt-hud-l { position: absolute; left: 8px; top: 8px; display: flex; gap: 8px; align-items: flex-start; z-index: 2; pointer-events: none; }
.kt-item { width: 54px; height: 54px; border-radius: 10px; background: rgba(20,20,30,.55); border: 3px solid #fff; box-shadow: 0 0 0 2px #2d2832;
  display: flex; align-items: center; justify-content: center; position: relative; }
.kt-item img { width: 36px; height: 36px; image-rendering: pixelated; }
.kt-item b { position: absolute; right: -6px; bottom: -6px; background: #ffd23f; color: #2d2832; border: 2px solid #2d2832; border-radius: 9px; font: 900 13px Ubuntu, sans-serif; padding: 0 5px; }
.kt-item.empty img { opacity: .25; }
.kt-hudtxt { display: flex; flex-direction: column; gap: 2px; }
.kt-lap, .kt-time, .kt-bag, .kt-best { font: 900 22px Ubuntu, sans-serif; color: #fff; -webkit-text-stroke: 1.5px #2d2832; paint-order: stroke; text-shadow: 0 3px 0 #2d2832; background: none; padding: 0; }
.kt-lap { font-size: 20px; } .kt-bag { font-size: 15px; -webkit-text-stroke: 1px #2d2832; }
.kt-hud-r { position: absolute; right: 10px; top: 6px; text-align: right; z-index: 2; pointer-events: none; }
.kt-time { font-size: 30px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.kt-best { font-size: 13px; -webkit-text-stroke: 1px #2d2832; text-shadow: 0 2px 0 #2d2832; color: #ffe8a3; }
@media (max-width: 560px), (max-height: 420px) { .kt-time { font-size: 22px; } .kt-lap { font-size: 16px; } .kt-item { width: 44px; height: 44px; } .kt-item img { width: 30px; height: 30px; } }
.kt-pos { font: 900 46px Ubuntu, sans-serif; color: #fff; -webkit-text-stroke: 2px #2d2832; paint-order: stroke; text-shadow: 0 4px 0 #2d2832; line-height: 1; margin-top: 2px; }
.kt-pos.p1 { color: #ffd23f; } .kt-pos.p2 { color: #e6e6f0; } .kt-pos.p3 { color: #f0a868; }
@media (max-width: 560px), (max-height: 420px) { .kt-pos { font-size: 32px; } }

/* touch controls: round see-through game buttons in the Family colours (red, gold, white) */
.kt-pad { position: relative; height: 150px; }
@media (hover: hover) and (pointer: fine) { .kt-pad { display: none; } }
.kt-pad > * { position: absolute; touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.kt-pad button { border-radius: 50%; cursor: pointer; font: 900 13px Ubuntu, sans-serif; letter-spacing: .5px; color: #fff; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-shadow: 0 1px 2px rgba(0,0,0,.6); transition: transform .06s; }
.kt-pad button.on { transform: scale(.92); filter: brightness(1.15); }
.kt-stick { left: 14px; bottom: 12px; width: 168px; height: 76px; border-radius: 38px; background: rgba(25,18,30,.38); border: 2px solid rgba(255,255,255,.75);
  box-shadow: 0 0 0 2px rgba(205,150,30,.7), inset 0 2px 8px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.kt-stick b { font-size: 16px; color: rgba(255,255,255,.75); pointer-events: none; }
.kt-stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #ff7a7f, #c8232c 55%, #7a1418); border: 3px solid #ffd75e; box-shadow: 0 3px 6px rgba(0,0,0,.4), inset 0 -3px 0 rgba(0,0,0,.2); }
.kt-stick.on { background: rgba(25,18,30,.5); }
.kt-pad .drf { right: 14px; bottom: 12px; width: 92px; height: 92px; font-size: 15px;
  background: radial-gradient(circle at 35% 28%, #ff6b72, #c8232c 55%, #7a1418); border: 3px solid #ffd75e; box-shadow: 0 0 0 2px rgba(122,20,24,.8), 0 4px 10px rgba(0,0,0,.35); }
.kt-pad .drf small { font-size: 20px; line-height: 1; }
.kt-pad .brk { right: 118px; bottom: 10px; width: 62px; height: 62px; font-size: 11px; background: rgba(25,18,30,.45); border: 2px solid rgba(255,255,255,.8); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.kt-pad .itm { right: 84px; bottom: 102px; width: 66px; height: 66px; background: rgba(25,18,30,.45); border: 3px solid #ffd75e; box-shadow: 0 0 0 2px rgba(122,20,24,.7), 0 2px 6px rgba(0,0,0,.3); }
.kt-pad .itm img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.kt-pad .itm span { font-size: 26px; color: rgba(255,255,255,.55); }
.kt-pad .itm img:not([hidden]) + span { display: none; }
.kt-pad .itm:not(:disabled) { animation: ktglow 1s ease-in-out infinite alternate; }
@keyframes ktglow { to { box-shadow: 0 0 0 2px rgba(122,20,24,.7), 0 0 16px 4px rgba(255,215,94,.8); } }
.kt-pad button:disabled { cursor: default; }
/* below the track (upright screens) the pad sits on a dark strip; sideways it floats over the track */
.kt-pad { background: #2d2832; border-radius: 14px; }
@media (pointer: coarse) and (orientation: landscape) {
  .kt.racing .kt-pad { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; z-index: 3; background: none; pointer-events: none; }
  .kt.racing .kt-pad > * { pointer-events: auto; }
  .kt.racing .kt-pad .itm, .kt.racing .kt-pad .brk, .kt.racing .kt-stick { opacity: .92; }
}
/* small round buttons at the top */
.kt-btns { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.kt-ibtn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: rgba(25,18,30,.45); color: #fff;
  font: 900 15px Ubuntu, sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.kt-ibtn:hover { background: rgba(200,35,44,.8); }
.kt-item span { font: 900 24px Ubuntu, sans-serif; color: rgba(255,255,255,.5); }
.kt-item img:not([hidden]) + span { display: none; }
.kt-item { border-color: #ffd75e; box-shadow: 0 0 0 2px #7a1418; }
.kt-bag img { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -3px; margin-right: 3px; }
.kt-diff { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.kt-diff span { font-weight: 800; font-size: 13px; color: var(--muted); }
.kt-diff button { border: 2px solid var(--edge); background: #fff; border-radius: 10px; padding: 6px 10px; font: 700 14px Ubuntu, sans-serif; cursor: pointer; color: var(--ink); }
.kt-diff button.on { border-color: #c8232c; background: #fff1e6; box-shadow: 0 0 0 2px #e8b43a; }
.k-diff { font-weight: 800; color: var(--muted) !important; margin-top: -2px !important; }
.kt-warn { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: 90%; top: 24%; z-index: 4; text-align: center;
  background: rgba(200,35,44,.9); color: #fff; font: 900 15px Ubuntu, sans-serif; padding: 5px 12px; border-radius: 10px; border: 2px solid #ffd75e; animation: pop .35s infinite alternate; pointer-events: none; }
.kt-warn { top: 22%; }
.kt-warn.arm { font-size: 18px; background: rgba(90,10,20,.92); }
.kt-warn[hidden] { display: none; }
.kt-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kt-modes button { border: 2px solid var(--edge); background: #fff; border-radius: 12px; padding: 8px 4px; font: 800 14px Ubuntu, sans-serif; cursor: pointer; color: var(--ink); }
.kt-modes button.on { border-color: #c8232c; background: #c8232c; color: #fff; box-shadow: 0 0 0 2px #e8b43a; }
.kt-modenote { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: -4px; }
.kt-diff[hidden] { display: none; }
.kt-result.wide { width: min(94%, 430px); max-height: 92%; overflow-y: auto; padding: 10px; }
.k-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; }
.k-table td { padding: 2px 4px; text-align: left; white-space: nowrap; }
.k-table td:first-child { font-weight: 900; width: 34px; }
.k-table td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.k-table td:nth-child(4) { font-family: ui-monospace, Menlo, Consolas, monospace; text-align: right; }
.k-table td.pts { font-weight: 900; color: #b07800; text-align: right; }
.k-table img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; }
.k-table tr.you { background: #fff1e6; outline: 2px solid #c8232c; }
.k-table tr:nth-child(1) td:first-child { color: #c99a10; } .k-table tr:nth-child(2) td:first-child { color: #8a8a99; } .k-table tr:nth-child(3) td:first-child { color: #b0672a; }
.pd { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 6px 0; }
.pd-step { display: flex; flex-direction: column; align-items: center; width: 31%; }
.pd-step img { height: 54px; image-rendering: pixelated; animation: pop .6s infinite alternate; }
.pd-step b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-step small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pd-block { width: 100%; background: linear-gradient(#e8b43a, #b07812); color: #fff; font: 900 24px Ubuntu, sans-serif; display: flex; align-items: center; justify-content: center;
  border-radius: 8px 8px 0 0; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.pd-step.p1 .pd-block { background: linear-gradient(#ffd75e, #c8962a); } .pd-step.p2 .pd-block { background: linear-gradient(#e6e6f0, #9a9aaa); } .pd-step.p3 .pd-block { background: linear-gradient(#f0a868, #a8602a); }
.k-conf { position: absolute; top: -10px; width: 7px; height: 11px; z-index: 6; pointer-events: none; animation: kconf 2.5s linear forwards; }
@keyframes kconf { to { transform: translateY(110vh) rotate(720deg); } }
.kt-item2 { width: 34px; height: 34px; margin-left: -6px; border-radius: 8px; background: rgba(20,20,30,.55); border: 2px solid #ffd75e; display: flex; align-items: center; justify-content: center; align-self: flex-start; margin-top: 26px; }
.kt-item2[hidden] { display: none; }
.kt-item2 img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.kt-pos.final { animation: kfinal .45s ease-in-out infinite alternate; }
@keyframes kfinal { to { transform: scale(1.18); color: #ff6b6b; } }
.kt-trackpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kt-trackpick[hidden] { display: none; }
.kt-trackpick button { border: 2px solid var(--edge); background: #fff; border-radius: 10px; padding: 6px 4px; font: 700 13px Ubuntu, sans-serif; cursor: pointer; color: var(--ink); }
.kt-trackpick button.on { border-color: #cd961e; background: #fff4d6; box-shadow: 0 0 0 2px #e8b43a; }
.kt-modes button { font-size: 12.5px; }
.kt-room { display: flex; flex-direction: column; gap: 8px; background: #fff8ef; border: 2px solid #e3c3a8; border-radius: 12px; padding: 10px; }
.kt-room[hidden] { display: none; }
.kt-join { display: flex; gap: 6px; } .kt-join input { flex: 1; font: 700 16px Ubuntu, sans-serif; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--edge); text-transform: uppercase; }
.kt-roomhead { font-size: 14px; } .kt-roomhead b { font-size: 16px; }
.kt-plist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.kt-pl { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--edge); border-radius: 8px; padding: 3px 6px; font-size: 13px; min-width: 0; }
.kt-pl.me { border-color: #c8232c; box-shadow: 0 0 0 1px #c8232c; }
.kt-pl img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.kt-pl b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-boardtabs { display: flex; gap: 6px; margin: -4px 0 6px; }
.kt-boardtabs button { border: 2px solid var(--edge); background: #fff; border-radius: 10px; padding: 5px 10px; font: 700 13px Ubuntu, sans-serif; cursor: pointer; color: var(--ink); }
.kt-boardtabs button.on { border-color: #c8232c; background: #c8232c; color: #fff; }
.kt-boardhead { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
/* How to drive: a visual guide */
.hd { display: grid; gap: 10px; margin-bottom: 14px; }
.hd-card { background: #fff; border: 1px solid var(--edge); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.hd-card h4 { margin: 0; font-size: 15px; } .hd-card h4 small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.hd-card > small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.hd-keys { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; font-weight: 700; }
.hd-keys span { display: flex; align-items: center; gap: 3px; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; background: #f4f1ea;
  border: 1px solid #b8ad9c; box-shadow: 0 2px 0 #b8ad9c; font: 800 12px Ubuntu, sans-serif; color: var(--ink); margin-right: 2px; }
kbd.w { min-width: 54px; }
.hd-phone { display: grid; grid-template-columns: 88px 1fr 30px 34px 44px; align-items: center; gap: 5px; background: #2d2832; border-radius: 10px; padding: 7px 9px; }
.hd-phone i { font-style: normal; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font: 800 8px Ubuntu, sans-serif; }
.hd-phone .j { border-radius: 18px; height: 30px; border: 2px solid rgba(255,255,255,.7); gap: 6px; font-size: 9px; color: rgba(255,255,255,.7); }
.hd-phone .j b { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff7a7f, #c8232c 60%); border: 2px solid #ffd75e; }
.hd-phone .it { width: 30px; height: 30px; border: 2px solid #ffd75e; font-size: 13px; }
.hd-phone .br { width: 34px; height: 34px; border: 2px solid #fff; }
.hd-phone .dr { width: 44px; height: 44px; background: radial-gradient(circle at 35% 28%, #ff6b72, #c8232c 60%); border: 2px solid #ffd75e; font-size: 9px; }
.hd-graph { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 0 4px; border-bottom: 2px solid var(--edge); }
.hd-bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; font-size: 12px; }
.hd-bar i { width: 70%; height: var(--h); border-radius: 6px 6px 0 0; background: var(--c); box-shadow: 0 0 10px var(--c); }
.hd-bar i.rb { background: linear-gradient(#ff5a5a, #ffb02e, #ffe066, #6eaa64, #4aa8ff, #a64bd6); box-shadow: 0 0 10px #c86bff; }
.hd-bar em { font-style: normal; font-weight: 800; font-size: 11px; color: var(--ink); }
.hd-bar b { font-size: 12px; } .hd-bar small { color: var(--muted); font-size: 11px; font-weight: 700; }
.hd-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hd-tiles div, .hd-items div { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: #fbf8f1; border: 1px solid var(--edge); border-radius: 10px; padding: 6px 4px; }
.hd-tiles span { font-size: 22px; line-height: 28px; height: 28px; }
.hd-tiles img, .hd-items img { height: 30px; max-width: 46px; object-fit: contain; image-rendering: pixelated; }
.hd-tiles b, .hd-items b { font-size: 12px; } .hd-tiles small, .hd-items small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.hd-tiles .ramp, .hd-tiles .boost { display: block; width: 34px; height: 24px; margin: 2px 0; border-radius: 4px;
  background: repeating-linear-gradient(135deg, #3d8de0 0 6px, #fff 6px 12px); border: 2px solid #1e4f9a; }
.hd-tiles .boost { background: repeating-linear-gradient(135deg, #ff7a12 0 6px, #ffd84a 6px 12px); border-color: #c8501a; }
.hd-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hd-items.haz { grid-template-columns: repeat(5, 1fr); }
.hd-items .rock { display: block; width: 34px; height: 26px; margin: 2px 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a59c8c, #696154 60%, #3e3830); }
.hd-items span { font-size: 24px; line-height: 30px; }
@media (max-width: 420px) { .hd-items, .hd-items.haz { grid-template-columns: repeat(3, 1fr); } .hd-phone { grid-template-columns: 80px 1fr 28px 32px 40px; } }
/* cups */
.kt-cuppick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.kt-cuppick[hidden] { display: none; }
.kt-cuppick button { border: 2px solid var(--edge); background: #fff; border-radius: 10px; padding: 5px 2px; font: 800 11.5px Ubuntu, sans-serif; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.1; }
.kt-cuppick button span { font-size: 18px; }
.kt-cuppick button.on { border-color: #c8232c; background: #fff0f0; box-shadow: 0 0 0 2px #e8b43a; }
.kt-trackpick button { font-size: 12px; line-height: 1.15; }
.kt-track small.kt-rule { display: block; color: #c8232c; font-weight: 800; margin-top: 2px; }
.kt-best.hot { color: #ff6a3a; animation: kHot .5s infinite alternate; }
@keyframes kHot { to { color: #ffd23f; } }
@media (max-width: 560px) { .kt-best.lava { display: block; } }
.hd-tiles.cups { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 420px) { .hd-tiles.cups { grid-template-columns: repeat(3, 1fr); } }
/* public rooms */
.kt-create { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kt-create .sk-btn { margin: 0; font-size: 17px; padding: 10px 6px; }
.kt-open { background: #fff; border: 1px solid var(--edge); border-radius: 12px; padding: 8px; margin: 8px 0; }
.kt-open > b { display: block; font-size: 14px; margin-bottom: 6px; }
#kOpenRooms { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
#kOpenRooms .bd-none { margin: 2px 0; font-size: 13px; }
.kt-oroom { display: flex; align-items: center; gap: 8px; border: 2px solid var(--edge); background: #fbf8f1; border-radius: 10px; padding: 4px 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.kt-oroom:hover:not(:disabled) { border-color: #c8232c; }
.kt-oroom:disabled { opacity: .6; cursor: default; }
.kt-oroom img { width: 34px; height: 34px; object-fit: contain; image-rendering: pixelated; }
.kt-oroom span { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.kt-oroom span b { font-size: 14px; } .kt-oroom span small { font-size: 12px; color: var(--muted); }
.kt-oroom em { font-style: normal; font-weight: 800; font-size: 13px; color: #c8232c; white-space: nowrap; }
.kt-pickhead { font: 800 13px Ubuntu, sans-serif; color: #c8232c; text-align: center; margin-bottom: -2px; }
.kt-pickhead[hidden] { display: none; }
/* multiplayer: after a race */
.k-stand { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; background: #fff8e6; border: 1px solid #e8d4a0; border-radius: 10px; padding: 6px 8px; margin: 6px 0; font-size: 13px; }
.k-stand > b { width: 100%; text-align: center; }
.k-stand span { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.k-stand span.you { color: #c8232c; }
.k-stand img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.k-stand em { font-style: normal; color: #b07a12; font-weight: 900; }
.k-wait { display: flex; align-items: center; gap: 10px; background: #2d2832; color: #fff; border-radius: 12px; padding: 8px 12px; margin: 6px 0; text-align: left; }
.k-wait b { display: block; font-size: 14px; } .k-wait small { color: #ffd75e; font-size: 12px; }
.k-dance { width: 70px; height: 70px; object-fit: contain; image-rendering: pixelated; animation: kDance .9s ease-in-out infinite; transform-origin: 50% 90%; flex: none; }
@keyframes kDance { 0%, 100% { transform: rotate(-10deg) translateY(0) scaleX(1); } 25% { transform: rotate(0) translateY(-8px) scaleX(-1); } 50% { transform: rotate(10deg) translateY(0) scaleX(-1); } 75% { transform: rotate(0) translateY(-8px) scaleX(1); } }
.kt-result .kt-cuppick, .kt-result .kt-trackpick { margin: 6px 0; }
.kt-result .kt-pickhead { margin: 6px 0 0; }
.kt-diff[hidden] { display: none; }

/* ===== menu layout: desktop = set up on the left; board on top of the right side, "How to drive" cards under it. Phones = one column ===== */
#kMenu { grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); grid-template-areas: "setup board" "setup how"; grid-template-rows: auto 1fr;
  align-items: start; justify-content: stretch; max-width: 1280px; margin: 0 auto; }
#kMenu > .sk-panel:first-child { grid-area: setup; }
#kMenu > .kt-boardpanel { grid-area: board; }
#kMenu > .kt-about { grid-area: how; }
.kt-modes { grid-template-columns: repeat(2, 1fr); }
.kt-modes button { padding: 11px 6px; font-size: 16px; }
.kt-boardpanel h3 { margin: 0; }
.kt-boardpanel .kt-board { margin: 0; columns: 2 300px; column-gap: 12px; }
.kt-boardpanel .kt-board li { break-inside: avoid; }
.kt-about { display: block; padding: 12px 16px; }
.kt-about > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.kt-about > summary::-webkit-details-marker { display: none; }
.kt-about > summary h3 { margin: 4px 0; }
.kt-about > summary::after { content: "▾"; font-size: 18px; color: var(--muted); transition: transform .2s; }
.kt-about[open] > summary::after { transform: rotate(180deg); }
.kt-about[open] > summary { margin-bottom: 8px; }
.kt-about .hd { margin-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-items: start; }
@media (max-width: 900px) {
  #kMenu { grid-template-columns: 1fr; grid-template-areas: "setup" "board" "how"; grid-template-rows: none; gap: 12px; }
  .kt-boardpanel .kt-board { columns: 1; }
  #kMenu .sk-avatar { padding: 4px; }
  #kMenu .sk-face { height: 92px; width: 92px; }
  #kMenu .sk-face img { max-height: 92px; transform: scale(1.15); }
  #kMenu .kt-track img { width: 72px; height: 44px; }
}

/* ===== the race intro: "Family, are you Ready!" · 3 · 2 · 1 · "Go Family!!!" ===== */
.k-flash { white-space: pre-line; line-height: 1.05; z-index: 6; }
.k-flash.intro { top: 22%; font-size: clamp(30px, 6.2vw, 58px); color: #fff; -webkit-text-stroke: 2px #7a1418; text-shadow: 0 4px 0 #7a1418, 0 0 18px rgba(255,215,94,.9); }
.k-flash.intro.on { animation: kIntro 1.3s ease-out both; }
.k-flash.num { top: 26%; font-size: clamp(70px, 15vw, 130px); color: #ffd75e; -webkit-text-stroke: 4px #7a1418; text-shadow: 0 7px 0 #7a1418, 0 0 30px rgba(255,120,40,.8); }
.k-flash.num.on { animation: kNum .9s ease-out both; }
/* "Go Family!!!": solid gold letters with a red outline (the see-through rainbow trick drew wrong on iPhones), the glow cycles colours */
.k-flash.go { top: 24%; font-size: clamp(44px, 9vw, 92px); color: #ffe14a; -webkit-text-stroke: 3px #7a1418; paint-order: stroke fill; text-shadow: 0 6px 0 #7a1418, 0 0 24px #ff5a5a; }
.k-flash.go.on { animation: kGo 1.3s ease-out both, kGoGlow .45s linear infinite; }
@keyframes kGoGlow { 0% { text-shadow: 0 6px 0 #7a1418, 0 0 24px #ff5a5a; } 33% { text-shadow: 0 6px 0 #7a1418, 0 0 24px #ffd23f; } 66% { text-shadow: 0 6px 0 #7a1418, 0 0 24px #5ac8ff; } 100% { text-shadow: 0 6px 0 #7a1418, 0 0 24px #ff5a5a; } }
@keyframes kIntro { 0% { opacity: 0; transform: translateY(-30px) scale(.7) rotate(-4deg); } 18% { opacity: 1; transform: translateY(0) scale(1.08) rotate(2deg); } 30% { transform: scale(1) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
@keyframes kNum { 0% { opacity: 0; transform: scale(2.4); } 25% { opacity: 1; transform: scale(.92); } 40% { transform: scale(1.04); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.6); } }
@keyframes kGo { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 20% { opacity: 1; transform: scale(1.18) rotate(3deg); } 35% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }

/* ===== rooms: Ready, player badges, chat, the name box asking for a name ===== */
.kt-pl b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-pl em { font-style: normal; font-size: 11px; font-weight: 800; color: #9a6a10; white-space: nowrap; }
.kt-pl.rdy { background: #eefbea; border-color: #6eaa64; } .kt-pl.rdy em { color: #2e7d32; }
.kt-readybtn { width: 100%; font-size: 22px; padding: 12px; background: #46a05a; animation: ktReady 1s ease-in-out infinite alternate; }
.kt-readybtn small { font-size: 13px; opacity: .85; }
.kt-readybtn.on { background: #2e7d32; animation: none; box-shadow: inset 0 3px 0 rgba(0,0,0,.2); }
@keyframes ktReady { from { transform: scale(1); } to { transform: scale(1.03); box-shadow: 0 0 0 4px rgba(110,170,100,.35); } }
.kt-chat { display: flex; flex-direction: column; gap: 5px; background: #fff; border: 1px solid var(--edge); border-radius: 12px; padding: 8px; margin-top: 8px; text-align: left; }
.kt-chathead { font-size: 14px; }
.kt-chatlog { height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: 13px; overscroll-behavior: contain; }
.kt-chatlog > div { display: flex; align-items: flex-start; gap: 5px; line-height: 1.3; word-break: break-word; }
.kt-chatlog > div img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; flex: 0 0 auto; }
.kt-chatlog > div b { flex: 0 0 auto; color: #7a1418; } .kt-chatlog > div.me b { color: #2e5fa0; }
.kt-chatlog .bd-none { margin: auto; color: var(--muted); }
.kt-chatin { display: flex; gap: 5px; margin: 0; }
.kt-chatin input { flex: 1; min-width: 0; border: 2px solid var(--edge); border-radius: 10px; padding: 7px 9px; font: 600 14px Ubuntu, sans-serif; }
.kt-result .kt-chat { margin-top: 10px; } .kt-result .kt-chatlog { height: 110px; }
.sk-name input.need { border-color: #c8232c !important; box-shadow: 0 0 0 3px rgba(200,35,44,.25); animation: ktShake .45s; }
.sk-name input.need::placeholder { color: #c8232c; font-weight: 700; }
@keyframes ktShake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
/* phones: while racing nothing behind the game can scroll, bounce or be tapped by mistake */
@media (pointer: coarse) {
  html:has(body.bd-playing), body.bd-playing { overflow: hidden; overscroll-behavior: none; }
  .kt.racing .kt-screen { touch-action: none; }
}
/* position changes: a green pop when you pass someone, a red shake when you're passed */
.kt-pos.up { animation: kPosUp .65s ease-out; color: #7dff8a !important; }
.kt-pos.down { animation: kPosDown .5s ease-out; color: #ff7a7a !important; }
@keyframes kPosUp { 0% { transform: scale(1); } 30% { transform: scale(1.45) rotate(-6deg); } 100% { transform: scale(1); } }
@keyframes kPosDown { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
/* iPhones sideways: the page reaches the screen edges, but the game keeps its old size: the notch sides are black bars
   that belong to the game (nothing there to tap, nothing to zoom) */
@media (pointer: coarse) and (orientation: landscape) {
  .kt.racing .kt-game { background: #1d1d22; touch-action: none; }
  .kt.racing .kt-game { background: #000; }
  .kt.racing .kt-screen { left: var(--sal); right: var(--sar); }   /* the game keeps its size; the notch sides are plain black */
  .kt.racing .kt-pad { left: var(--sal); right: var(--sar); }
}
/* the crown above "Family, are you Ready!" */
.k-flash .k-crown { display: block; width: clamp(54px, 9vw, 90px); margin: 0 auto 4px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 #7a1418) drop-shadow(0 0 12px rgba(255,215,94,.9)); animation: kCrown 1.3s ease-out both; }
@keyframes kCrown { 0% { transform: translateY(-40px) rotate(-12deg) scale(.5); } 25% { transform: translateY(4px) rotate(6deg) scale(1.15); } 40% { transform: translateY(0) rotate(0) scale(1); } 100% { transform: translateY(-3px); } }
/* the round joystick */
.kt-stick { width: 132px; height: 132px; border-radius: 50%; padding: 0; display: block;
  background: radial-gradient(circle, rgba(25,18,30,.25) 0 38%, rgba(25,18,30,.45) 39% 100%); }
.kt-stick b { position: absolute; font-size: 13px; line-height: 1; }
.kt-stick b.l { left: 9px; top: 50%; transform: translateY(-50%); } .kt-stick b.r { right: 9px; top: 50%; transform: translateY(-50%); }
.kt-stick b.u { top: 7px; left: 50%; transform: translateX(-50%); font-size: 9px; opacity: .45; } .kt-stick b.d { bottom: 7px; left: 50%; transform: translateX(-50%); font-size: 9px; opacity: .45; }
.kt-stick i { width: 60px; height: 60px; margin: -30px 0 0 -30px; transition: transform .06s; }
.kt-stick.on i { transition: none; }
.hd-phone .j { width: 46px; height: 46px; border-radius: 50%; justify-self: start; gap: 0; font-size: 7px; }
.kt-credit { grid-column: 1 / -1; margin: 2px 0 0; font-size: 11.5px; color: var(--muted); } .kt-credit a { color: inherit; }
/* phones held upright: the race is turned 90° so it's already sideways (no "turn your phone" message); people just turn the phone */
@media (pointer: coarse) {
  .kt.racing.rot .kt-game { position: fixed; top: 0; left: 100vw; width: 100vh; width: 100dvh; height: 100vw; transform-origin: 0 0; transform: rotate(90deg); z-index: 50;
    max-width: none; min-height: 0; margin: 0; padding: 0; border-radius: 0; gap: 0; box-shadow: none; background: #000; touch-action: none; }
  .kt.racing.rot .kt-screen { position: absolute; inset: 0; width: auto; margin: 0; border: 0; border-radius: 0; aspect-ratio: auto; flex: none; min-height: 0; }
  .kt.racing.rot .kt-speed { left: 50%; transform: translateX(-50%); bottom: 12px; }
  .kt.racing.rot .kt-pad { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; z-index: 3; background: none; pointer-events: none; }
  .kt.racing.rot .kt-pad > * { pointer-events: auto; }
  .kt.racing.rot .kt-time { font-size: 22px; } .kt.racing.rot .kt-lap { font-size: 16px; } .kt.racing.rot .kt-pos { font-size: 32px; }
  .kt.racing.rot .kt-item { width: 44px; height: 44px; } .kt.racing.rot .kt-item img { width: 30px; height: 30px; }
  .kt.racing.rot .kt-best { display: none; }
}
.kt-bots { margin: 6px 0 2px; } .kt-bots button { font-size: 13px; padding: 5px 9px; }
/* watching a race: no controls of your own */
#kart.watching .kt-pad, #kart.watching #kItemBox, #kart.watching #kBag { display: none !important; }
/* every meso counts: the race total next to the 10 you hold, and on the results */
.kt-bag .kt-tot { color: #ffd75e; margin-left: 4px; }
.k-mesos { font-weight: 800; color: #b07a12 !important; margin: 4px 0; }
/* phones: text boxes at 16px, or an iPhone zooms the whole page in when you tap one (the room chat after a race did this) */
@media (pointer: coarse) { .kt input, .kt textarea, .kt select { font-size: 16px; } }
/* 🏆 cup trophies: the banner at the end of a cup, and the best one won shown on each cup button */
.kt-cuppick button { position: relative; }
.kt-tro { position: absolute; top: -7px; right: -4px; font-style: normal; font-size: 15px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.k-trophy { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px auto 8px; padding: 8px 14px; border-radius: 14px; width: fit-content; max-width: 100%;
  border: 2px solid #b8860b; background: linear-gradient(135deg, #fff6c8, #ffd75e 55%, #f2b632); box-shadow: 0 3px 0 rgba(90,60,10,.25); animation: ktTrophy .7s cubic-bezier(.2,1.6,.4,1) both; }
.k-trophy span { font-size: 38px; line-height: 1; animation: ktTrophySpin 1.6s ease-in-out .7s infinite alternate; }
.k-trophy b { display: block; font-size: 17px; color: #5a3a00; } .k-trophy small { color: #6b4a10; font-size: 12px; }
.k-trophy.r2 { border-color: #8a96a8; background: linear-gradient(135deg, #ffffff, #dde4ee 55%, #b8c2d0); } .k-trophy.r2 b, .k-trophy.r2 small { color: #3a4452; }
.k-trophy.r3 { border-color: #9a5a2a; background: linear-gradient(135deg, #ffe8d2, #e8a66a 55%, #c47a3a); } .k-trophy.r3 b, .k-trophy.r3 small { color: #4a2408; }
@keyframes ktTrophy { from { transform: scale(.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ktTrophySpin { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(8deg) scale(1.08); } }

.sk-mesoall { margin: 6px 0 2px; font-size: .9em; font-weight: 700; color: #7a5a1a; display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.sk-mesoall[hidden] { display: none; }
.sk-mesoall img { width: 18px; height: 18px; image-rendering: pixelated; }
.k-mesoall { opacity: .8; font-weight: 600; }

/* 🎬 the course intro: a white cover that slides off, and the course name on a banner (bottom left, like a race broadcast) */
.kt-white { position: absolute; inset: 0; z-index: 29; background: #fff; pointer-events: none; opacity: 0; will-change: opacity; }
.kt-white[hidden] { display: none; }
.kt-banner { position: absolute; left: 14px; bottom: 14px; z-index: 28; display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 10px; border-radius: 12px; background: rgba(12, 10, 26, .74); border: 2px solid rgba(255, 215, 120, .6); color: #fff; box-shadow: 0 8px 26px rgba(0, 0, 0, .45); animation: ktBannerIn .6s ease-out both; }
.kt-banner[hidden] { display: none; }
.kt-banner-icon { font-size: 34px; line-height: 1; }
.kt-banner-mode { font: 700 11px/1.1 Ubuntu, sans-serif; letter-spacing: .16em; color: #ffd86a; }
.kt-banner-name { font: 900 26px/1.15 Ubuntu, sans-serif; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.kt-banner-skip { align-self: flex-end; margin-left: 14px; font: 600 11px Ubuntu, sans-serif; color: rgba(255, 255, 255, .7); white-space: nowrap; }
@keyframes ktBannerIn { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
