/* 주루마블 판 — 오버레이와 관리 페이지 미리보기가 함께 씁니다. */

.jm-stage {
  position: relative;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.jm-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

/* ---------------- 칸 ---------------- */

.jm-cell {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius);
  border: 4px solid #fff;
  box-shadow: 0 4px 0 rgba(74, 54, 64, 0.18), 0 8px 18px rgba(74, 54, 64, 0.12);
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.jm-cell-label {
  white-space: pre-line;
  line-height: 1.15;
  word-break: keep-all;
}

.jm-cell-sub {
  opacity: 0.75;
  line-height: 1.1;
  white-space: pre-line;
}

.jm-cell-no {
  position: absolute;
  top: 4px;
  left: 6px;
  font: 700 14px/1 'Pretendard', sans-serif;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.is-hidden-cells .jm-cell {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none;
}

.jm-cell.is-landed {
  transform: scale(1.08);
  z-index: 3;
  box-shadow: 0 0 0 6px var(--accent), 0 0 40px 10px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: jm-landed 0.9s ease-in-out infinite alternate;
}

.is-hidden-cells .jm-cell.is-landed {
  transform: none;
  border-color: var(--accent);
  border-width: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent) !important;
}

@keyframes jm-landed {
  from { box-shadow: 0 0 0 5px var(--accent), 0 0 24px 4px color-mix(in srgb, var(--accent) 60%, transparent); }
  to   { box-shadow: 0 0 0 8px var(--accent), 0 0 48px 16px color-mix(in srgb, var(--accent) 80%, transparent); }
}

/* 관리 페이지 편집 모드 */
.is-editor .jm-cell { cursor: pointer; }
.is-editor.is-hidden-cells .jm-cell { border: 3px dashed rgba(255, 60, 140, 0.9); }
.is-editor .jm-cell.is-selected {
  outline: 6px solid #2f7bff;
  outline-offset: 2px;
  z-index: 4;
}
.is-editor .jm-slot { outline: 3px dashed rgba(47, 123, 255, 0.55); outline-offset: -3px; }
.is-editor .jm-slot::before {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font: 700 34px/1.2 'Pretendard', sans-serif;
  color: rgba(47, 123, 255, 0.85);
  text-align: center;
  white-space: pre-line;
}

/* ---------------- 말 ---------------- */

.jm-piece {
  position: absolute;
  z-index: 6;
  transition: left var(--hop, 260ms) cubic-bezier(.3, .7, .3, 1), top var(--hop, 260ms) cubic-bezier(.3, .7, .3, 1), opacity 0.35s;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35));
}

.jm-piece > span,
.jm-piece > img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--ring);
  box-sizing: border-box;
  object-fit: cover;
  line-height: 1;
}

.jm-piece.is-hopping > span,
.jm-piece.is-hopping > img {
  animation: jm-hop var(--hop, 260ms) ease-out;
}

@keyframes jm-hop {
  0%   { transform: translateY(0) scale(1, 1); }
  45%  { transform: translateY(-38%) scale(0.95, 1.05); }
  85%  { transform: translateY(0) scale(1.08, 0.92); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* ---------------- 안쪽 3칸 ---------------- */

.jm-slot {
  position: absolute;
  box-sizing: border-box;
  padding: 14px;
}

.jm-stack {
  display: grid;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.jm-panel {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  border-radius: 26px;
  background: var(--panel-bg);
  box-shadow: 0 6px 0 rgba(74, 54, 64, 0.12), 0 14px 30px rgba(74, 54, 64, 0.16);
  border: 4px solid #fff;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.jm-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 10px;
  white-space: nowrap;
  flex: none;
}

.jm-panel-title small {
  margin-left: auto;
  font-size: 20px;
  color: var(--ink);
  opacity: 0.55;
}

/* 프로필 사진 */
.jm-ava {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 22%, #fff);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.jm-ava i {
  font-style: normal;
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}
.jm-ava img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.jm-ava.has-img img { opacity: 1; }
.jm-ava.has-img i { visibility: hidden; }
.jm-ava.emoji { background: #fff; }
.jm-ava.sm { width: 38px; height: 38px; border-width: 2px; }
.jm-ava.sm i { font-size: 18px; }
.jm-ava.lg { width: 110px; height: 110px; border-width: 5px; box-shadow: 0 0 0 4px var(--accent); }
.jm-ava.lg i { font-size: 50px; }

/* 기록 */
.jm-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.jm-history li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  animation: jm-pop-in 0.45s cubic-bezier(.2, 1.4, .4, 1);
  flex: none;
}

.jm-history li:first-child {
  background: color-mix(in srgb, var(--accent) 20%, #fff);
}

.jm-history p {
  margin: 0;
  font-size: 23px;
  line-height: 1.3;
  word-break: keep-all;
  min-width: 0;
}

.jm-history b { font-weight: 400; color: var(--accent); }
.jm-history em { font-style: normal; color: var(--accent); }

.jm-history time {
  font: 600 15px/1 'Pretendard', sans-serif;
  opacity: 0.45;
  margin-left: 8px;
  white-space: nowrap;
}

.jm-empty, .jm-empty-li {
  margin: auto;
  font-size: 24px;
  opacity: 0.45;
  text-align: center;
  list-style: none;
  background: none !important;
  animation: none !important;
}

/* 확정권 */
.jm-tickets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.jm-more {
  flex: none;
  margin-top: 6px;
  text-align: center;
  font-size: 20px;
  color: var(--accent);
}

.jm-tickets li {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  border: 3px solid transparent;
  box-sizing: border-box;
  animation: jm-pop-in 0.45s cubic-bezier(.2, 1.4, .4, 1);
  transition: height 0.45s ease, padding 0.45s ease, margin 0.45s ease, opacity 0.35s ease, transform 0.45s ease, border-color 0.2s;
}

.jm-t-nick {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jm-t-badge {
  flex: none;
  font-size: 18px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  border: 2px solid color-mix(in srgb, var(--accent) 45%, #fff);
  white-space: nowrap;
}

.jm-t-stamp {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg) scale(2.4);
  padding: 2px 14px;
  border: 4px solid #e5484d;
  border-radius: 10px;
  color: #e5484d;
  background: rgba(255, 255, 255, 0.92);
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
}

/* 수행 완료: 도장 쾅 → 줄 긋기 → 접히며 사라짐 */
.jm-tickets li.is-done {
  border-color: #e5484d;
  background: #fff;
}
.jm-tickets li.is-done .jm-t-stamp {
  animation: jm-stamp 0.35s cubic-bezier(.3, 1.6, .5, 1) forwards;
}
.jm-tickets li.is-done .jm-t-nick,
.jm-tickets li.is-done .jm-t-badge {
  text-decoration: line-through;
  text-decoration-thickness: 3px;
  opacity: 0.45;
  transition: opacity 0.3s;
}
.jm-tickets li.is-leaving {
  height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: -8px;
  opacity: 0;
  transform: translateX(-40px) scale(0.9);
  overflow: hidden;
}

@keyframes jm-stamp {
  from { opacity: 0; transform: translateY(-50%) rotate(-12deg) scale(2.4); }
  to   { opacity: 1; transform: translateY(-50%) rotate(-12deg) scale(1); }
}

/* 현황 */
.jm-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.jm-stat {
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  padding: 10px 14px;
  min-width: 0;
}

.jm-stat.wide { grid-column: 1 / -1; }

.jm-stat-label {
  font-size: 19px;
  opacity: 0.6;
}

.jm-stat-value {
  font-size: 42px;
  line-height: 1.15;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jm-stat-value.small { font-size: 32px; }

.jm-tcounts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 24px;
}
.jm-tcounts b { font-weight: 400; color: var(--accent); }

.jm-next {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: 22px;
}

.jm-next li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
}

.jm-next li b { color: var(--accent); font-weight: 400; }

/* ---------------- 주사위·결과 카드 ---------------- */

.jm-fx {
  position: absolute;
  inset: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-radius: 26px;
  transition: background 0.3s;
}

.jm-fx.is-on { background: rgba(255, 255, 255, 0.35); }

.jm-dice-wrap {
  position: absolute;
  perspective: 900px;
  width: 170px;
  height: 170px;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(.2, 1.5, .4, 1);
}

.jm-dice-wrap.is-on {
  opacity: 1;
  transform: scale(1);
}

.jm-dice {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.jm-face {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border-radius: 26px;
  background: #fff;
  border: 6px solid var(--accent);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 20px;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.06);
  backface-visibility: hidden;
}

.jm-face i {
  width: 30px;
  height: 30px;
  margin: auto;
  border-radius: 50%;
  background: var(--accent);
  visibility: hidden;
}

.jm-face i.on { visibility: visible; }
.jm-face.f1 i.on { background: #ff3b5c; width: 40px; height: 40px; }

.jm-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92%;
  max-width: 620px;
  box-sizing: border-box;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  border-radius: 30px;
  background: #fff;
  border: 6px solid var(--accent);
  box-shadow: 0 10px 0 color-mix(in srgb, var(--accent) 45%, transparent), 0 24px 50px rgba(74, 54, 64, 0.3);
  padding: 24px 22px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: opacity 0.25s, transform 0.4s cubic-bezier(.2, 1.5, .4, 1);
}

.jm-card.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.jm-card .jm-ava { margin-bottom: 8px; }
.jm-card-emoji { font-size: 80px; line-height: 1.1; }
.jm-card-line { font-size: 30px; line-height: 1.3; word-break: keep-all; }
.jm-card-line b { font-weight: 400; color: var(--accent); }
.jm-card-line em { font-style: normal; color: var(--accent); }
.jm-card-main {
  font-size: 58px;
  line-height: 1.15;
  color: var(--accent);
  margin: 4px 0;
  word-break: keep-all;
  white-space: pre-line;
}
.jm-card-lap {
  margin-top: 10px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
}

@keyframes jm-pop-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.92); }
  to   { opacity: 1; transform: none; }
}
