/* 몬스터 트럭 대소동: 철판 · 경고 줄무늬 · 굵은 글자 */
:root {
  --ink: #12141c;
  --steel: #1c202b;
  --steel2: #2a2f3d;
  --line: rgba(255, 255, 255, 0.14);
  --white: #f7f8fb;
  --mute: #aeb5c6;
  --yellow: #ffc81e;
  --orange: #ff7a18;
  --red: #e8321f;
  --blue: #1f8cff;
  --green: #4fd97a;
  --head: "Black Han Sans", "Noto Sans KR", sans-serif;
  --en: "Russo One", "Black Han Sans", sans-serif;
  --body: "Noto Sans KR", system-ui, sans-serif;
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #14161f;
  color: var(--white);
  font-family: var(--body);
}
.hidden {
  display: none !important;
}
button {
  font-family: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.coin-i {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  vertical-align: -0.16em;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffc81e 48%, #c98606 100%);
  box-shadow: inset 0 0 0 2px #a86d04;
}
.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 8px;
  background: rgba(12, 14, 20, 0.82);
  border: 1px solid var(--line);
  font-family: var(--en);
  font-size: 16px;
  justify-self: end;
}

/* ---------- 효과 덮개 ---------- */
.speedlines {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  background: repeating-conic-gradient(from 3deg at 50% 46%, rgba(255, 255, 255, 0.62) 0 0.5deg, transparent 0.5deg 7deg, rgba(255, 255, 255, 0.34) 7deg 7.3deg, transparent 7.3deg 13deg);
  -webkit-mask: radial-gradient(ellipse at 50% 46%, transparent 42%, #000 76%);
  mask: radial-gradient(ellipse at 50% 46%, transparent 42%, #000 76%);
  animation: lines 0.16s steps(3) infinite;
}
@keyframes lines {
  to {
    transform: rotate(4deg) scale(1.03);
  }
}
.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #ffdca8;
  opacity: 0;
  z-index: 3;
  mix-blend-mode: screen;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(10px + var(--sat)) calc(12px + var(--sar)) 0 calc(12px + var(--sal));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  pointer-events: none;
  font-family: var(--en);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}
.hud-left {
  padding-left: 84px;
  display: grid;
  gap: 0;
  justify-items: start;
}
.hud-mode {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--yellow);
}
.hud-stage {
  font-size: 15px;
  font-family: var(--head);
  font-weight: 400;
}
.hud-score small {
  display: none;
}
.hud-score b {
  font-size: clamp(26px, 3.6vw, 42px);
  font-weight: 400;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.hud-mid {
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: 44vw;
}
.hud-time {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  padding: 4px 16px;
  border-radius: 7px;
  background: rgba(12, 14, 20, 0.72);
  font-variant-numeric: tabular-nums;
}
.hud-time.warn {
  background: var(--red);
  animation: pulse 0.5s infinite alternate;
}
@keyframes pulse {
  to {
    transform: scale(1.08);
  }
}
.hud-prog {
  width: clamp(120px, 24vw, 280px);
  height: 7px;
  padding: 1px;
  border-radius: 3px;
  background: rgba(12, 14, 20, 0.72);
  overflow: hidden;
}
.hud-prog u {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #ffb400, #ffe04a);
  transform-origin: left;
  transform: scaleX(0);
}
.hud-missions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}
.hud-missions li {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 1px 9px;
  border-radius: 5px;
  background: rgba(12, 14, 20, 0.5);
}
.hud-missions li.main {
  font-size: 13px;
  color: #fff;
}
.hud-missions li.bonus {
  color: #d3d8e4;
}
.hud-missions li.done {
  color: var(--green);
}
.hud-missions li.failed {
  color: #ff8e80;
  text-decoration: line-through;
}
.hud-missions em {
  font-style: normal;
  color: var(--yellow);
}
.hud-right {
  display: grid;
  justify-items: end;
  gap: 4px;
  padding-right: 52px;
}
.hud-speed b {
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud-speed small {
  font-size: 12px;
  margin-left: 4px;
  color: var(--mute);
}
.gauge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.04em;
}
.gauge i {
  display: block;
  width: clamp(92px, 15vw, 170px);
  height: 11px;
  padding: 2px;
  border-radius: 3px;
  background: rgba(12, 14, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
  transform: skewX(-14deg);
}
.gauge u {
  display: block;
  height: 100%;
  width: 100%;
  text-decoration: none;
  transform-origin: left;
  background: linear-gradient(90deg, #ff7a18, #ffd21f);
}
.gauge.on u {
  background: linear-gradient(90deg, #4bc8ff, #dff6ff);
}
.gauge.hp u {
  background: linear-gradient(90deg, #4fd97a, #a7f06a);
}
.gauge.hp.low u {
  background: #ff4a34;
}

.combo {
  position: absolute;
  z-index: 5;
  right: calc(14px + var(--sar));
  top: 30%;
  text-align: right;
  pointer-events: none;
  font-family: var(--en);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
}
.combo b {
  display: block;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 400;
  line-height: 0.95;
  color: var(--yellow);
}
.combo small {
  font-size: 13px;
  letter-spacing: 0.1em;
}
.combo i {
  display: block;
  margin-top: 3px;
  margin-left: auto;
  width: 96px;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
}
.combo u {
  display: block;
  height: 100%;
  background: var(--yellow);
  transform-origin: right;
}
.combo.hit b {
  animation: comboHit 0.2s;
}
@keyframes comboHit {
  from {
    transform: scale(1.34);
    color: #fff;
  }
}

.pops {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--en);
  font-size: 18px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
  animation: popUp 0.8s ease-out forwards;
}
.pop.big {
  font-size: 28px;
  color: var(--yellow);
}
@keyframes popUp {
  from {
    margin-top: 8px;
    opacity: 0;
    scale: 0.6;
  }
  18% {
    opacity: 1;
    scale: 1.14;
  }
  to {
    margin-top: -46px;
    opacity: 0;
    scale: 1;
  }
}
.bigword {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 25%;
  text-align: center;
  pointer-events: none;
  font-family: var(--en);
  font-size: clamp(38px, 8.4vw, 112px);
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 2px #2a0f05;
  text-shadow: 0 5px 0 #b82a14, 0 10px 16px rgba(0, 0, 0, 0.5);
  opacity: 0;
}
.bigword.show {
  animation: wordIn 1.05s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.bigword.t3,
.bigword.t4 {
  color: #fff;
  text-shadow: 0 5px 0 var(--red), 0 0 34px var(--orange), 0 12px 16px rgba(0, 0, 0, 0.5);
}
@keyframes wordIn {
  0% {
    opacity: 0;
    transform: scale(2.2) rotate(-7deg);
  }
  16% {
    opacity: 1;
    transform: scale(1) rotate(-3deg);
  }
  78% {
    opacity: 1;
    transform: scale(1.05) rotate(-3deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.14) rotate(-3deg);
  }
}
.stuntword {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 15%;
  text-align: center;
  pointer-events: none;
  font-family: var(--head);
  opacity: 0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6);
}
.stuntword b {
  display: block;
  font-size: clamp(22px, 3.6vw, 40px);
  font-weight: 400;
  color: #7fe6ff;
}
.stuntword small {
  font-family: var(--en);
  font-size: clamp(18px, 2.6vw, 28px);
  color: var(--yellow);
}
.stuntword.bad b {
  color: #ff8e80;
}
.stuntword.show {
  animation: stuntIn 1.5s ease-out forwards;
}
@keyframes stuntIn {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  12% {
    opacity: 1;
    transform: none;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-14px);
  }
}
.tip {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 26%;
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 7px 16px;
  border-radius: 7px;
  background: rgba(12, 14, 20, 0.84);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.tip.show {
  opacity: 1;
}
.banner {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 20%;
  padding: 12px 18px 14px;
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(12, 14, 20, 0.88) 18%, rgba(12, 14, 20, 0.88) 82%, transparent);
  animation: bannerIn 0.26s ease-out;
}
@keyframes bannerIn {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
}
.banner span {
  font-family: var(--en);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--yellow);
}
.banner b {
  font-family: var(--head);
  font-weight: 400;
  font-size: clamp(26px, 4.6vw, 48px);
}
.banner small {
  font-size: 14px;
  font-weight: 700;
  color: #dfe3ee;
}
.count {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 40%;
  text-align: center;
  pointer-events: none;
  font-family: var(--en);
  font-size: clamp(70px, 14vw, 170px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 3px #2a0f05;
  text-shadow: 0 7px 0 var(--red);
}
.count.go {
  color: var(--yellow);
}
.count i {
  display: inline-block;
  font-style: normal;
  animation: countIn 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes countIn {
  from {
    transform: scale(2.2);
    opacity: 0;
  }
}
.keyhelp {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  width: max-content;
  max-width: 92vw;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(12, 14, 20, 0.72);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
kbd {
  display: inline-block;
  min-width: 22px;
  margin-right: 2px;
  padding: 1px 6px;
  text-align: center;
  font: 700 12px var(--body);
  border-radius: 4px;
  background: #e9ecf3;
  color: #141620;
  box-shadow: 0 2px 0 #8d93a3;
}

/* ---------- 터치 ---------- */
.touch {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.wheel-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 62%;
  pointer-events: auto;
  touch-action: none;
}
.wheel-wrap {
  position: absolute;
  left: calc(34px + var(--sal));
  bottom: calc(20px + var(--sab));
  width: clamp(124px, 24vmin, 166px);
  aspect-ratio: 1;
}
.chev {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 44px;
  margin-top: -22px;
  background: rgba(255, 255, 255, 0.72);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
  transition: background 0.08s, transform 0.08s;
}
.chev.l {
  left: -27px;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}
.chev.r {
  right: -27px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.chev.on {
  background: var(--yellow);
  transform: scale(1.25);
}
.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: clamp(12px, 2.4vmin, 17px) solid #15171d;
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: -3px;
  background: rgba(20, 22, 30, 0.2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42), inset 0 0 0 2px rgba(255, 255, 255, 0.2);
  opacity: 0.88;
}
.wheel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(-1 * clamp(12px, 2.4vmin, 17px));
  width: 8px;
  height: clamp(12px, 2.4vmin, 17px);
  margin-left: -4px;
  background: var(--yellow);
}
.wheel .spoke {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 50%;
  margin-left: -7px;
  background: #15171d;
  transform-origin: top center;
}
.wheel .s1 {
  transform: rotate(180deg);
  display: none;
}
.wheel .s2 {
  transform: rotate(62deg);
}
.wheel .s3 {
  transform: rotate(-62deg);
}
.wheel .hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4d5362, #15171d);
  box-shadow: 0 0 0 2px var(--yellow);
}
.pad-zone {
  position: absolute;
  right: calc(12px + var(--sar));
  bottom: calc(14px + var(--sab));
  width: clamp(190px, 36vmin, 268px);
  height: clamp(186px, 36vmin, 256px);
  pointer-events: none;
}
.pedal,
.tb {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  font-family: var(--en);
  color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.5), 0 8px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.05s;
}
.pedal {
  bottom: 0;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.34);
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 5px, transparent 5px 12px);
}
.pedal.gas {
  right: 0;
  width: 42%;
  height: 56%;
  background-color: #1f9e4a;
  font-size: clamp(12px, 2vmin, 14px);
}
.pedal.brake {
  right: 45%;
  width: 37%;
  height: 46%;
  background-color: #c32d1e;
  font-size: clamp(9px, 1.6vmin, 11px);
  line-height: 1.2;
}
.tb {
  width: clamp(54px, 10.4vmin, 72px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.45);
  font-size: clamp(10px, 1.7vmin, 12px);
}
.tb-jump {
  right: 0;
  top: 0;
  background: #1766d6;
}
.tb-boost {
  right: clamp(60px, 12vmin, 84px);
  top: 12%;
  background: #e0700c;
}
/* 자동 가속: DRIVE 없이 오른손이 자유롭다 */
.touch.auto .pedal.gas {
  display: none;
}
.touch.auto .pedal.brake {
  right: 0;
  width: 46%;
  height: 50%;
  font-size: clamp(10px, 1.8vmin, 12px);
}
.touch.auto .tb-jump {
  top: auto;
  bottom: 0;
  right: 52%;
  width: clamp(76px, 14vmin, 96px);
  font-size: clamp(12px, 2vmin, 14px);
}
.touch.auto .tb-boost {
  top: 0;
  right: 4%;
  width: clamp(68px, 12.4vmin, 84px);
  font-size: clamp(11px, 1.8vmin, 13px);
}
.tb-boost.ready {
  box-shadow: 0 0 0 3px #ffd21f, 0 5px 0 rgba(0, 0, 0, 0.5);
}
.pedal.on,
.tb.on {
  transform: translateY(3px) scale(0.96);
  filter: brightness(1.28);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}
.tb-reset {
  position: absolute;
  pointer-events: auto;
  left: calc(14px + var(--sal));
  top: calc(100px + var(--sat));
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(12, 14, 20, 0.66);
  border: 1px solid var(--line);
}

/* ---------- 덮는 화면 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 첫 화면 */
.title {
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  justify-items: center;
  overflow: hidden;
  padding: calc(14px + var(--sat)) calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.55) 0%, transparent 28%, transparent 56%, rgba(8, 10, 18, 0.86) 100%);
}
.title-coin {
  position: absolute;
  top: calc(14px + var(--sat));
  right: calc(70px + var(--sar));
}
.logo-box {
  text-align: center;
  grid-row: 1;
}
.logo {
  margin: 0;
  font-family: var(--head);
  font-weight: 400;
  line-height: 0.98;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.28em;
  font-size: clamp(38px, 6.6vw, 84px);
  letter-spacing: -0.01em;
  transform: skewX(-6deg);
}
.logo .l1 {
  color: #fff;
  text-shadow: 0 4px 0 #1762d0, 0 8px 0 #0a2b66, 0 12px 18px rgba(0, 0, 0, 0.5);
}
.logo .l2 {
  color: var(--yellow);
  text-shadow: 0 4px 0 #d8431a, 0 8px 0 #6e1c08, 0 12px 18px rgba(0, 0, 0, 0.5);
}
.logo-en {
  margin: 8px 0 0;
  font-family: var(--en);
  font-size: clamp(13px, 1.9vw, 22px);
  letter-spacing: 0.17em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}
.logo-sub {
  margin: 2px 0 0;
  font-family: var(--en);
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: 0.1em;
  color: var(--yellow);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.title-actions {
  grid-row: 3;
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
}
.btn-play {
  min-width: clamp(190px, 26vw, 340px);
  padding: 10px 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffdf4a, #ffb000);
  color: #1a1204;
  box-shadow: 0 6px 0 #a35a00, 0 12px 26px rgba(0, 0, 0, 0.5);
  display: grid;
  justify-items: center;
  transform: skewX(-6deg);
  transition: transform 0.08s;
}
.btn-play:hover {
  transform: skewX(-6deg) translateY(-2px);
}
.btn-play:active {
  transform: skewX(-6deg) translateY(4px);
  box-shadow: 0 2px 0 #a35a00;
}
.btn-play .pl {
  font-family: var(--en);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}
.btn-play small {
  font-weight: 900;
  font-size: 13px;
}
.btn-garage {
  padding: 10px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2f7fe6, #1458b8);
  box-shadow: 0 6px 0 #0a2f6b, 0 12px 26px rgba(0, 0, 0, 0.5);
  display: grid;
  align-content: center;
  justify-items: center;
  transform: skewX(-6deg);
}
.btn-garage:active {
  transform: skewX(-6deg) translateY(4px);
  box-shadow: 0 2px 0 #0a2f6b;
}
.btn-garage span {
  font-family: var(--en);
  font-size: clamp(17px, 2vw, 24px);
}
.btn-garage small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
}
.mode-row {
  grid-row: 4;
  width: 100%;
  max-width: 1120px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.mode-btn {
  padding: 8px 8px 9px;
  border-radius: 8px;
  text-align: center;
  background: rgba(16, 19, 28, 0.88);
  border: 1px solid var(--line);
  border-top: 3px solid var(--c, var(--yellow));
  display: grid;
  gap: 1px;
  transition: transform 0.08s, background 0.12s;
}
.mode-btn:hover {
  background: rgba(38, 43, 58, 0.94);
  transform: translateY(-2px);
}
.mode-btn b {
  font-family: var(--en);
  font-weight: 400;
  font-size: clamp(11px, 1.15vw, 14px);
  color: var(--c, var(--yellow));
}
.mode-btn small {
  font-size: clamp(10px, 0.9vw, 11px);
  color: var(--mute);
}
.m-tour {
  --c: #ffc81e;
}
.m-dest {
  --c: #ff5a3a;
}
.m-stunt {
  --c: #4bc8ff;
}
.m-time {
  --c: #7be06a;
}
.m-set {
  --c: #cfd4e0;
}
.home-link {
  grid-row: 5;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #cfd4e0;
  text-decoration: none;
}
.home-link.inline {
  display: inline-block;
  margin-top: 12px;
}

/* 패널 */
.panel {
  padding: calc(14px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal));
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.93), rgba(16, 19, 28, 0.97));
  backdrop-filter: blur(3px);
}
.panel-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  max-width: 1040px;
  margin: 0 auto;
  padding-right: 52px;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--en);
  font-weight: 400;
  font-size: clamp(20px, 2.8vw, 32px);
  color: var(--yellow);
  text-align: center;
}
.back-btn {
  justify-self: start;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
  background: var(--steel2);
  border: 1px solid var(--line);
}
.back-btn:hover {
  background: #3a4153;
}
.panel-sub {
  margin: 6px 0 12px;
  text-align: center;
  font-size: 14px;
  color: var(--mute);
}
.world-tabs {
  display: flex;
  gap: 6px;
  max-width: 1040px;
  margin: 0 auto 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.world-tab {
  flex: 1 0 auto;
  min-width: 112px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--steel);
  border: 1px solid var(--line);
  font-family: var(--en);
  font-size: 12px;
  color: var(--mute);
}
.world-tab small {
  display: block;
  margin-top: 1px;
  font: 700 11px var(--body);
}
.world-tab.on {
  background: var(--yellow);
  color: #1a1204;
  border-color: var(--yellow);
}
.world-tab.locked {
  opacity: 0.5;
}
.world-card {
  max-width: 1040px;
  margin: 0 auto 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--steel);
  border-left: 5px solid var(--wc, var(--yellow));
}
.world-card b {
  font-family: var(--head);
  font-weight: 400;
  font-size: 19px;
}
.world-card span {
  display: block;
  font-size: 13px;
  color: var(--mute);
}
.stage-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  max-width: 1040px;
  margin: 0 auto;
}
.stage-card {
  position: relative;
  min-height: 92px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  background: var(--steel2);
  border: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 3px;
  transition: transform 0.08s, border-color 0.12s;
}
.stage-card:not(.locked):hover {
  transform: translateY(-2px);
  border-color: var(--yellow);
}
.stage-card .no {
  font-family: var(--en);
  font-size: 13px;
  color: var(--yellow);
}
.stage-card b {
  font-family: var(--head);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.15;
}
.stage-card .goal {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.3;
}
.stage-card .st {
  font-size: 15px;
  letter-spacing: 1px;
  color: #4a5063;
}
.stage-card .st i {
  font-style: normal;
  color: var(--yellow);
}
.stage-card .bst {
  font-size: 11px;
  font-family: var(--en);
  color: #cfd4e0;
}
.stage-card.boss {
  background: linear-gradient(135deg, #5a1a12, #2a1016);
  border-color: #e8321f;
}
.stage-card.locked {
  opacity: 0.42;
  cursor: not-allowed;
}
.stage-card.locked .no::after {
  content: " · 잠김";
  color: var(--mute);
  font-family: var(--body);
  font-weight: 700;
}

/* 차고 */
.garage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  padding: calc(14px + var(--sat)) calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
  pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 10, 18, 0.78) 0, rgba(8, 10, 18, 0.5) 330px, transparent 500px);
}
.garage > * {
  pointer-events: auto;
}
.garage .panel-head {
  max-width: none;
  width: 100%;
}
.garage-side {
  width: min(390px, 100%);
  min-height: 0;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 6px;
  display: grid;
  align-content: start;
  gap: 8px;
  scrollbar-width: thin;
}
.truck-card h3 {
  margin: 2px 0 0;
  font-family: var(--en);
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.05;
}
.truck-grade {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
  background: var(--yellow);
  color: #1a1204;
}
.truck-ko {
  margin: 0;
  font-weight: 900;
  font-size: 14px;
  color: var(--yellow);
}
.truck-desc {
  margin: 3px 0 7px;
  font-size: 13px;
  line-height: 1.4;
  color: #dfe3ee;
}
.stat-list {
  display: grid;
  gap: 3px;
}
.stat {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mute);
}
.stat i {
  position: relative;
  display: block;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  transform: skewX(-14deg);
}
.stat u {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #ff9a18, #ffd21f);
}
.stat u.base {
  background: #6d7486;
}
.up-list {
  display: grid;
  gap: 4px;
}
.up-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(20, 23, 33, 0.88);
  border: 1px solid var(--line);
}
.up-row b {
  font-size: 13px;
}
.up-row small {
  display: block;
  font-size: 11px;
  color: var(--mute);
}
.up-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
  vertical-align: 1px;
}
.up-dots i {
  width: 11px;
  height: 5px;
  background: #3b4152;
}
.up-dots i.on {
  background: var(--yellow);
}
.up-btn {
  min-width: 84px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 6px;
  font-family: var(--en);
  font-size: 12px;
  color: #1a1204;
  background: var(--yellow);
}
.up-btn:disabled {
  background: #3b4152;
  color: #8d93a3;
  cursor: not-allowed;
}
.btn-pick {
  min-height: 46px;
  border-radius: 8px;
  font-family: var(--head);
  font-size: 18px;
  background: var(--blue);
}
.btn-pick.buy {
  background: var(--yellow);
  color: #1a1204;
}
.btn-pick.using {
  background: #2a7d46;
}
.btn-pick:disabled {
  background: #3b4152;
  color: #aeb5c6;
  cursor: not-allowed;
}
.truck-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.truck-chip {
  flex: 1 0 106px;
  padding: 7px 6px;
  border-radius: 7px;
  text-align: center;
  background: rgba(20, 23, 33, 0.92);
  border: 2px solid transparent;
  border-bottom: 4px solid var(--c, #fff);
  font-family: var(--en);
  font-size: 11px;
}
.truck-chip small {
  display: block;
  margin-top: 1px;
  font: 700 11px var(--body);
  color: var(--mute);
}
.truck-chip.on {
  border-color: var(--yellow);
}
.truck-chip.lock {
  opacity: 0.68;
}

/* 설정 */
.panel.small .set-list {
  max-width: 560px;
  margin: 14px auto 0;
  display: grid;
  gap: 10px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--steel2);
}
.seg {
  display: flex;
  gap: 3px;
}
.seg button {
  min-height: 34px;
  min-width: 48px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  background: var(--steel);
  color: var(--mute);
}
.seg button.on {
  background: var(--yellow);
  color: #1a1204;
}
.set-row small {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--mute);
}
.set-help {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--steel);
  font-size: 13px;
  line-height: 1.5;
  color: #dfe3ee;
}
.set-help h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--yellow);
}
.set-help p {
  margin: 4px 0;
}
.btn-danger {
  justify-self: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: 1px solid #a33b2d;
  color: #ff9d90;
}

/* 결과 */
.result {
  display: grid;
  place-items: center;
  padding: calc(44px + var(--sat)) 14px calc(14px + var(--sab));
  background: rgba(8, 10, 18, 0.5);
}
.res-card {
  width: min(560px, 100%);
  padding: 14px 18px 16px;
  border-radius: 12px;
  background: rgba(16, 19, 28, 0.95);
  border: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: cardIn 0.28s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes cardIn {
  from {
    transform: translateY(26px) scale(0.96);
    opacity: 0;
  }
}
.res-card.fail {
  border-top-color: var(--red);
}
.res-mode {
  margin: 0;
  font-family: var(--en);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.res-title {
  margin: 0;
  font-family: var(--en);
  font-weight: 400;
  font-size: clamp(26px, 5vw, 40px);
  color: var(--yellow);
  line-height: 1.1;
}
.fail .res-title {
  color: #ff7d6c;
}
.res-why {
  margin: 0;
  font-size: 13px;
  color: var(--mute);
}
.res-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 5px 0 3px;
}
.res-stars i {
  width: 38px;
  height: 38px;
  background: #343a4b;
  clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 98%, 50% 76%, 20% 98%, 30% 60%, 0 38%, 38% 36%);
}
.res-stars i.on {
  background: var(--yellow);
  animation: starPop 0.34s cubic-bezier(0.2, 1.8, 0.4, 1);
}
@keyframes starPop {
  from {
    transform: scale(0.1) rotate(-60deg);
  }
}
.res-total small {
  display: block;
  font-family: var(--en);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.res-total b {
  font-family: var(--en);
  font-weight: 400;
  font-size: clamp(32px, 6vw, 46px);
  line-height: 1;
}
.res-total em {
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--red);
  font: 400 12px var(--en);
  vertical-align: 8px;
}
.res-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 7px 0;
}
.res-grid div {
  padding: 5px 2px;
  border-radius: 6px;
  background: var(--steel2);
}
.res-grid small {
  display: block;
  font-size: 11px;
  color: var(--mute);
}
.res-grid b {
  font-family: var(--en);
  font-weight: 400;
  font-size: 16px;
}
.res-missions {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: grid;
  gap: 3px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.res-missions li {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--mute);
}
.res-missions li::before {
  content: "✕";
  color: #ff7d6c;
  font-weight: 900;
}
.res-missions li.ok {
  color: #fff;
}
.res-missions li.ok::before {
  content: "✓";
  color: var(--green);
}
.res-coin {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-family: var(--en);
  font-size: 19px;
  color: var(--yellow);
}
.res-coin small {
  font: 700 12px var(--body);
  color: var(--mute);
}
.res-unlock {
  margin: 5px 0 0;
  padding: 5px;
  border-radius: 6px;
  background: rgba(255, 200, 30, 0.14);
  color: var(--yellow);
  font-weight: 900;
  font-size: 14px;
}
.res-rank {
  margin-top: 7px;
  display: grid;
  justify-items: center;
}
.res-rank .today-rank-form {
  margin-top: 0;
  gap: 5px;
}
.res-rank .today-rank-form label {
  color: var(--mute);
  opacity: 1;
  font-size: 12px;
}
.res-rank .today-rank-form input {
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f4f6fb;
  color: #141620;
  user-select: text;
  -webkit-user-select: text;
}
.res-rank .btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  font-weight: 900;
  font-size: 14px;
  background: #2f7fe6;
  color: #fff;
}
.res-rank .btn.kakao {
  background: #fee500;
  color: #191919;
}
.res-rank .btn.soft {
  background: #3a4153;
  box-shadow: none;
}
.res-rank .rank-msg {
  color: var(--green);
}
.res-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
}
.res-actions button {
  min-height: 42px;
  border-radius: 7px;
  font-family: var(--en);
  font-size: 14px;
}
.btn-next {
  grid-column: 1 / -1;
  min-height: 50px !important;
  font-size: 20px !important;
  background: var(--yellow);
  color: #1a1204;
}
.btn-sub {
  background: var(--steel2);
  border: 1px solid var(--line);
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: #0c0e15;
  font-weight: 900;
}
.boot {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  background: repeating-linear-gradient(-45deg, #1a1d27 0 26px, #14161f 26px 52px);
}
.boot-box {
  width: min(380px, 100%);
}
.boot-logo {
  margin: 0 0 12px;
  font-family: var(--head);
  font-size: 30px;
  color: var(--yellow);
}
.load-bar {
  height: 11px;
  padding: 2px;
  border-radius: 3px;
  background: #0a0b10;
  border: 1px solid rgba(255, 255, 255, 0.22);
  transform: skewX(-14deg);
}
.load-bar b {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff7a18, #ffd21f);
  transition: width 0.3s;
}
.load-t {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--mute);
  line-height: 1.5;
}

/* 공용 버튼 자리 */
.mt .today-pause-btn {
  top: calc(10px + var(--sat)) !important;
  left: calc(10px + var(--sal)) !important;
  background: rgba(16, 19, 28, 0.86) !important;
  color: #fff !important;
  box-shadow: none !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
}
.mt .today-mute-btn {
  top: calc(10px + var(--sat)) !important;
  background: rgba(16, 19, 28, 0.86) !important;
  color: #fff !important;
  box-shadow: none !important;
  z-index: 9 !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
}
.mt .today-brand {
  z-index: 9;
}

/* 세로 화면 */
@media (max-aspect-ratio: 1/1) {
  .logo-box {
    margin-top: 46px;
  }
  .title-coin {
    top: calc(14px + var(--sat));
    right: calc(62px + var(--sar));
  }
  .hud {
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
  }
  .hud-left {
    grid-column: 1;
    grid-row: 1;
  }
  .hud-right {
    grid-column: 2;
    grid-row: 1;
  }
  .hud-mid {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    max-width: 96vw;
  }
  .mode-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .m-set {
    grid-column: 1 / -1;
  }
  .garage {
    background: linear-gradient(180deg, rgba(8, 10, 18, 0.6) 0, transparent 90px, transparent 34%, rgba(8, 10, 18, 0.92) 42%);
  }
  .garage-side {
    width: 100%;
    margin-top: 34vh;
  }
  .combo {
    top: 25%;
  }
  .tip {
    bottom: 38%;
  }
}

/* 낮은 가로 화면 (휴대폰 가로) */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .logo {
    font-size: clamp(26px, 8vh, 46px);
  }
  .logo-en {
    margin-top: 3px;
    font-size: 11px;
  }
  .logo-sub {
    display: none;
  }
  .title-actions {
    margin-bottom: 6px;
  }
  .btn-play {
    padding: 4px 24px;
    min-width: 170px;
  }
  .btn-play .pl {
    font-size: 26px;
  }
  .btn-play small,
  .btn-garage small {
    font-size: 10px;
  }
  .btn-garage {
    padding: 4px 16px;
  }
  .mode-btn {
    min-height: 36px;
    padding: 4px;
    align-content: center;
  }
  .mode-btn small {
    display: none;
  }
  .home-link {
    margin-top: 3px;
    font-size: 11px;
  }
  .hud-missions {
    font-size: 11px;
  }
  .hud-missions li.main {
    font-size: 11px;
  }
  .hud-time {
    font-size: 19px;
    padding: 2px 10px;
  }
  .hud-score b {
    font-size: 21px;
  }
  .hud-speed b {
    font-size: 23px;
  }
  .gauge i {
    width: 82px;
    height: 8px;
  }
  .hud-mode {
    display: none;
  }
  .res-card {
    width: min(760px, 100%);
    padding: 8px 14px 10px;
  }
  .result {
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: start;
  }
  .res-stars i {
    width: 26px;
    height: 26px;
  }
  .garage-side {
    width: min(350px, 100%);
    margin-top: 4px;
  }
  .bigword {
    top: 18%;
  }
  .banner {
    top: 14%;
    padding: 6px 14px 8px;
  }
  .count {
    top: 28%;
    font-size: 80px;
  }
}
