/*
 * 텐 타워 — 크림 & 겨자
 * 크림색 바탕에 얇은 남색 선(1.5px), 그림자 없음. 로고의 겨자·코랄·하늘색만 써요.
 * 글꼴: 제목·버튼은 도현, 숫자는 Rubik, 글은 IBM Plex Sans KR.
 * 합해서 10이 되는 짝(1·9, 2·8, 3·7, 4·6)은 같은 색 계열이에요. 작은 수는 연하게, 큰 수는 진하게.
 */
:root {
  --bg: #f7efdf;
  --card: #fffbf2;
  --soft: #f3e9d4;
  --ink: #26324a;
  --sub: #7a7462;
  --coral: #e8553e;
  --mustard: #f2b640;
  --butter: #f8de8a;
  --sky: #cde9f1;
  --pink: #f6c9d7;
  --board: #e6f2f5;
  --line: 1.5px solid var(--ink);
  --cell: 54px;
  --bw: calc(var(--cell) * 6 + 3px); /* 판 폭 (테두리 포함) */
  --head: "Do Hyeon", "IBM Plex Sans KR", sans-serif;
  --ui: "IBM Plex Sans KR", system-ui, sans-serif;
  --num: "Rubik", "IBM Plex Sans KR", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
html, body { background: var(--bg); }
body {
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }
a { color: inherit; }

.screen { display: none; }
.screen.active { display: flex; }

/* ---------- 공통 ---------- */
.card { background: var(--card); border: var(--line); border-radius: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 6px 16px;
  background: var(--card);
  color: var(--ink);
  border: var(--line);
  border-radius: 12px;
  font-family: var(--head);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, .chip:focus-visible, .mode-card:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.btn-start { background: var(--mustard); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--sub); font-family: var(--ui); font-weight: 700; font-size: 15px; }

.chip {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 0 12px;
  background: var(--card);
  border: var(--line);
  border-radius: 8px;
  font-family: var(--num);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.chip:active { transform: scale(0.96); }

/* 숫자 블록 */
.b {
  display: grid;
  place-items: center;
  background: var(--c, var(--card));
  color: var(--t, var(--ink));
  border: var(--line);
  border-radius: 18%;
  font-family: var(--num);
  font-weight: 700;
  font-style: normal;
  line-height: 1;
}
.n1 { --c: #f6c9d7; }   .n9 { --c: #e8553e; --t: #fff; }
.n2 { --c: #f8de8a; }   .n8 { --c: #f2a23c; }
.n3 { --c: #cde9f1; }   .n7 { --c: #5aa9c4; --t: #fff; }
.n4 { --c: #d5ecc9; }   .n6 { --c: #6fb36c; --t: #fff; }
.n5 { --c: #ece4f6; }
.b.star { --c: var(--card); --t: var(--mustard); }
.b.bomb { --c: var(--ink); --t: var(--butter); }
.b svg { width: 64%; height: 64%; display: block; }

/* ---------- 첫 화면 ---------- */
#title {
  flex-direction: column;
  gap: 14px;
  width: min(100%, 440px);
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.back { font-family: var(--num); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; text-decoration: none; }
.top-btns { display: flex; gap: 6px; }

.title-logo { display: flex; justify-content: center; margin: -4px 0 -6px; }
.title-logo img { display: block; width: min(270px, 72vw); height: auto; }
.tagline { margin: 0; text-align: center; font-family: var(--head); font-size: 19px; line-height: 1.3; }
.tagline b { font-weight: 400; color: var(--coral); }

.menu { display: grid; gap: 12px; padding: 14px; }
#startBtn { width: 100%; min-height: 56px; font-size: 23px; }
.play { width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent currentColor; }

.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  column-gap: 8px;
  row-gap: 5px;
  min-width: 0;
  padding: 10px;
  border: var(--line);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s;
}
.mode-card:active { transform: scale(0.97); }
.m-daily { background: var(--sky); }
.m-vs { background: var(--pink); }
.mode-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; font-family: var(--num); font-weight: 700; font-size: 13px; }
.cal { position: relative; padding-top: 7px; background: #fff; border: var(--line); }
.cal::before { content: ""; position: absolute; left: -1.5px; right: -1.5px; top: -1.5px; height: 9px; background: var(--coral); border: var(--line); border-radius: 7px 7px 0 0; }
.cal b { position: relative; font-size: 13px; line-height: 1; }
.vs-icon { background: var(--ink); color: var(--butter); font-style: italic; }
.mc-title { font-family: var(--head); font-size: 17px; line-height: 1.2; white-space: nowrap; }
.mc-sub { grid-column: 1 / -1; font-size: 12px; line-height: 1.3; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rules { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 7px; background: var(--soft); border-radius: 12px; }
.rules li { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.rules .pics { flex: none; display: flex; gap: 4px; width: 68px; }
.rules .b, .rules .gap { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }
.rules .gap { border: 1.5px dashed rgba(38, 50, 74, 0.35); }
.best-line { margin: 0; display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; font-size: 13px; font-weight: 700; }
.best-line b { font-family: var(--num); font-weight: 700; font-size: 18px; }

.hof { padding: 14px; }
.hof-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.hof-title { font-family: var(--head); font-size: 18px; }
.hof-top { font-family: var(--num); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; color: var(--sub); }
.hof-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-bottom: 14px; background: var(--soft); border-radius: 10px; }
.hof-tab.chip { min-height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--sub); font-family: var(--ui); font-weight: 700; font-size: 13px; }
.hof-tab[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; }
.pod { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pod-nm { max-width: 100%; padding: 0 2px; font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-sc { font-family: var(--num); font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.pod-step {
  display: grid;
  place-items: start center;
  width: 100%;
  padding-top: 6px;
  border: var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-family: var(--num);
  font-weight: 700;
  font-size: 18px;
}
.pod.p1 .pod-step { height: 64px; background: var(--mustard); }
.pod.p2 .pod-step { height: 46px; background: var(--sky); }
.pod.p3 .pod-step { height: 34px; background: var(--pink); }
.pod.empty .pod-nm { color: var(--sub); }
.pod.empty .pod-step { background: var(--soft); color: var(--sub); }
.pod.me .pod-nm { color: var(--coral); }

.hof-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: var(--line); }
.hof-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px 4px; }
.hof-list li + li { border-top: 1px solid rgba(38, 50, 74, 0.12); }
.hof-list .rk { font-family: var(--num); font-weight: 700; font-size: 13px; text-align: center; color: var(--sub); }
.hof-list .nm { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hof-list .sc { font-family: var(--num); font-weight: 700; font-size: 14px; }
.hof-list li.hof-msg { display: block; padding: 14px 4px 4px; color: var(--sub); text-align: center; font-size: 14px; }
.hof-list li.me .nm { color: var(--coral); }
.podium[hidden] + .hof-list { border-top: 0; }

.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-size: 13px; color: var(--sub); }

/* ---------- 게임 화면 ---------- */
#game {
  height: 100dvh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: calc(10px + env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom));
  overflow: hidden;
}
.console {
  display: grid;
  gap: 10px;
  width: min(calc(100vw - 24px), 420px);
  padding: 12px;
}
.con-top { display: grid; grid-template-columns: 58px 1fr 58px; align-items: center; gap: 8px; }
.mini-logo img { display: block; width: 58px; height: auto; }
.con-mid { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.mode-name { min-width: 0; font-family: var(--head); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 텐이: 판 상황에 따라 표정이 바뀌어요 */
.tenny { flex: none; width: 34px; height: 34px; overflow: visible; }
.tenny .f { display: none; }
.tenny[data-mood="idle"] .f-idle, .tenny[data-mood="happy"] .f-happy, .tenny[data-mood="happy-l"] .f-happy,
.tenny[data-mood="worry"] .f-worry, .tenny[data-mood="panic"] .f-panic, .tenny[data-mood="sad"] .f-sad { display: inline; }
.tenny .t-body { transform-origin: 18px 32px; }
.tenny.hop .t-body { animation: hop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes hop { 30% { transform: translateY(-6px) scale(1.05, 0.95); } 60% { transform: translateY(0) scale(1.08, 0.92); } }
.tenny[data-mood="happy-l"] .t-body { animation: dance 0.5s ease-in-out infinite; }
@keyframes dance { 25% { transform: rotate(-8deg) translateY(-2px); } 75% { transform: rotate(8deg) translateY(-2px); } }
.tenny[data-mood="panic"] .t-body { animation: tremble 0.18s linear infinite; }
@keyframes tremble { 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
.tenny[data-mood="sad"] .t-body { transform: translateY(2px) scale(1.04, 0.96); }
.btn-pause.btn { justify-self: end; min-height: 0; width: 36px; height: 36px; padding: 0; gap: 4px; border-radius: 10px; }
.btn-pause i { width: 4px; height: 12px; border-radius: 1px; background: currentColor; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; min-width: 0; padding: 6px 10px; background: var(--soft); border-radius: 10px; }
.stat span { font-size: 11px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.stat b { font-family: var(--num); font-weight: 700; font-size: 16px; line-height: 1.3; }
.stat-score { background: var(--ink); color: var(--butter); }
.stat-score span { color: inherit; opacity: 0.75; }
.stat-score.bump { animation: bump 0.28s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes bump { 40% { transform: scale(1.08); } }

.rise { display: flex; align-items: center; gap: 8px; }
.rise-k { font-size: 11px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.rise-bar { flex: 1; height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.rise-bar i { display: block; height: 100%; width: 0; background: var(--mustard); border-radius: 99px; }
.rise-bar.hurry i { background: var(--coral); }
.rise-s { min-width: 36px; text-align: right; font-family: var(--num); font-weight: 700; font-size: 12px; }

/* 대전 정보 */
.vs-strip { height: 64px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vs-in, .vs-opp { min-width: 0; padding: 6px 10px; background: var(--soft); border-radius: 10px; }
.vs-in { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.vs-k { font-size: 11px; font-weight: 700; color: var(--sub); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-pend { display: flex; align-items: center; gap: 3px; height: 20px; }
.vs-pend i { width: 14px; height: 14px; background: var(--coral); border: var(--line); border-radius: 4px; }
.vs-pend b { font-family: var(--num); font-weight: 700; font-size: 12px; color: var(--coral); }
.vs-pend span { color: var(--sub); }
.vs-pend.soon i { animation: blink 0.3s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.vs-opp { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.vs-opp-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.vs-opp-txt b { font-family: var(--num); font-weight: 700; font-size: 15px; }
#oppCv { width: 30px; height: 50px; flex: none; background: var(--board); border: var(--line); border-radius: 4px; }
#oppCv.hot { border-color: var(--coral); }

/* 판 */
.board-wrap { position: relative; justify-self: center; }
.board {
  position: relative;
  width: var(--bw);
  height: calc(var(--cell) * 10 + 3px);
  background: var(--board);
  border: var(--line);
  border-radius: 12px;
  touch-action: none;
  overflow: hidden;
}
/* 꼭대기 위험선 */
.board::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: var(--cell);
  background: repeating-linear-gradient(-45deg, rgba(232, 85, 62, 0.12) 0 6px, transparent 6px 12px);
  border-bottom: 1.5px dashed var(--coral);
  pointer-events: none;
}
.board.danger { animation: danger 0.5s steps(1) infinite; }
@keyframes danger { 50% { background-color: #fbe0d8; } }
.board-wrap.shake-s { animation: shake-s 0.22s ease-out; }
.board-wrap.shake-l { animation: shake-l 0.32s ease-out; }
@keyframes shake-s { 25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, 0); } }
@keyframes shake-l { 15% { transform: translate(-6px, 3px) rotate(-0.6deg); } 35% { transform: translate(5px, -3px) rotate(0.5deg); } 55% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, -1px); } }
.console.punch { animation: punch 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes punch { 30% { transform: scale(1.035); } }

.cell {
  position: absolute;
  left: 0; top: 0;
  width: var(--cell);
  height: var(--cell);
  padding: 3px;
  transition: transform 0.24s cubic-bezier(0.34, 1.45, 0.6, 1); /* 내려와서 살짝 통 튀며 착지 */
  will-change: transform;
}
.cell .b { width: 100%; height: 100%; font-size: calc(var(--cell) * 0.4); transition: transform 0.08s; }
.cell.new .b { animation: rise 0.18s ease-out; }
@keyframes rise { from { transform: translateY(40%); opacity: 0.4; } }

.links { position: absolute; left: 0; top: 0; width: calc(var(--cell) * 6); height: calc(var(--cell) * 10); z-index: 2; pointer-events: none; overflow: visible; }
.link { fill: none; stroke: var(--ink); stroke-opacity: 0.35; stroke-width: calc(var(--cell) * 0.16); stroke-linejoin: round; stroke-linecap: round; }
.link.ok { stroke: var(--mustard); stroke-opacity: 1; }
.link.over { stroke: var(--coral); stroke-opacity: 0.8; }
.cell.sel { z-index: 3; }
.cell.hinted .b { animation: hinted 0.9s steps(2) infinite; }
@keyframes hinted { 50% { transform: scale(1.06); box-shadow: 0 0 0 3px var(--mustard); } }
.cell.sel .b { transform: scale(0.9); box-shadow: 0 0 0 3px var(--ink); }
.cell.sel.ok .b { box-shadow: 0 0 0 3px var(--mustard); }
.cell.sel.over .b { box-shadow: 0 0 0 3px var(--coral); }
.cell.pop { transition: none; }
.cell.pop { z-index: 4; }
.cell.pop .b { animation: pop 0.24s ease-out forwards; }
@keyframes pop { 0% { transform: scale(1.12); } 35% { transform: scale(1.2); } to { transform: scale(0.3); opacity: 0; } }
/* 번쩍: 흰 막을 겹쳐요(필터보다 훨씬 가벼워요) */
.cell.hit .b, .cell.pop .b { position: relative; }
.cell.hit .b::before, .cell.pop .b::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #fff; opacity: 0.75; }
.cell.pop .b::before { animation: flash 0.2s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
.cell.hit { z-index: 4; }
.cell.hit .b { transform: scale(1.12); transition: none; }
.cell.tap .b { animation: tap 0.2s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes tap { 0% { transform: scale(0.76); } 100% { transform: scale(0.9); } }

/* 아래 줄 */
.play-foot { display: flex; align-items: center; gap: 10px; }
.bomb-btn {
  --g: 0%;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--line);
  border-radius: 50%;
  background: conic-gradient(var(--mustard) var(--g), var(--soft) 0);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s;
}
.bomb-btn:disabled { cursor: default; }
.bomb-in { display: grid; place-items: center; width: 32px; height: 32px; background: var(--card); border: var(--line); border-radius: 50%; }
.bomb-in svg { width: 18px; height: 18px; display: block; }
.bomb-btn:disabled .bomb-in { color: rgba(38, 50, 74, 0.35); }
.bomb-btn.ready { animation: ready 0.9s ease-in-out infinite; }
.bomb-btn.ready .bomb-in { background: var(--mustard); }
.bomb-btn.aiming { background: var(--coral); animation: none; }
.bomb-btn.aiming .bomb-in { background: var(--coral); color: #fff; border-color: var(--ink); }
.bomb-btn:active:not(:disabled) { transform: scale(0.94); }
.bomb-btn:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
@keyframes ready { 50% { transform: scale(1.08); } }
.board.aiming { cursor: crosshair; box-shadow: 0 0 0 3px var(--coral); }
.board.aiming .cell .b { opacity: 0.85; }
.rise-bar.slow i { background: var(--sky); }
.rise-bar.fever i { background: repeating-linear-gradient(90deg, var(--mustard) 0 8px, var(--butter) 8px 16px); }
.board.fever { background: #fff3cc; box-shadow: 0 0 0 4px var(--mustard); }
.cell.ice .b { position: relative; }
.cell.ice .b::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  border: 2.5px solid #3f93b3;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0 12%, transparent 12% 26%, rgba(255, 255, 255, 0.7) 26% 32%, transparent 32% 70%, rgba(255, 255, 255, 0.6) 70% 74%, transparent 74%),
    rgba(222, 242, 250, 0.8);
}
.say { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; min-height: 40px; }
.hint b { color: var(--coral); font-weight: 700; }
.hint { margin: 0; text-wrap: balance; font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--sub); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sum-bubble {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  font-family: var(--num);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sum-bubble.over { color: var(--coral); }
.sum-bubble.ok { color: #c98a12; }
.btn-up.btn { flex: none; min-height: 40px; padding: 2px 14px; gap: 7px; font-size: 15px; background: var(--coral); color: #fff; }
.up-arrow { width: 0; height: 0; border-style: solid; border-width: 0 5px 7px 5px; border-color: transparent transparent currentColor transparent; }

@media (max-height: 700px) {
  .console { gap: 8px; padding: 10px; }
  .vs-strip { height: 54px; }
  .stat { padding: 4px 8px; }
}

/* ---------- 강화 카드 ---------- */
.card-pick { max-width: 380px; }
.card-pick .modal-note { margin: 4px 0 14px; }
.card-list { display: grid; gap: 10px; }
.pick-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 12px;
  text-align: left;
  border: var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s;
  animation: deal 0.35s cubic-bezier(0.3, 1.5, 0.5, 1) backwards;
}
.pick-card:nth-child(2) { animation-delay: 0.06s; }
.pick-card:nth-child(3) { animation-delay: 0.12s; }
@keyframes deal { from { transform: translateY(16px) scale(0.92); opacity: 0; } }
.pick-card:active { transform: scale(0.97); }
.pick-card:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.pick-card.k0 { background: var(--sky); }
.pick-card.k1 { background: var(--butter); }
.pick-card.k2 { background: var(--pink); }
.pc-g { grid-row: 1 / 3; display: grid; place-items: center; width: 52px; height: 52px; background: var(--card); border: var(--line); border-radius: 10px; font-family: var(--num); font-weight: 700; font-size: 17px; white-space: nowrap; }
.pc-g.sm { font-size: 14px; letter-spacing: -0.02em; }
.pc-t { font-family: var(--head); font-size: 18px; line-height: 1.25; }
.pc-d { font-size: 13px; line-height: 1.4; color: var(--ink); opacity: 0.75; }
.pc-n { position: absolute; top: 8px; right: 10px; font-family: var(--num); font-weight: 700; font-size: 12px; }
.my-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 4px; }
.mc-k { width: 100%; font-size: 12px; font-weight: 700; color: var(--sub); }
.mc-chip { padding: 3px 10px; background: var(--soft); border-radius: 99px; font-size: 13px; font-weight: 700; }

/* ---------- 처음 보는 아이템 설명 ---------- */
.coach { position: fixed; inset: 0; z-index: 55; }
.coach-spot {
  position: fixed;
  box-shadow: 0 0 0 9999px rgba(38, 50, 74, 0.6);
  outline: 3px solid var(--mustard);
  outline-offset: 0;
  pointer-events: none;
  animation: spot 0.8s ease-in-out infinite;
}
@keyframes spot { 50% { outline-color: var(--card); outline-offset: 4px; } }
.coach-tip {
  --ax: 50%;
  position: fixed;
  width: min(300px, calc(100vw - 24px));
  display: grid;
  gap: 6px;
  padding: 14px 16px 16px;
}
.coach-tip::after {
  content: "";
  position: absolute;
  left: calc(var(--ax) - 8px);
  width: 14px;
  height: 14px;
  background: var(--card);
  border: var(--line);
  transform: rotate(45deg);
}
.coach-tip[data-side="below"]::after { top: -8.5px; border-right: 0; border-bottom: 0; }
.coach-tip[data-side="above"]::after { bottom: -8.5px; border-left: 0; border-top: 0; }
.coach-title { font-family: var(--head); font-weight: 400; font-size: 20px; line-height: 1.3; }
.coach-text { margin: 0 0 6px; font-size: 14px; line-height: 1.5; color: var(--sub); text-wrap: pretty; }
.coach-tip .btn { min-height: 44px; font-size: 17px; }

/* ---------- 팝업 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(38, 50, 74, 0.45);
}
#pauseBox { background: rgba(247, 239, 223, 0.94); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px 16px 16px;
  text-align: center;
  background: var(--card);
  border: var(--line);
  border-radius: 16px;
}
.pause-title, .over-title { font-family: var(--head); font-weight: 400; font-size: 30px; line-height: 1.2; }
.modal-note { color: var(--sub); margin: 8px 0 14px; font-size: 14px; }
.modal-actions { display: grid; gap: 10px; margin-top: 16px; }
.modal-actions .btn { width: 100%; }

.over-score { margin-top: 4px; font-family: var(--num); font-weight: 700; font-size: 46px; line-height: 1.15; }
.over-badge { margin-top: 8px; display: inline-block; padding: 3px 12px; background: var(--butter); border: var(--line); border-radius: 99px; font-weight: 700; font-size: 13px; }
.over-stats { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.over-stats div { display: flex; flex-direction: column; gap: 2px; padding: 7px 4px; background: var(--soft); border-radius: 10px; }
.over-stats span { font-size: 11px; font-weight: 700; color: var(--sub); }
.over-stats b { font-family: var(--num); font-weight: 700; font-size: 17px; }

.rank-form { margin-top: 14px; padding: 12px; background: var(--soft); border-radius: 12px; }
.rank-msg { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.rank-row { display: flex; gap: 6px; }
.rank-row input, .vs-sec > input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 6px 12px;
  border: var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.rank-row .btn { min-height: 48px; padding: 4px 16px; flex: none; }
.rank-hint { margin: 8px 0 0; min-height: 20px; font-size: 13px; color: var(--sub); }
.rank-hint.err { color: #c23a24; }
.rank-hint:empty { display: none; }

/* 대전 고르기 */
.vs-sec { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(38, 50, 74, 0.15); text-align: left; }
.vs-sec h2 { margin: 0; font-family: var(--head); font-weight: 400; font-size: 18px; }
.vs-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vs-row3 .btn { padding: 4px; font-size: 17px; }
.vs-row3 .btn:nth-child(1) { background: #d5ecc9; }
.vs-row3 .btn:nth-child(2) { background: var(--butter); }
.vs-row3 .btn:nth-child(3) { background: var(--pink); }
#vsHome > .btn-ghost { width: 100%; margin-top: 6px; }
.vs-code { margin: 4px 0 12px; padding: 8px 0 8px 0.3em; background: #fff; border: var(--line); border-radius: 10px; font-family: var(--num); font-weight: 700; font-size: 30px; letter-spacing: 0.3em; }
.vs-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.vs-players span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-players span.empty { color: var(--sub); font-weight: 500; }
.vs-players b { font-family: var(--num); font-weight: 700; font-style: italic; font-size: 15px; color: var(--coral); }

.countdown {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(247, 239, 223, 0.6);
  pointer-events: none;
}
.countdown span { font-family: var(--num); font-weight: 700; font-size: 96px; color: var(--coral); animation: cd 0.6s ease-out; }
@keyframes cd { from { transform: scale(1.8); opacity: 0; } }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.fx-cv { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 44; }
.fx-combo {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--num);
  font-weight: 700;
  white-space: nowrap;
  color: var(--mustard);
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  animation: combo 0.8s cubic-bezier(0.3, 1.6, 0.5, 1) forwards;
}
.fx-combo.c4, .fx-combo.c5 { color: #f2a23c; }
.fx-combo.c6 { color: var(--coral); }
@keyframes combo {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1); }
  80% { transform: translate(-50%, -80%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -110%) scale(0.9); opacity: 0; }
}
.fx-pt {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--num);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  -webkit-text-stroke: 4px var(--card);
  paint-order: stroke fill;
  white-space: nowrap;
  animation: fly 0.9s ease-out forwards;
}
.fx-pt.big { font-family: var(--head); font-weight: 400; font-size: 24px; color: var(--coral); }
@keyframes fly { to { transform: translate(-50%, -170%); opacity: 0; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--card);
  border-radius: 99px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
