/* ======================================================
   치이카와 몽글몽글 테트리스 - 파스텔 동화풍 디자인 시스템
   ====================================================== */

:root {
  --ink: #5a3b2c;
  --ink-soft: #856250;
  --cream: #fffcf7;
  --pink: #ff8fab;
  --pink-dark: #e66287;
  --yellow: #ffd43b;
  --yellow-dark: #e0a800;
  --blue: #74c0fc;
  --blue-dark: #339af0;
  --lavender: #d0bfff;
  --mint: #b2f2bb;
  --shadow: 0 8px 24px rgba(110, 72, 54, 0.16);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Jua', 'Gaegu', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background: #fff5f8;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

/* 동적 배경 레이어 */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image: url('../assets/images/bg_meadow.jpg');
  background-size: cover;
  background-position: center;
  transition: background-image 0.9s ease, filter 0.6s ease;
  filter: brightness(1.03) saturate(1.05);
}

.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 252, 246, 0.28), rgba(255, 240, 246, 0.55));
}

.fever-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 143, 171, 0.25), rgba(255, 212, 59, 0.25), rgba(116, 192, 252, 0.25), rgba(208, 191, 255, 0.25));
  background-size: 300% 300%;
  animation: feverShift 2.5s linear infinite;
}

@keyframes feverShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 배경에 둥둥 떠다니는 귀여운 장식 */
.floating-deco {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.floating-deco span {
  position: absolute;
  font-size: 26px;
  opacity: 0.45;
  animation: floatUp 11s ease-in-out infinite;
}
.floating-deco span:nth-child(1) { left: 6%; top: 18%; animation-delay: 0s; }
.floating-deco span:nth-child(2) { left: 89%; top: 24%; animation-delay: 2s; }
.floating-deco span:nth-child(3) { left: 12%; top: 75%; animation-delay: 4s; }
.floating-deco span:nth-child(4) { left: 85%; top: 72%; animation-delay: 1.5s; }
.floating-deco span:nth-child(5) { left: 50%; top: 10%; animation-delay: 3s; }
.floating-deco span:nth-child(6) { left: 74%; top: 48%; animation-delay: 5s; }

@keyframes floatUp {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(12deg); }
}

/* 말랑말랑 젤리 버튼 공통 */
.jelly-btn {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.jelly-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--ink);
}

.jelly-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

.jelly-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: 0 3px 0 rgba(90, 59, 44, 0.5);
}

.btn-pink { background: linear-gradient(180deg, #ffd6e0, #ff9eb5); }
.btn-yellow { background: linear-gradient(180deg, #fff3b8, #ffd43b); }
.btn-blue { background: linear-gradient(180deg, #d0ebff, #74c0fc); }

.btn-start {
  font-size: 1.55rem;
  padding: 16px 46px;
  background: linear-gradient(180deg, #ffdeeb, #ff8fab);
  color: #5a2636;
  animation: gentleBounce 2.2s ease-in-out infinite;
}

@keyframes gentleBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ================= 로비 화면 ================= */
.lobby-screen {
  max-width: 1060px;
  margin: 0 auto;
  padding: 16px 18px 40px;
}

.lobby-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.coin-pill, .collection-pill {
  background: rgba(255, 252, 247, 0.95);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 7px 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 1.05rem;
  box-shadow: 0 4px 0 rgba(90, 59, 44, 0.18);
}

.coin-pill strong {
  color: #e8590c;
  font-size: 1.2rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 히어로 타이틀 배너 */
.hero-card {
  background: rgba(255, 252, 247, 0.92);
  border: 4px solid var(--ink);
  border-radius: 28px;
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.hero-banner-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid #f3d9c6;
  aspect-ratio: 16 / 6.2;
  background: #ffeef4;
}

.hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  display: block;
}

.hero-title-badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(255, 252, 247, 0.94);
  border: 4px solid var(--ink);
  border-radius: 24px;
  padding: 8px 28px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(90, 59, 44, 0.25);
  white-space: nowrap;
}

.hero-sub {
  display: block;
  font-size: 0.88rem;
  color: #e64980;
}

.hero-title-badge h1 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 3.2vw, 2.2rem);
  color: var(--ink);
  text-shadow: 2px 2px 0 #ffd6e0;
}

/* 패널 카드 */
.panel-card {
  background: rgba(255, 252, 247, 0.93);
  border: 4px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.panel-tip {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* 캐릭터 선택 그리드 */
.char-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.char-card {
  background: #ffffff;
  border: 3px solid #e6d5c8;
  border-radius: 20px;
  padding: 10px 6px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.char-card:hover {
  transform: translateY(-4px);
  border-color: var(--pink);
}

.char-card.selected {
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, #fff5f8, #ffe3ec);
  box-shadow: 0 5px 0 var(--ink);
  transform: translateY(-4px);
}

.char-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ink);
  background: #fff;
  display: block;
  margin: 0 auto 6px;
}

.char-card .char-name {
  font-size: 1rem;
  display: block;
}

.char-card .char-skill-mini {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.selected-char-info {
  margin-top: 14px;
  background: #fff7eb;
  border: 3px dashed #f0b889;
  border-radius: 18px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.selected-char-info img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  object-fit: cover;
}

.selected-char-info .info-title {
  font-size: 1.15rem;
  margin-bottom: 3px;
}

.selected-char-info .info-skill {
  font-size: 0.96rem;
  color: #c2410c;
}

/* 모드 선택 그리드 */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.mode-card {
  background: #ffffff;
  border: 3px solid #e6d5c8;
  border-radius: 20px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
}

.mode-card.selected {
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, #fffdf0, #fff0c2);
  box-shadow: 0 5px 0 var(--ink);
  transform: translateY(-4px);
}

.mode-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-icon {
  font-size: 1.8rem;
}

.mode-badge {
  background: #ffe3ec;
  color: #c2255c;
  font-size: 0.76rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 2px solid #f7b2c7;
}

.mode-card h3 {
  margin: 2px 0 0;
  font-size: 1.12rem;
}

.mode-card p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--ink-soft);
  flex: 1;
}

.mode-best {
  font-size: 0.84rem;
  color: #d97706;
  padding-top: 6px;
  border-top: 2px dotted #f1dec9;
}

.start-btn-wrap {
  text-align: center;
  margin-top: 8px;
}

/* ================= 게임 플레이 화면 ================= */
.game-screen {
  width: 100%;
  max-width: 1640px;
  height: 100vh;
  margin: 0 auto;
  padding: 8px 18px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.game-theme-pill {
  background: rgba(255, 252, 247, 0.94);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  box-shadow: 0 3px 0 rgba(90, 59, 44, 0.16);
  white-space: nowrap;
}

.mode-mini-badge {
  background: #ffd43b;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.82rem;
}

.game-topbar-right {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.mini-btn {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: rgba(255, 252, 247, 0.95);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s;
  white-space: nowrap;
}

.mini-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-soft-red {
  background: #ffe3e3;
}

/* 3단 풀스크린 게임 레이아웃 (정보는 양옆으로, 가운데 보드는 초대형!) */
.game-layout {
  display: grid;
  grid-template-columns: clamp(235px, 22vw, 310px) 1fr clamp(235px, 22vw, 310px);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 4px;
}

.side-panel::-webkit-scrollbar {
  width: 6px;
}
.side-panel::-webkit-scrollbar-thumb {
  background: rgba(133, 98, 80, 0.25);
  border-radius: 999px;
}

.side-box {
  background: rgba(255, 252, 247, 0.92);
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 11px 12px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.box-title {
  font-size: 0.95rem;
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
}

.key-hint {
  font-size: 0.74rem;
  background: #f1e3d3;
  padding: 2px 7px;
  border-radius: 8px;
  color: var(--ink-soft);
}

#holdCanvas, .next-list canvas {
  display: block;
  margin: 0 auto;
  background: rgba(255, 247, 238, 0.85);
  border: 2px dashed #e2cbb8;
  border-radius: 14px;
}

.next-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 파트너 박스 (가로 정렬로 컴팩트 + 귀여움 업!) */
.partner-box {
  text-align: left;
}

.partner-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.partner-avatar-wrap {
  position: relative;
  width: 78px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.partner-avatar-wrap.bounce {
  animation: partnerJump 0.45s ease;
}

@keyframes partnerJump {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-9px) scale(1.08); }
  70% { transform: translateY(2px) scale(0.96); }
}

.partner-avatar-wrap img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 3.5px solid var(--ink);
  background: #fff;
  box-shadow: 0 4px 10px rgba(90, 59, 44, 0.2);
  display: block;
}

.partner-name-tag {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffd43b;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.speech-bubble {
  flex: 1;
  background: #fff9db;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 7px 9px;
  font-size: 0.86rem;
  line-height: 1.3;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auto-tag {
  background: #ffdeeb;
  color: #c2255c;
  border: 1.5px solid #f783ac;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.72rem;
  margin-left: 3px;
}

.auto-status-text {
  font-size: 0.76rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: -3px;
}

.auto-help-note {
  margin-top: 8px;
  padding: 6px 8px;
  background: #fff3bf;
  border: 2px dashed #f08c00;
  border-radius: 10px;
  font-size: 0.8rem;
  text-align: center;
  color: #b45309;
}

/* 게이지 바 */
.gauge-wrap {
  text-align: left;
  margin-bottom: 10px;
}

.gauge-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  margin-bottom: 4px;
}

.gauge-bar {
  height: 14px;
  background: #f0e4d8;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.gauge-fill {
  height: 100%;
  transition: width 0.25s ease;
  border-radius: 999px;
}

.skill-fill {
  background: linear-gradient(90deg, #ff8fab, #ffd43b);
}

.fever-fill {
  background: linear-gradient(90deg, #ff8fab, #ffd43b, #69db7c, #74c0fc, #da77f2);
  background-size: 200% 100%;
  animation: feverShift 2s linear infinite;
}

.rescue-badge {
  margin-top: 8px;
  background: #ffe3ec;
  border: 2px solid #f06595;
  color: #c2255c;
  border-radius: 12px;
  padding: 6px;
  font-size: 0.82rem;
  text-align: center;
}

/* 가운데 초대형 메인 보드 */
.board-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
}

.board-frame {
  position: relative;
  height: 100%;
  max-height: calc(100vh - 76px);
  aspect-ratio: 1 / 2;
  max-width: 100%;
  background: rgba(255, 252, 247, 0.94);
  border: 6px solid var(--ink);
  border-radius: 22px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(90, 59, 44, 0.26);
  transition: border-color 0.3s, box-shadow 0.3s;
  display: flex;
}

.game-screen.with-touch .board-frame {
  max-height: calc(100vh - 144px);
}

.board-frame.fever-active {
  border-color: #ff6b9d;
  box-shadow: 0 0 32px rgba(255, 107, 157, 0.8), 0 10px 26px rgba(90, 59, 44, 0.25);
}

#t_boardCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.9);
}

/* 보스 바 (왼쪽 사이드 패널용) */
.boss-bar {
  width: 100%;
  background: rgba(255, 250, 255, 0.96);
  border: 4px solid #7048e8;
  border-radius: 18px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.boss-bar.hit {
  animation: bossShake 0.25s ease;
}

@keyframes bossShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.boss-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 3px solid #7048e8;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}

.boss-info {
  flex: 1;
  min-width: 0;
}

.boss-head {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.boss-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boss-hp-track {
  height: 12px;
  background: #ede9fe;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 5px;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ff922b);
  transition: width 0.25s ease;
}

.boss-atk-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #5f3dc4;
}

.boss-atk-track {
  flex: 1;
  height: 7px;
  background: #e5dbff;
  border-radius: 999px;
  overflow: hidden;
}

.boss-atk-fill {
  height: 100%;
  background: #845ef7;
  transition: width 0.15s linear;
}

/* 미니 이벤트 바 (사이드 패널용) */
.active-event-bar {
  width: 100%;
  background: rgba(255, 249, 219, 0.96);
  border: 3.5px solid #f08c00;
  border-radius: 16px;
  padding: 9px 11px;
  box-shadow: 0 4px 12px rgba(240, 140, 0, 0.2);
  flex-shrink: 0;
}

.event-bar-text {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.84rem;
  margin-bottom: 5px;
}

.event-bar-track {
  height: 8px;
  background: #ffe8cc;
  border-radius: 999px;
  overflow: hidden;
}

.event-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff922b, #ffd43b);
  transition: width 0.15s linear;
}

/* 보드 위 토스트 배너 */
.toast-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  background: rgba(255, 252, 247, 0.97);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  z-index: 5;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  0% { transform: translate(-50%, -12px) scale(0.9); opacity: 0; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

/* 오른쪽 통계 박스 */
.stats-box .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 2px dotted #ebd9c8;
  font-size: 0.95rem;
}

.stats-box .main-score strong {
  font-size: 1.55rem;
  color: #e64980;
}

.time-highlight {
  font-size: 1.3rem;
  color: #e8590c;
}

.stat-grid-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.mini-stat {
  background: #fff7ee;
  border: 2px solid #ecd9c6;
  border-radius: 12px;
  padding: 6px;
  text-align: center;
}

.mini-stat span {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.mini-stat strong {
  font-size: 1.15rem;
}

.controls-help ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.controls-help b {
  color: var(--ink);
  background: #f5e6d8;
  padding: 1px 6px;
  border-radius: 6px;
  margin-right: 4px;
}

/* 온스크린 터치 컨트롤 */
.touch-controls {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.touch-group {
  display: flex;
  gap: 8px;
}

.touch-btn {
  font-family: inherit;
  font-size: 1.15rem;
  min-width: 58px;
  height: 54px;
  padding: 0 14px;
  background: rgba(255, 252, 247, 0.96);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
}

.touch-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-t-rotate { background: #d0ebff; }
.btn-t-drop { background: #ffd6e0; }
.btn-t-hold { background: #fff3b8; }
.btn-t-skill { background: #e5dbff; }

/* ================= 필살기 스킬 컷인 ================= */
.skill-cutin {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 240, 246, 0.25);
}

.cutin-band {
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 143, 171, 0.96), rgba(255, 212, 59, 0.96), rgba(116, 192, 252, 0.96));
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  animation: cutinSlide 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cutinSlide {
  0% { transform: translateX(-100%) skewX(-6deg); opacity: 0; }
  18% { transform: translateX(0) skewX(0deg); opacity: 1; }
  80% { transform: translateX(0) scale(1.03); opacity: 1; }
  100% { transform: translateX(100%) skewX(6deg); opacity: 0; }
}

.cutin-band img {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 5px solid var(--ink);
  background: #fff;
  object-fit: cover;
}

.cutin-title {
  font-size: 1.9rem;
  color: #ffffff;
  text-shadow: 3px 3px 0 var(--ink), -1px -1px 0 var(--ink);
}

.cutin-quote {
  font-size: 1.2rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 14px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  margin-top: 6px;
  display: inline-block;
}

/* ================= 업적 달성 토스트 ================= */
.ach-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 80;
  background: #fff9db;
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(90, 59, 44, 0.25);
  animation: toastSlideIn 0.4s ease;
}

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.ach-toast-icon {
  font-size: 2rem;
}

.ach-toast-sub {
  font-size: 0.78rem;
  color: #e8590c;
}

/* ================= 모달 공통 ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(74, 46, 31, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--cream);
  border: 5px solid var(--ink);
  border-radius: 28px;
  padding: 22px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.modal-wide { max-width: 780px; }
.modal-small { max-width: 400px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #ffe3e3;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
}

/* 뽑기(가챠) & 스티커 도감 */
.gacha-machine-box {
  background: linear-gradient(180deg, #fff5f8, #fff9db);
  border: 3px dashed #ff8fab;
  border-radius: 20px;
  padding: 14px;
  text-align: center;
  margin-bottom: 16px;
}

.gacha-status {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.gacha-stage {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.gacha-capsule {
  font-size: 3.2rem;
  animation: gentleBounce 1.6s infinite;
}

.gacha-capsule.spinning {
  animation: spinFast 0.45s linear infinite;
}

@keyframes spinFast {
  from { transform: rotate(0deg) scale(1.1); }
  to { transform: rotate(360deg) scale(1.1); }
}

.gacha-result-card {
  background: #ffffff;
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  animation: popInCard 0.4s ease;
}

@keyframes popInCard {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.gacha-result-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  object-fit: cover;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.sticker-item {
  background: #fff;
  border: 3px solid #e6d5c8;
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
  position: relative;
}

.sticker-item.owned {
  border-color: var(--ink);
  background: #fffdf7;
}

.sticker-item.locked {
  opacity: 0.48;
  filter: grayscale(0.8);
}

.sticker-item img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  object-fit: cover;
  margin-bottom: 4px;
}

.sticker-emoji-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  margin: 0 auto 4px;
}

.sticker-rarity {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: bold;
  border: 1.5px solid var(--ink);
}

.rarity-SSR { background: #ffd43b; color: #5a2600; }
.rarity-SR { background: #e5dbff; color: #5f3dc4; }
.rarity-R { background: #d0ebff; color: #1971c2; }
.rarity-N { background: #f1f3f5; color: #495057; }

.sticker-name {
  font-size: 0.82rem;
  display: block;
}

/* 업적 리스트 */
.ach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid #e6d5c8;
  border-radius: 16px;
  padding: 10px 14px;
}

.ach-row.done {
  border-color: #ff922b;
  background: #fff9db;
}

.ach-icon {
  font-size: 1.8rem;
}

.ach-body {
  flex: 1;
}

.ach-body strong {
  display: block;
  font-size: 1rem;
}

.ach-body span {
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.ach-reward {
  font-size: 0.85rem;
  background: #ffe8cc;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid #ffa94d;
}

/* 설정 리스트 */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 3px solid #ead8c8;
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: #ff6b9d;
  cursor: pointer;
}

/* 결과 & 일시정지 모달 */
.modal-sub {
  color: var(--ink-soft);
  margin: 6px 0 16px;
}

.modal-btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-badge {
  display: inline-block;
  background: #ffd43b;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 16px;
  margin-bottom: 8px;
  color: #7c2d12;
}

.result-partner-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff5f8;
  border: 3px solid #ffc9d9;
  border-radius: 18px;
  padding: 10px 14px;
  margin: 12px 0;
  text-align: left;
}

.result-partner-wrap img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  object-fit: cover;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.result-stats div {
  background: #fff;
  border: 2.5px solid #ead8c8;
  border-radius: 14px;
  padding: 8px;
}

.result-stats span {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.result-stats strong {
  font-size: 1.25rem;
  color: var(--ink);
}

/* 반응형 대응 (작은 화면 / 태블릿) */
@media (max-width: 900px) {
  .char-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .game-screen {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .game-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .board-frame {
    height: auto;
    width: min(92vw, 380px);
    max-height: none;
  }
  .side-panel {
    width: 100%;
    max-width: 420px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
  }
  .side-box {
    flex: 1;
    min-width: 170px;
  }
  .controls-help {
    display: none;
  }
}

@media (max-width: 560px) {
  .char-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .hero-title-badge {
    padding: 6px 16px;
  }
}
