* {
  box-sizing: border-box;
}

:root {
  --bg-main: #081224;
  --bg-panel: #1e293b;
  --bg-panel-2: #0f172a;
  --text-main: #e2e8f0;
  --text-soft: #94a3b8;
  --accent: #60a5fa;
  --danger: #ff4d4d;

  --tile-w: 74px;
  --tile-h: 102px;
  --tile-gap: 10px;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: Arial, sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.app-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.12), transparent 22%),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.10), transparent 20%),
    radial-gradient(circle at 50% 90%, rgba(14, 165, 233, 0.10), transparent 25%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1420px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px 12px 26px;
}

.hidden {
  display: none !important;
}

.card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(30, 41, 59, 0.92));
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 18px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: visible;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -1px;
}

input,
button,
select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #475569;
  background: #0b1730;
  color: var(--text-main);
  margin-top: 8px;
  margin-bottom: 12px;
  font-size: 16px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

button {
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
}

.secondary {
  background: #334155;
  color: #e2e8f0;
}

.secondary:hover {
  background: #475569;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 12px;
}

.header-left {
  flex: 1;
  min-width: 0;
}

.room-notice-wrap {
  margin-top: 12px;
}

.room-notice-input {
  width: min(640px, 100%);
  min-width: 320px;
  background: rgba(11, 23, 48, 0.96);
  border: 1px solid #334155;
  color: #e2e8f0;
}

.creator-box {
  position: relative;
  min-width: 188px;
  min-height: 82px;
  padding: 14px 18px 12px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.24), transparent 35%),
    linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    0 0 18px rgba(59, 130, 246, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.creator-box:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 26px rgba(96, 165, 250, 0.22),
    0 0 34px rgba(168, 85, 247, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.creator-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-100%);
  animation: creatorShine 3.2s linear infinite;
  pointer-events: none;
}

.creator-glow {
  position: absolute;
  inset: auto auto 8px 50%;
  width: 90px;
  height: 20px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(96, 165, 250, 0.25), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

.creator-name {
  font-size: 26px;
  font-weight: 1000;
  letter-spacing: 1.8px;
  line-height: 1;
  color: #e5f0ff;
  text-shadow:
    0 0 6px rgba(96, 165, 250, 0.45),
    0 0 18px rgba(96, 165, 250, 0.35),
    0 0 28px rgba(168, 85, 247, 0.22);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Trebuchet MS", sans-serif;
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
}

.creator-name::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #a855f7, #f59e0b);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.45);
}

.creator-version {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #cbd5e1;
  opacity: 0.95;
  text-transform: uppercase;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}

.main-panel,
.side-panel {
  min-width: 0;
}

.side-sticky {
  position: sticky;
  top: 10px;
}

.center {
  text-align: center;
}

.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center top, rgba(96, 165, 250, 0.08), transparent 45%);
  pointer-events: none;
}

.turn-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 8px;
  border: 1px solid rgba(96, 165, 250, 0.24);
}

.turn {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 900;
  color: #93c5fd;
  text-shadow: 0 0 16px rgba(96, 165, 250, 0.18);
}

.hero-badges {
  margin-top: 8px;
}

.badge {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: #334155;
  font-size: 14px;
  font-weight: 700;
  margin-right: 8px;
  margin-bottom: 8px;
}

.label {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 8px;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ready-bar,
.test-ready-bar,
.sort-bar,
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ready-btn,
.sort-btn,
.test-ready-btn {
  width: auto;
  margin: 0;
  border-radius: 999px;
}

.ready-btn {
  background: linear-gradient(135deg, #0f766e, #0f9f99);
  border: 1px solid #14b8a6;
  color: white;
}

.ready-btn.ready-on {
  background: linear-gradient(135deg, #15803d, #16a34a);
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.28);
}

.ready-btn.disabled-ready,
.start-btn.disabled-start {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.start-btn {
  background: linear-gradient(135deg, #2563eb, #3158c8);
  color: white;
}

.setup-help {
  margin-top: 12px;
  margin-bottom: 10px;
  color: #94a3b8;
  font-size: 13px;
}

.test-ready-btn {
  padding: 8px 12px;
  background: #3f3f46;
  border: 1px solid #52525b;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 800;
}

.test-ready-btn.on {
  background: #16a34a;
  border-color: #4ade80;
  color: #f0fdf4;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.22);
}

.sort-btn {
  padding: 8px 14px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 800;
}

.sort-btn.active-sort {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.28);
}

.tile-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 96px;
}

.hand-card {
  overflow: visible;
}

.hand-area {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--tile-gap);
  overflow-x: auto;
  overflow-y: visible;
  min-height: 130px;
  padding: 16px 4px 10px;
  align-items: flex-start;
  scrollbar-width: thin;
  --tile-w: 74px;
  --tile-h: 102px;
  --tile-gap: 10px;
  scroll-behavior: smooth;
}

.hand-area.compact {
  overflow-x: hidden;
}

.hand-area::-webkit-scrollbar {
  height: 8px;
}

.hand-area::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
}

.tile {
  width: var(--tile-w, 74px);
  height: var(--tile-h, 102px);
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #202938 0%, #0b1220 58%, #050914 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  user-select: none;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    filter 0.16s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  pointer-events: none;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -10px 18px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.tile-red { border-color: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.42); }
.tile-green { border-color: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.42); }
.tile-yellow { border-color: #facc15; box-shadow: 0 0 8px rgba(250, 204, 21, 0.42); }
.tile-blue { border-color: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.42); }

.tile:hover {
  transform: translateY(-4px) scale(1.03);
  filter: brightness(1.08);
}

.tile.selected {
  border: 3px solid #ff0000;
  transform: translateY(-10px) scale(1.12);
  box-shadow:
    0 0 10px #ff0000,
    0 0 20px #ff0000,
    0 0 30px #ff0000,
    0 0 45px rgba(255, 0, 0, 0.85);
  z-index: 3;
}

.tile.just-played {
  animation: tileDropIn 0.28s ease;
}

.tile-corner {
  position: absolute;
  font-size: clamp(8px, calc(var(--tile-w, 74px) * 0.13), 10px);
  font-weight: 800;
  opacity: 0.9;
  z-index: 2;
}

.tile-corner.top-left {
  top: 7px;
  left: 8px;
}

.tile-corner.bottom-right {
  right: 8px;
  bottom: 7px;
  transform: rotate(180deg);
}

.tile-ornament {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  opacity: 0.22;
  z-index: 1;
}

.tile-ornament.top-left {
  top: 7px;
  left: 7px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 10px;
}

.tile-ornament.bottom-right {
  right: 7px;
  bottom: 7px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 10px;
}

.tile-pattern {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  opacity: 0.16;
}

.tile-pattern svg {
  width: 42px;
  height: 42px;
}

.tile-center {
  position: relative;
  z-index: 2;
}

.tile-number {
  font-size: clamp(18px, calc(var(--tile-w, 74px) * 0.42), 30px);
  font-weight: 900;
  line-height: 1;
}

.tile-red .tile-number { color: #f87171; text-shadow: 0 0 10px rgba(239, 68, 68, 0.76); }
.tile-green .tile-number { color: #4ade80; text-shadow: 0 0 10px rgba(34, 197, 94, 0.76); }
.tile-yellow .tile-number { color: #fde047; text-shadow: 0 0 10px rgba(250, 204, 21, 0.76); }
.tile-blue .tile-number { color: #60a5fa; text-shadow: 0 0 10px rgba(59, 130, 246, 0.76); }

.pile {
  background: #0a1630;
  border-radius: 14px;
  padding: 16px;
  min-height: 150px;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.table-highlight .tile {
  border-width: 3px;
  transform: scale(1.06);
}

.status {
  margin-top: 16px;
  font-size: 18px;
  font-weight: bold;
  min-height: 28px;
  color: #fcd34d;
}

.players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.record-board-grid {
  grid-template-columns: 1fr;
}

.player-box,
.record-box {
  background: #0b1220;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #334155;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.player-box.active {
  border: 2px solid #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
  transform: translateY(-1px);
}

.player-box.critical-box {
  border-color: #ff2b2b;
  box-shadow: 0 0 12px rgba(255, 43, 43, 0.45), inset 0 0 18px rgba(255, 43, 43, 0.08);
  animation: pulseDanger 1s infinite;
}

.player-name,
.record-name {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
}

.small {
  font-size: 14px;
  color: #cbd5e1;
}

.danger-text {
  color: #ff4d4d !important;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(255, 77, 77, 0.45);
}

.critical-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 43, 43, 0.14);
  color: #ff4d4d;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 43, 43, 0.35);
}

.record-text {
  margin-top: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.record-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.record-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
}

.record-pill.win {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.record-pill.loss {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.winner-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.winner-modal.hidden {
  display: none !important;
}

.winner-card {
  width: min(96vw, 980px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: linear-gradient(180deg, #172033 0%, #0b1220 100%);
  border: 2px solid rgba(248, 113, 113, 0.72);
  border-radius: 22px;
  padding: 18px;
  box-shadow:
    0 0 18px rgba(248, 113, 113, 0.2),
    0 0 40px rgba(239, 68, 68, 0.16);
  text-align: center;
  animation: winnerPop 0.24s ease;
}

.winner-title {
  font-size: 34px;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.5);
  margin-bottom: 10px;
}

.winner-name {
  font-size: 24px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 10px;
}

.winner-desc {
  color: #cbd5e1;
  margin-bottom: 18px;
}

.winner-button {
  width: 100%;
}

.loser-modal-card {
  scrollbar-width: thin;
}

.loser-title {
  color: #fecaca;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.35);
  margin-bottom: 6px;
}

.loser-name {
  color: #fff1f2;
  margin-bottom: 8px;
}

.primary-cta {
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
}

@keyframes pulseDanger {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes creatorShine {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

@keyframes tileDropIn {
  0% { transform: translateY(18px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1.06); opacity: 1; }
}

@keyframes winnerPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 1180px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .side-sticky {
    position: static;
  }
}

@media (max-width: 760px) {
  .row {
    grid-template-columns: 1fr;
  }

  .header-bar {
    flex-direction: column;
    gap: 12px;
  }

  .creator-box {
    align-self: center;
  }

  .room-notice-input {
    width: 100%;
    min-width: 0;
  }

  .section-header {
    align-items: flex-start;
  }

  .sort-bar {
    width: 100%;
  }

  .controls {
    width: 100%;
  }

  .controls button {
    flex: 1 1 0;
  }

  .hand-area {
    --tile-w: 62px;
    --tile-h: 88px;
    --tile-gap: 8px;
  }
}

@media (orientation: landscape) and (max-width: 950px) {
  .container {
    width: min(1400px, calc(100vw - 12px));
    padding: 6px 6px 16px;
  }

  .card {
    padding: 14px;
    margin-bottom: 12px;
  }

  .hand-area {
    --tile-gap: 6px;
  }
}
/* ===== 숫자 2 전용: 검은 배경 + 색상 문양 가득 ===== */
.tile-two-special {
  border-width: 3px !important;
  background:
    linear-gradient(180deg, #101010 0%, #06080b 58%, #020202 100%) !important;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.05),
    inset 0 0 20px rgba(255,255,255,0.02) !important;
  animation: specialTwoFloat 2.6s ease-in-out infinite;
}

.tile-two-special::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 12px;
  pointer-events: none;
  background:
    linear-gradient(
      115deg,
      rgba(255,255,255,0.00) 0%,
      rgba(255,255,255,0.00) 34%,
      rgba(255,255,255,0.10) 50%,
      rgba(255,255,255,0.00) 66%,
      rgba(255,255,255,0.00) 100%
    );
  background-size: 220% 220%;
  animation: specialTwoShine 3s linear infinite;
  z-index: 1;
}

.tile-two-special::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -14px 24px rgba(0,0,0,0.46);
  z-index: 2;
}

/* 2카드 배경 문양판 */
.tile-two-bg {
  position: absolute;
  inset: 10px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px 6px;
  align-items: center;
  justify-items: center;
  opacity: 0.95;
  pointer-events: none;
}

.tile-two-mini {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.05));
}

.tile-two-mini svg {
  width: 100%;
  height: 100%;
}

/* 숫자 2는 원래 색상 유지 */
.tile-two-special .tile-number {
  font-size: clamp(22px, calc(var(--tile-w, 74px) * 0.52), 38px) !important;
  font-weight: 1000 !important;
  transform: scale(1.16);
}

/* 2카드 모서리 숫자 */
.tile-two-special .tile-corner {
  font-weight: 900 !important;
  opacity: 1;
}

/* 일반 중앙 큰 문양은 숨김 */
.tile-two-special .tile-pattern {
  display: none !important;
}

/* 중앙 숫자가 배경 문양 위로 확실히 올라오게 */
.tile-two-special .tile-center {
  z-index: 3;
}

.tile-two-special .tile-center::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  z-index: -1;
  opacity: 0.9;
}

/* 빨강 2 */
.tile-red.tile-two-special {
  border-color: #ff5b5b !important;
  box-shadow:
    0 0 14px rgba(255, 91, 91, 0.42),
    0 0 28px rgba(255, 91, 91, 0.18),
    inset 0 0 20px rgba(255,255,255,0.02) !important;
}
.tile-red.tile-two-special .tile-two-bg,
.tile-red.tile-two-special .tile-corner {
  color: #ff6464 !important;
}
.tile-red.tile-two-special .tile-number {
  color: #f87171 !important;
  text-shadow:
    0 0 10px rgba(239, 68, 68, 0.82),
    0 0 20px rgba(255,255,255,0.10) !important;
}
.tile-red.tile-two-special .tile-center::before {
  border: 2px solid rgba(255, 91, 91, 0.34);
  box-shadow: 0 0 12px rgba(255, 91, 91, 0.18);
}

/* 초록 2 */
.tile-green.tile-two-special {
  border-color: #57ff9b !important;
  box-shadow:
    0 0 14px rgba(87, 255, 155, 0.42),
    0 0 28px rgba(87, 255, 155, 0.18),
    inset 0 0 20px rgba(255,255,255,0.02) !important;
}
.tile-green.tile-two-special .tile-two-bg,
.tile-green.tile-two-special .tile-corner {
  color: #57ff9b !important;
}
.tile-green.tile-two-special .tile-number {
  color: #4ade80 !important;
  text-shadow:
    0 0 10px rgba(34, 197, 94, 0.82),
    0 0 20px rgba(255,255,255,0.10) !important;
}
.tile-green.tile-two-special .tile-center::before {
  border: 2px solid rgba(87, 255, 155, 0.34);
  box-shadow: 0 0 12px rgba(87, 255, 155, 0.18);
}

/* 노랑 2 */
.tile-yellow.tile-two-special {
  border-color: #ffe66b !important;
  box-shadow:
    0 0 16px rgba(255, 230, 107, 0.48),
    0 0 30px rgba(255, 230, 107, 0.20),
    inset 0 0 20px rgba(255,255,255,0.03) !important;
}
.tile-yellow.tile-two-special .tile-two-bg,
.tile-yellow.tile-two-special .tile-corner {
  color: #ffe45e !important;
}
.tile-yellow.tile-two-special .tile-number {
  color: #fde047 !important;
  text-shadow:
    0 0 10px rgba(250, 204, 21, 0.86),
    0 0 22px rgba(255,255,255,0.10) !important;
}
.tile-yellow.tile-two-special .tile-center::before {
  border: 2px solid rgba(255, 230, 107, 0.36);
  box-shadow: 0 0 12px rgba(255, 230, 107, 0.18);
}

/* 파랑 2 */
.tile-blue.tile-two-special {
  border-color: #69b7ff !important;
  box-shadow:
    0 0 14px rgba(105, 183, 255, 0.44),
    0 0 28px rgba(105, 183, 255, 0.18),
    inset 0 0 20px rgba(255,255,255,0.02) !important;
}
.tile-blue.tile-two-special .tile-two-bg,
.tile-blue.tile-two-special .tile-corner {
  color: #69b7ff !important;
}
.tile-blue.tile-two-special .tile-number {
  color: #60a5fa !important;
  text-shadow:
    0 0 10px rgba(59, 130, 246, 0.86),
    0 0 22px rgba(255,255,255,0.10) !important;
}
.tile-blue.tile-two-special .tile-center::before {
  border: 2px solid rgba(105, 183, 255, 0.36);
  box-shadow: 0 0 12px rgba(105, 183, 255, 0.18);
}

/* 선택 시 */
.tile-two-special.selected {
  animation: none !important;
  transform: translateY(-12px) scale(1.16) !important;
  box-shadow:
    0 0 12px #ff0000,
    0 0 24px #ff0000,
    0 0 36px rgba(255, 0, 0, 0.82),
    0 0 54px rgba(255,255,255,0.10) !important;
}

/* 애니메이션 */
@keyframes specialTwoFloat {
  0% { transform: translateY(0px) rotate(-0.35deg); }
  25% { transform: translateY(-1px) rotate(0.25deg); }
  50% { transform: translateY(0px) rotate(-0.2deg); }
  75% { transform: translateY(1px) rotate(0.22deg); }
  100% { transform: translateY(0px) rotate(-0.35deg); }
}

@keyframes specialTwoShine {
  0% { background-position: -140% 0%; }
  100% { background-position: 160% 0%; }
}
/* ===== 패 선택 시 잘림 방지 패치 ===== */

/* 바깥 카드 박스가 잘라버리는 문제 해결 */
.card {
  overflow: visible !important;
}

/* 패 영역 카드 */
.hand-card {
  overflow: visible !important;
}

/* 패 리스트 영역 */
.hand-area {
  overflow-y: visible !important;
  padding-top: 20px !important;
  min-height: 140px !important;
}

/* 선택된 일반 패 */
.tile.selected {
  transform: translateY(-6px) scale(1.08) !important;
  z-index: 10 !important;
}

/* 숫자 2 선택 패 */
.tile-two-special.selected {
  transform: translateY(-6px) scale(1.10) !important;
  z-index: 10 !important;
}
#roomCard {
  margin-top: 14px;
}

#roomStatusText {
  margin-top: 12px;
  font-size: 14px;
  color: #cbd5e1;
  word-break: break-all;
}


/* ===== 충시오 모바일 레이아웃 최종 조정 ===== */
body {
  overflow-x: hidden;
}
.container {
  width: min(100vw - 10px, 1420px);
  padding: 6px 5px 14px;
}
.compact-header {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.compact-notice {
  width: min(100%, 760px);
  margin-top: 0;
}
.compact-notice .room-notice-input {
  width: 100%;
  min-width: 0;
}
.mobile-game-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-strip {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr) 106px;
  gap: 8px;
  align-items: stretch;
}
.compact-card {
  padding: 10px;
  margin-bottom: 0;
  border-radius: 18px;
}
.section-title {
  font-size: 13px;
  font-weight: 900;
  color: #dbeafe;
  margin-bottom: 8px;
}
.progress-panel {
  min-width: 0;
}
.player-status-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.player-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 14px;
  background: #07142a;
  border: 1px solid rgba(96, 165, 250, 0.14);
  font-weight: 800;
}
.player-line.active {
  background: rgba(30, 64, 175, 0.22);
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25), 0 0 12px rgba(96, 165, 250, 0.18);
}
.player-line.danger .player-line-count {
  color: #fca5a5;
}
.player-line.critical {
  border-color: rgba(248, 113, 113, 0.85);
}
.player-line-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-line-count {
  flex: 0 0 auto;
  color: #e2e8f0;
}
.turn-arrow {
  color: #60a5fa;
  margin-right: 4px;
  font-size: 13px;
}
.table-panel {
  min-width: 0;
}
.table-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.last-player-inline {
  flex: 1 1 auto;
  text-align: center;
  color: #dbeafe;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-mini {
  color: #93c5fd;
  font-weight: 900;
  font-size: 13px;
  text-align: right;
}
.compact-pile {
  min-height: 112px;
  height: 17vh;
  max-height: 136px;
  padding: 6px;
}
.side-mini-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}
.mini-box {
  min-height: 66px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.emoji-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.emoji-row {
  display: flex;
  gap: 6px;
}
.emoji-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  background: #09172d;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 16px;
  line-height: 1;
}

.emoji-row-stack {
  justify-content: center;
  align-items: center;
}

.emoji-send-btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.emoji-send-btn:hover,
.emoji-send-btn:active {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.18);
  background: #10233f;
}

.emoji-overlay {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 18px;
  background: rgba(7, 20, 42, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.emoji-overlay.hidden {
  display: none !important;
}

.emoji-overlay-icon {
  font-size: 38px;
  line-height: 1;
  animation: emojiPop 1.1s ease forwards;
}

@keyframes emojiPop {
  0% { transform: translateY(-8px) scale(0.8); opacity: 0; }
  20% { transform: translateY(0) scale(1.08); opacity: 1; }
  70% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-4px) scale(0.96); opacity: 0; }
}
.hand-zone {
  padding: 8px 10px 6px;
  margin-bottom: 0;
}
.controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  flex-wrap: nowrap;
}
.primary-controls {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.inline-btn {
  width: auto;
  min-width: 94px;
  margin: 0;
  padding: 10px 16px;
  border-radius: 18px;
}

.primary-cta.inline-btn {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border: 1px solid rgba(147, 197, 253, 0.55);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18), 0 8px 18px rgba(37, 99, 235, 0.28);
}
.primary-cta.inline-btn:hover {
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.22), 0 10px 22px rgba(37, 99, 235, 0.34);
}

.loser-mini-game-result {
  margin: 6px 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.86), rgba(69, 10, 10, 0.92));
  border: 1px solid rgba(248, 113, 113, 0.42);
  box-shadow: 0 10px 24px rgba(127, 29, 29, 0.24);
  text-align: center;
}

.loser-mini-game-result-badge {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fecaca;
  margin-bottom: 4px;
}

.loser-mini-game-result-name {
  font-size: 24px;
  font-weight: 1000;
  color: #fff5f5;
}

.loser-final-banner {
  width: 100%;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.selected-tile-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 82px;
}

.loser-mini-game-deck .mini-card-back {
  width: 72px;
  min-height: 48px;
  flex: 0 0 72px;
}

.loser-picked-slot .mini-card-back.picked-slot {
  width: 60px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loser-picked-slot .mini-card-back.picked-slot.selected-card {
  width: 64px;
  min-height: 84px;
}

.compact-sort-bar {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-left: auto;
}
.compact-sort-bar .sort-btn {
  width: auto;
  margin: 0;
  padding: 7px 11px;
  font-size: 13px;
  border-radius: 999px;
}
.hand-label {
  margin-bottom: 2px;
}
.hand-area {
  min-height: 0;
  padding: 2px 0 0;
  --tile-gap: 6px;
}
.compact-status {
  margin-top: 2px;
  margin-bottom: 0;
  min-height: 16px;
  font-size: 12px;
}
.extra-info {
  margin-top: 0;
}
.hero-badges.compact-badges {
  margin-top: 8px;
  margin-bottom: 10px;
}
#gameScreen .players.record-board-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
#setupScreen #playerInputs {
  display: none !important;
}
#resetRoomBtn {
  display: none;
}

@media (orientation: landscape) and (max-width: 950px) {
  .container {
    padding: 4px 4px 10px;
    width: calc(100vw - 4px);
  }
  .header-bar {
    margin-bottom: 6px;
  }
  .creator-box {
    min-width: 148px;
    min-height: 58px;
    padding: 8px 12px 8px;
    border-radius: 18px;
  }
  .creator-name {
    font-size: 22px;
    padding-bottom: 4px;
  }
  .creator-version {
    margin-top: 4px;
    font-size: 11px;
  }
  #setupScreen.card {
    padding: 14px;
  }
  .top-strip {
    grid-template-columns: 132px minmax(0, 1fr) 88px;
    gap: 6px;
  }
  .compact-card {
    padding: 8px;
    border-radius: 16px;
  }
  .section-title {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .player-line {
    padding: 6px 7px;
    border-radius: 12px;
    font-size: 12px;
  }
  .compact-pile {
    height: 13vh;
    min-height: 82px;
    max-height: 100px;
    padding: 5px;
  }
  .mini-box {
    min-height: 52px;
  }
  .emoji-btn {
    width: 24px;
    min-width: 24px;
    height: 24px;
    font-size: 13px;
  }
  .emoji-overlay {
    top: 8px;
    padding: 4px 10px;
    border-radius: 14px;
  }
  .emoji-overlay-icon {
    font-size: 30px;
  }
  .hand-zone {
    padding: 6px 8px 4px;
  }
  .controls-head {
    margin-bottom: 2px;
  }
  .inline-btn {
    min-width: 76px;
    padding: 7px 10px;
    border-radius: 14px;
    font-size: 13px;
  }
  .compact-sort-bar .sort-btn {
    padding: 5px 7px;
    font-size: 11px;
  }
  .hand-label {
    font-size: 13px;
    margin-bottom: 2px;
  }
  .hand-area {
    --tile-gap: 4px;
    padding-top: 1px;
  }
  .hand-area .tile {
    border-radius: 12px;
  }
  .compact-status {
    margin-top: 2px;
    min-height: 16px;
    font-size: 12px;
  }
  .hero-badges.compact-badges .badge {
    padding: 4px 7px;
    font-size: 10px;
    margin-right: 4px;
    margin-bottom: 4px;
  }
}


/* ===== 채팅 + 테이블 패 축소 최종 패치 ===== */
.table-panel {
  padding: 14px 16px 12px !important;
}

.table-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px !important;
  gap: 8px;
}

.last-player-inline {
  font-size: 12px;
}

.chat-strip {
  min-height: 54px;
  max-height: 58px;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(8, 18, 36, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.compact-chat-messages {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  font-size: 12px;
  line-height: 1.15;
  color: #dbe7ff;
  overflow: hidden;
}

.chat-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #dbe7ff;
}

.chat-line .chat-name {
  color: #93c5fd;
  font-weight: 800;
  margin-right: 6px;
}

.chat-placeholder {
  color: #94a3b8;
  opacity: 0.82;
}

.compact-pile {
  background: transparent !important;
  box-shadow: none !important;
  min-height: 138px !important;
  height: 138px !important;
  padding: 4px 0 0 !important;
  border: none !important;
  align-items: center !important;
  justify-content: center !important;
}

.compact-pile.table-highlight .tile,
.compact-pile .tile {
  transform-origin: center center;
}

.controls-head {
  margin-bottom: 6px !important;
}

.hand-zone {
  padding-top: 12px !important;
  padding-bottom: 10px !important;
}

.hand-label {
  margin-bottom: 4px !important;
}

.hand-area {
  min-height: 116px !important;
  padding-top: 8px !important;
  padding-bottom: 2px !important;
}

.compact-status {
  margin-top: 4px !important;
  min-height: 22px !important;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.chat-input {
  margin: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px !important;
  font-size: 14px;
}

.chat-send-btn {
  width: auto !important;
  min-width: 68px;
  margin: 0 !important;
  padding: 10px 14px !important;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #3158c8);
  color: #fff;
  font-weight: 800;
}

@media (orientation: landscape) and (max-width: 950px) {
  .table-panel {
    padding: 12px 14px 10px !important;
  }

  .chat-strip {
    min-height: 48px;
    max-height: 52px;
    padding: 4px 8px;
    margin-bottom: 4px;
  }

  .compact-chat-messages {
    min-height: 34px;
    gap: 3px;
    font-size: 11px;
  }

  .compact-pile {
    min-height: 118px !important;
    height: 118px !important;
    padding-top: 0 !important;
  }

  .compact-pile .tile {
    transform: scale(0.88);
  }

  .compact-pile.table-highlight .tile {
    transform: scale(0.94);
  }

  .hand-zone {
    padding-top: 10px !important;
    padding-bottom: 8px !important;
  }
}


/* ===== 기능 추가용 최소 UI 패치 ===== */
.order-card {
  margin-top: 12px;
}

.turn-order-list {
  display: grid;
  gap: 8px;
}

.turn-order-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: #0b1220;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #334155;
}

.turn-order-name {
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
}

.turn-order-buttons {
  display: flex;
  gap: 6px;
}

.turn-order-btn {
  width: 36px;
  min-width: 36px;
  padding: 8px 0;
  margin: 0 !important;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  font-weight: 900;
}

.turn-order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.inline-btn {
  flex: 0 0 auto;
}

#gameResetBtn {
  background: #475569;
  color: #fff;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.chat-input {
  margin: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
}

.chat-send-btn {
  width: auto !important;
  min-width: 72px;
  margin: 0 !important;
  padding: 12px 14px !important;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #3158c8);
  color: #fff;
}

.remaining-hands-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(11, 18, 32, 0.9);
  border: 1px solid #334155;
}

.remaining-hand-player {
  margin-bottom: 12px;
}

.remaining-hand-name {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #f8fafc;
}

.remaining-hand-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.winner-actions {
  display: flex;
  gap: 10px;
}

.winner-button-half {
  flex: 1 1 0;
  width: auto !important;
}

@media (orientation: landscape) and (max-width: 950px) {
  .turn-order-item {
    padding: 8px 10px;
  }

  .chat-input-row {
    margin-bottom: 8px;
  }

  .chat-send-btn {
    min-width: 64px;
    padding: 10px 12px !important;
  }
}
.top-control-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.top-reset-btn {
  width: auto;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 999px;
  background: #334155;
}
.turn-order-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.turn-order-role {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.turn-order-role.is-player {
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.35);
}

.turn-order-role.is-spectator {
  background: rgba(71, 85, 105, 0.25);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.role-toggle-btn {
  min-width: 52px;
  padding: 8px 10px;
  margin: 0 !important;
  border-radius: 10px;
  background: #111c31;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}

.role-toggle-btn.active-role {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: white;
}

.spectator-row {
  opacity: 0.92;
}

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

.spectator-pill {
  padding: 7px 8px;
  border-radius: 12px;
  background: #07142a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
}


.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  margin-bottom: 12px;
}

.record-header h3 {
  margin-bottom: 4px;
}

.record-reset-btn {
  width: auto;
  min-width: 110px;
  margin: 0 !important;
  padding: 10px 14px;
}

.record-table-wrap {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(11, 18, 32, 0.92);
}

.record-table {
  display: grid;
  grid-template-columns: 76px minmax(120px, 1.4fr) repeat(5, minmax(68px, 0.8fr)) minmax(100px, 1fr);
  gap: 0;
  align-items: center;
}

.record-table > div {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 13px;
  color: #e2e8f0;
}

.record-table-header {
  background: rgba(30, 41, 59, 0.96);
}

.record-table-header > div {
  font-size: 12px;
  font-weight: 900;
  color: #cbd5e1;
  letter-spacing: 0.4px;
}

.record-rank {
  font-weight: 900 !important;
  color: #f8fafc !important;
}

.record-player-name {
  font-weight: 800;
}

.record-score.is-good {
  color: #86efac !important;
  font-weight: 900;
}

.record-score.is-danger {
  color: #fca5a5 !important;
  font-weight: 900;
}

.record-mini-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.34);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.coffee-pending-row {
  background: rgba(120, 53, 15, 0.14);
}

.record-warning {
  color: #fcd34d;
  font-weight: 900;
}

.record-muted {
  color: #94a3b8;
}

.record-action-btn {
  width: auto;
  min-width: 88px;
  margin: 0 !important;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
  font-size: 12px;
}

@media (max-width: 980px) {
  .record-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-reset-btn {
    align-self: stretch;
    width: 100%;
  }

  .record-table-wrap {
    overflow-x: auto;
  }

  .record-table {
    min-width: 760px;
  }
}


/* loser mini game */
.loser-mini-game-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(8, 18, 36, 0.88);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.loser-mini-game-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  text-align: left;
}

.loser-mini-game-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.loser-mini-game-actions button {
  width: auto;
  margin: 0;
}

.loser-mini-game-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  justify-content: flex-start;
}


.loser-mini-game-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 12px;
  font-weight: 800;
}

.loser-mini-game-pill.waiting { color: #fcd34d; }
.loser-mini-game-pill.picked { color: #93c5fd; }

.loser-mini-game-pill.final-loser {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.35);
}

.loser-mini-game-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  margin: 0 auto 10px;
}


.loser-picked-slot {
  position: relative;
  flex: 0 0 122px;
  min-height: 164px;
  border-radius: 16px;
  padding: 10px 8px 8px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 18, 36, 0.98));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}


.loser-picked-slot.empty { color: #94a3b8; }

.loser-picked-slot.final-loser {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.18);
}

.loser-picked-owner {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}


.loser-picked-note {
  font-size: 11px;
  color: #93c5fd;
  text-align: center;
}


.loser-picked-slot .tile {
  width: 54px;
  height: 76px;
  border-radius: 14px;
}


.loser-picked-slot .tile-center .tile-number { font-size: 22px; }
.loser-picked-slot .tile-corner { font-size: 8px; }
.loser-picked-slot .tile-pattern svg { width: 30px; height: 30px; }

.loser-mini-game-deck {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}


.mini-card-back {
  width: 100%;
  min-height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background:
    radial-gradient(circle at 20% 20%, rgba(96, 165, 250, 0.18), transparent 30%),
    linear-gradient(180deg, #172033 0%, #081224 100%);
  color: #dbeafe;
  font-weight: 900;
  font-size: 11px;
  padding: 6px 2px;
  margin: 0;
}

.mini-card-back.can-pick {
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2), 0 0 16px rgba(37, 99, 235, 0.14);
}

.mini-card-back.can-pick:hover { transform: translateY(-2px); }
.mini-card-back:disabled { cursor: default; opacity: 0.85; }

.mini-game-reveal-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #cbd5e1;
  text-align: center;
  padding: 8px 0 2px;
}

@media (max-width: 760px) {
  .winner-card {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 8px);
    padding: 12px;
  }
  .winner-title { font-size: 28px; margin-bottom: 4px; }
  .winner-name { font-size: 20px; }
  .winner-desc { margin-bottom: 12px; font-size: 14px; }
  .loser-mini-game-head { flex-direction: column; }
  .loser-mini-game-actions { width: 100%; }
  .loser-mini-game-actions button { flex: 1 1 0; }
  .loser-mini-game-picked { gap: 6px; justify-content: center; }
  .loser-picked-slot { min-height: 94px; padding: 4px 2px; }
  .loser-picked-slot .tile { width: 34px; height: 48px; border-radius: 10px; }
  .loser-picked-slot .tile-center .tile-number { font-size: 22px; }
  .loser-mini-game-deck { gap: 5px; justify-content: center; }
  .mini-card-back { min-height: 44px; font-size: 10px; padding: 4px 1px; border-radius: 10px; }
}

@media (orientation: landscape) and (max-width: 950px) {
  .winner-card {
    width: calc(100vw - 10px);
    max-height: calc(100vh - 6px);
    padding: 10px;
  }
  .winner-title { font-size: 24px; }
  .winner-name { font-size: 18px; margin-bottom: 4px; }
  .winner-desc { font-size: 13px; margin-bottom: 8px; }
  .loser-mini-game-panel { margin-top: 8px; padding: 10px; }
  .loser-mini-game-candidates { gap: 6px; margin-bottom: 8px; }
  .loser-mini-game-pill { font-size: 11px; padding: 5px 8px; }
  .loser-mini-game-picked { gap: 5px; justify-content: center; margin-bottom: 8px; }
  .loser-picked-slot { min-height: 82px; padding: 3px 2px; gap: 2px; }
  .loser-picked-slot .tile { width: 30px; height: 42px; border-radius: 9px; }
  .loser-picked-slot .tile-center .tile-number { font-size: 22px; }
  .loser-picked-owner, .loser-picked-note { font-size: 9px; }
  .loser-mini-game-deck { gap: 4px; justify-content: center; }
  .mini-card-back { min-height: 38px; font-size: 9px; padding: 3px 1px; }
}

/* ===== 내 턴 강조 (v3.9.2) ===== */
/* ===== 내 턴 강조 (v3.9.2) ===== */

.hand-zone.my-turn {
  border: 2px solid rgba(96, 165, 250, 0.72);
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.14),
    0 0 22px rgba(96, 165, 250, 0.24),
    inset 0 0 18px rgba(96, 165, 250, 0.08);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.hand-area.my-turn {
  background: rgba(96, 165, 250, 0.12);
  border-radius: 16px;
  box-shadow:
    0 0 12px rgba(96, 165, 250, 0.25),
    inset 0 0 10px rgba(96, 165, 250, 0.12);
  transition: all 0.25s ease;
}

/* ===== v3.10.3 waiting room layout fix ===== */
.waiting-main-title {
  display: none;
}

.waiting-room-board {
  margin-top: 14px;
  padding: 12px;
}

.waiting-room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.waiting-summary {
  min-width: 0;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.shuffle-order-btn {
  width: auto;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  flex: 0 0 auto;
}

.waiting-room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
  align-items: stretch;
}

.waiting-pane {
  min-width: 0;
  background: rgba(11, 18, 32, 0.92);
  border: 1px solid rgba(71, 85, 105, 0.8);
  border-radius: 16px;
  padding: 10px;
}

.waiting-order-pane,
.waiting-chat-pane {
  min-height: 300px;
}

.turn-order-list.table-like {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.turn-order-header-row,
.turn-order-row {
  display: grid;
  grid-template-columns: 52px minmax(180px, 1.4fr) minmax(100px, 0.9fr) minmax(150px, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

.turn-order-header-row {
  padding: 0 8px 6px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.55);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 900;
}

.turn-order-row {
  min-height: 46px;
  padding: 8px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 12px;
  background: #081224;
}

.turn-order-col {
  min-width: 0;
}

.order-no {
  font-size: 16px;
  font-weight: 900;
  color: #f8fafc;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.player-name-inline {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.2;
}

.turn-mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.turn-mini-pill.host {
  background: rgba(234, 179, 8, 0.18);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

.turn-mini-pill.me {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.38);
}

.turn-state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.turn-state-pill.is-ready {
  background: rgba(22, 163, 74, 0.18);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.turn-state-pill.is-not-ready {
  background: rgba(127, 29, 29, 0.22);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.24);
}

.turn-state-pill.is-spectator-status {
  background: rgba(71, 85, 105, 0.24);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.turn-role-toggle {
  display: inline-flex;
  gap: 6px;
}

.turn-role-toggle.viewer-only {
  opacity: 0.9;
}

.role-toggle-btn {
  width: auto;
  min-width: 56px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 10px;
}

.move-cell {
  display: inline-flex;
  gap: 6px;
}

.turn-order-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
}

.waiting-chat-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.waiting-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  border-radius: 14px;
  background: #04112a;
  border: 1px solid rgba(51, 65, 85, 0.7);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}

.waiting-chat-bottom {
  flex: 0 0 auto;
  margin-top: 8px;
}

.waiting-emoji-row {
  justify-content: center;
  margin-bottom: 8px;
  gap: 8px;
}

.waiting-chat-input-row {
  margin-bottom: 0;
}

.waiting-chat-pane .emoji-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.chat-line {
  display: block;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  line-height: 1.35 !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.compact-chat-messages {
  justify-content: flex-start;
  overflow-y: auto;
}

@media (orientation: landscape) and (max-width: 950px) {
  .header-bar.compact-header {
    margin-bottom: 6px;
  }

  .waiting-room-board {
    padding: 8px;
    margin-top: 8px;
  }

  .waiting-room-top {
    margin-bottom: 8px;
  }

  .waiting-summary {
    font-size: 11px;
  }

  .shuffle-order-btn {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 12px;
  }

  .waiting-room-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 8px;
  }

  .waiting-order-pane,
  .waiting-chat-pane {
    min-height: 228px;
    padding: 8px;
  }

  .turn-order-header-row {
    display: none;
  }

  .turn-order-list.table-like {
    gap: 4px;
  }

  .turn-order-row {
    grid-template-columns: 34px minmax(0, 1.5fr) minmax(72px, 0.85fr) minmax(120px, 1fr) 62px;
    gap: 5px;
    min-height: 34px;
    padding: 5px 6px;
  }

  .order-no {
    font-size: 13px;
  }

  .player-name-inline {
    font-size: 12px;
  }

  .turn-mini-pill {
    padding: 2px 6px;
    font-size: 10px;
  }

  .turn-state-pill {
    padding: 4px 7px;
    font-size: 10px;
  }

  .role-toggle-btn {
    min-width: 44px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .turn-order-btn {
    width: 26px;
    min-width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .waiting-chat-messages {
    padding: 8px;
    gap: 5px;
  }

  .waiting-chat-bottom {
    margin-top: 6px;
  }

  .waiting-emoji-row {
    margin-bottom: 6px;
    gap: 6px;
  }

  .waiting-chat-pane .emoji-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .waiting-chat-input-row .chat-input {
    padding: 10px 12px;
  }

  .waiting-chat-input-row .chat-send-btn {
    min-width: 56px;
    padding: 10px 10px !important;
  }
}


/* ===== v3.10.4 waiting room compact fix ===== */
.waiting-room-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.waiting-order-pane,
.waiting-chat-pane {
  min-height: 0;
  height: 250px;
}

.waiting-order-pane {
  overflow: hidden;
}

.turn-order-list.table-like {
  height: 100%;
}

.turn-order-row {
  min-height: 42px;
  padding: 6px 7px;
}

.turn-order-col.move-cell {
  justify-content: flex-end;
}

.waiting-chat-messages {
  height: 100%;
  max-height: 100%;
}

@media (orientation: landscape) and (max-width: 950px) {
  .container {
    padding: 6px 8px 10px;
  }

  .card {
    margin-bottom: 8px;
  }

  .waiting-room-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .waiting-order-pane,
  .waiting-chat-pane {
    height: 206px;
    padding: 6px;
    border-radius: 12px;
  }

  .turn-order-row {
    grid-template-columns: 22px minmax(0, 1.2fr) minmax(52px, 0.7fr) minmax(92px, 0.95fr) 48px;
    gap: 4px;
    min-height: 28px;
    padding: 3px 4px;
    border-radius: 10px;
  }

  .order-no {
    font-size: 11px;
  }

  .player-cell {
    gap: 4px;
  }

  .player-name-inline {
    font-size: 11px;
    line-height: 1.05;
  }

  .turn-mini-pill {
    padding: 1px 5px;
    font-size: 9px;
  }

  .turn-state-pill {
    padding: 2px 5px;
    font-size: 9px;
  }

  .turn-role-toggle {
    gap: 4px;
  }

  .role-toggle-btn {
    min-width: 36px;
    padding: 3px 4px;
    font-size: 10px;
    border-radius: 8px;
  }

  .move-cell {
    gap: 4px;
  }

  .turn-order-btn {
    width: 22px;
    min-width: 22px;
    height: 22px;
    font-size: 10px;
    border-radius: 8px;
  }

  .waiting-chat-messages {
    padding: 6px 8px;
    gap: 4px;
  }

  .chat-line {
    font-size: 11px;
    line-height: 1.2 !important;
  }

  .waiting-chat-bottom {
    margin-top: 4px;
  }

  .waiting-emoji-row {
    margin-bottom: 4px;
    gap: 4px;
  }

  .waiting-chat-pane .emoji-btn {
    width: 24px;
    min-width: 24px;
    height: 24px;
    font-size: 13px;
    margin: 0;
    padding: 0;
  }

  .waiting-chat-input-row {
    gap: 4px;
  }

  .waiting-chat-input-row .chat-input,
  .waiting-chat-input-row .chat-send-btn {
    margin: 0;
  }

  .waiting-chat-input-row .chat-input {
    padding: 8px 10px;
    font-size: 12px;
  }

  .waiting-chat-input-row .chat-send-btn {
    min-width: 46px;
    padding: 8px 8px !important;
    font-size: 11px;
  }
}


/* ===== v3.10.9 waiting room chat only ===== */
.waiting-chat-messages {
  justify-content: flex-end;
  overflow: hidden;
}

.waiting-chat-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  min-width: 0;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.waiting-chat-line .chat-name {
  flex: 0 0 auto;
}

.waiting-chat-line .chat-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

@media (orientation: landscape) and (max-width: 950px) {
  .waiting-chat-line {
    font-size: 11px;
    line-height: 1.1;
  }
}


/* v3.10.18 hotfix: player status + waiting room */
.player-status-compact {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.player-line {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 10px !important;
}

.player-line-main,
.player-line-sub {
  display: contents !important;
}

.player-line-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-line-count,
.player-line-time {
  white-space: nowrap;
  font-weight: 900;
}

.waiting-order-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.turn-order-list.table-like {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

@media (orientation: landscape) and (max-width: 950px) {
  .turn-order-list.table-like {
    max-height: 320px;
  }
}

.record-total-time {
  font-weight: 800;
  color: #cbd5e1;
}

.record-total-time.is-max {
  color: #f87171 !important;
  font-weight: 900;
}

.coffee-pending-row,
.record-warning,
.record-action-btn[data-action="coffee"] {
  display: none !important;
}



/* ===== v3.10.35 mobile landscape layout rebalance ===== */
@media (orientation: landscape) and (max-width: 950px) {
  .mobile-game-shell {
    gap: 6px !important;
  }

  .top-strip {
    grid-template-columns: 118px minmax(0, 1fr) 92px !important;
    gap: 6px !important;
    align-items: stretch !important;
  }

  .progress-panel,
  .table-panel,
  .side-mini-stack,
  .mini-box {
    min-height: 0 !important;
  }

  .player-status-compact {
    max-height: 190px !important;
    overflow-y: auto !important;
    padding-right: 2px !important;
  }

  .player-line {
    gap: 8px !important;
    padding: 6px 7px !important;
  }

  .table-panel {
    display: flex !important;
    flex-direction: column !important;
    padding: 10px 12px 8px !important;
  }

  .table-panel-head {
    gap: 8px !important;
    margin-bottom: 4px !important;
  }

  .chat-strip {
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
    flex: 0 0 auto !important;
  }

  .compact-chat-messages {
    min-height: 28px !important;
    font-size: 10px !important;
    gap: 2px !important;
  }

  .compact-pile {
    --tile-w: 62px !important;
    --tile-h: 84px !important;
    --tile-gap: 4px !important;
    min-height: 94px !important;
    height: 94px !important;
    max-height: 94px !important;
    padding-top: 0 !important;
    flex: 1 1 auto !important;
  }

  .compact-pile .tile {
    transform: scale(0.95) !important;
    transform-origin: center center !important;
  }

  .compact-pile.table-highlight .tile {
    transform: scale(1.0) !important;
  }

  .side-mini-stack {
    grid-template-rows: auto auto !important;
    gap: 6px !important;
  }

  .mini-box {
    padding: 8px !important;
  }

  .spectator-list {
    max-height: 72px !important; /* about 2 spectators */
    min-height: 72px !important;
    overflow-y: auto !important;
    padding-right: 2px !important;
  }

  .spectator-item,
  .spectator-badge,
  .spectator-list > div {
    max-height: 28px !important;
  }

  .emoji-panel {
    min-height: 72px !important;
  }

  .hand-zone {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    padding: 8px 8px 6px !important;
    overflow: hidden !important;
  }

  .controls-head {
    margin-bottom: 4px !important;
  }

  .hand-area {
    --tile-w: 66px !important;
    --tile-h: 90px !important;
    --tile-gap: 4px !important;
    min-height: 96px !important;
    max-height: 104px !important;
    padding-top: 4px !important;
    padding-bottom: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .hand-area .tile {
    transform: scale(0.95);
    transform-origin: center top;
  }

  .compact-status {
    min-height: 18px !important;
    margin-top: 2px !important;
    font-size: 11px !important;
  }
}


/* ===== v3.10.40 mobile layout trim ===== */
@media (orientation: landscape) and (max-width: 950px) {
  .top-strip {
    grid-template-columns: 195px minmax(0, 1fr) 104px !important;
    gap: 6px !important;
    align-items: start !important;
  }

  .progress-panel,
  .table-panel,
  .side-mini-stack {
    align-self: start !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .progress-panel {
    width: 195px !important;
    padding: 8px 8px 8px !important;
  }

  .player-status-compact {
    max-height: none !important;
    overflow-y: visible !important;
    gap: 5px !important;
    padding-right: 0 !important;
  }

  .player-line {
    padding: 6px 8px !important;
    min-height: 42px !important;
  }

  .table-panel {
    padding: 8px 10px 8px !important;
  }

  .table-panel-head {
    margin-bottom: 4px !important;
  }

  .chat-strip {
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
  }

  .compact-chat-messages {
    min-height: 24px !important;
    font-size: 10px !important;
    gap: 2px !important;
  }

  .compact-pile {
    --tile-w: 60px !important;
    --tile-h: 82px !important;
    --tile-gap: 4px !important;
    min-height: 84px !important;
    height: 84px !important;
    max-height: 84px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
  }

  .compact-pile .tile {
    transform: scale(0.92) !important;
    transform-origin: center center !important;
  }

  .compact-pile.table-highlight .tile {
    transform: scale(0.96) !important;
  }

  .side-mini-stack {
    grid-template-rows: auto auto !important;
    align-content: start !important;
    gap: 6px !important;
  }

  .mini-box {
    min-height: 0 !important;
    padding: 8px !important;
  }

  .spectator-list {
    min-height: 102px !important;
    max-height: 102px !important;
    overflow-y: auto !important;
    padding-right: 2px !important;
  }

  .emoji-panel {
    min-height: 48px !important;
    height: 48px !important;
  }

  .emoji-row-stack {
    gap: 5px !important;
  }

  .emoji-btn {
    width: 26px !important;
    min-width: 26px !important;
    height: 26px !important;
    font-size: 14px !important;
  }

  .hand-zone {
    margin-top: 0 !important;
    padding: 6px 8px 5px !important;
  }

  .controls-head {
    margin-bottom: 3px !important;
  }

  .inline-btn {
    min-width: 74px !important;
    padding: 7px 10px !important;
  }

  .compact-sort-bar .sort-btn {
    padding: 5px 7px !important;
  }

  .hand-area {
    --tile-w: 64px !important;
    --tile-h: 87px !important;
    --tile-gap: 4px !important;
    min-height: 90px !important;
    max-height: 94px !important;
    padding-top: 2px !important;
    padding-bottom: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .hand-area .tile {
    transform: scale(0.97) !important;
    transform-origin: center top !important;
  }

  .compact-status {
    min-height: 16px !important;
    margin-top: 2px !important;
    font-size: 11px !important;
  }
}


/* ===== v3.10.41 top-strip height fix + hand 3% trim ===== */
.top-strip {
  grid-template-columns: 195px minmax(0, 1fr) 126px !important;
  gap: 8px !important;
  align-items: start !important;
}

.progress-panel,
.table-panel,
.side-mini-stack {
  min-height: 273px !important;
  height: 273px !important;
  max-height: 273px !important;
  align-self: start !important;
}

.progress-panel {
  width: 195px !important;
  padding: 10px 10px 8px !important;
}

.player-status-compact {
  max-height: 223px !important;
  overflow-y: auto !important;
  padding-right: 2px !important;
}

.table-panel {
  display: flex !important;
  flex-direction: column !important;
  padding: 10px 12px 8px !important;
}

.chat-strip {
  flex: 0 0 auto !important;
}

.compact-pile {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding-top: 2px !important;
  padding-bottom: 0 !important;
}

.side-mini-stack {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-content: start !important;
}

.mini-box {
  min-height: 0 !important;
  overflow: hidden !important;
}

.spectator-list {
  min-height: 102px !important;
  max-height: 102px !important;
  overflow-y: auto !important;
}

.emoji-panel {
  min-height: 62px !important;
  height: 62px !important;
}

.hand-area {
  --tile-w: 72px !important;
  --tile-h: 99px !important;
}

@media (orientation: landscape) and (max-width: 950px) {
  .top-strip {
    grid-template-columns: 195px minmax(0, 1fr) 104px !important;
    gap: 6px !important;
  }

  .progress-panel,
  .table-panel,
  .side-mini-stack {
    min-height: 220px !important;
    height: 220px !important;
    max-height: 220px !important;
  }

  .progress-panel {
    padding: 8px !important;
  }

  .player-status-compact {
    max-height: 170px !important;
    overflow-y: auto !important;
    gap: 5px !important;
  }

  .table-panel {
    padding: 8px 10px 7px !important;
  }

  .chat-strip {
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
  }

  .compact-chat-messages {
    min-height: 22px !important;
    font-size: 10px !important;
    gap: 2px !important;
  }

  .compact-pile {
    --tile-w: 58px !important;
    --tile-h: 79px !important;
    --tile-gap: 4px !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
  }

  .compact-pile .tile {
    transform: scale(0.9) !important;
  }

  .compact-pile.table-highlight .tile {
    transform: scale(0.94) !important;
  }

  .side-mini-stack {
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 6px !important;
  }

  .spectator-list {
    min-height: 102px !important;
    max-height: 102px !important;
  }

  .emoji-panel {
    min-height: 46px !important;
    height: 46px !important;
  }

  .emoji-btn {
    width: 26px !important;
    min-width: 26px !important;
    height: 26px !important;
    font-size: 14px !important;
  }

  .hand-zone {
    padding: 6px 8px 5px !important;
  }

  .hand-area {
    --tile-w: 62px !important;
    --tile-h: 84px !important;
    --tile-gap: 4px !important;
    min-height: 88px !important;
    max-height: 92px !important;
    padding-top: 2px !important;
    padding-bottom: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .hand-area .tile {
    transform: scale(0.94) !important;
    transform-origin: center top !important;
  }
}


/* ===== v3.10.42 density tune ===== */
.top-strip {
  grid-template-columns: 195px minmax(0, 1fr) 126px !important;
}

.progress-panel {
  width: 195px !important;
}

.player-status-compact {
  gap: 4px !important;
  max-height: 224px !important;
}

.player-line {
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  column-gap: 8px !important;
  row-gap: 0 !important;
  padding: 5px 8px !important;
  min-height: 36px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
}

.player-line-name {
  font-size: 12px !important;
  line-height: 1.1 !important;
}

.player-line-count,
.player-line-time {
  font-size: 12px !important;
  line-height: 1 !important;
}

.player-line-count {
  margin-right: 20px !important;
}

.compact-pile .tile {
  transform: scale(0.945) !important;
  transform-origin: center center !important;
}

.compact-pile.table-highlight .tile {
  transform: scale(0.99) !important;
}

.hand-area .tile {
  transform: scale(0.97) !important;
  transform-origin: center top !important;
}

@media (orientation: landscape) and (max-width: 950px) {
  .player-status-compact {
    gap: 3px !important;
    max-height: 174px !important;
  }

  .player-line {
    column-gap: 7px !important;
    padding: 4px 7px !important;
    min-height: 30px !important;
    font-size: 11px !important;
  }

  .player-line-name,
  .player-line-count,
  .player-line-time {
    font-size: 11px !important;
  }

  .player-line-count {
    margin-right: 16px !important;
  }

  .spectator-list {
    min-height: 102px !important;
    max-height: 102px !important;
  }

  .compact-pile .tile {
    transform: scale(0.99) !important;
  }

  .compact-pile.table-highlight .tile {
    transform: scale(1.035) !important;
  }

  .hand-area .tile {
    transform: scale(0.91) !important;
  }
}


/* ===== v3.10.48 stability patch ===== */
.hand-area.compact {
  --tile-w: var(--compact-tile-w, 54px) !important;
  --tile-h: var(--compact-tile-h, 74px) !important;
  --tile-gap: var(--compact-tile-gap, 3px) !important;
  overflow-x: hidden !important;
}

.hand-area.compact .tile {
  transform: none !important;
}

@media (orientation: landscape) and (max-width: 950px) {
  .winner-card {
    width: min(94vw, 760px);
    max-height: calc(100dvh - 12px);
    overflow-y: auto;
  }

}


.loser-start-row { margin-top: 8px; justify-content: center; }
.loser-mini-game-modal-card { width: min(92vw, 760px); max-height: 88vh; overflow-y: auto; }
.loser-mini-game-modal-desc { margin-bottom: 10px; }
.loser-mini-game-panel-standalone { margin-top: 0; }
@media (max-width: 640px) {
  .loser-mini-game-modal-card { width: 94vw; max-height: 90vh; padding: 14px; }
}


/* ===== v3.10.65 emoji compact row + synced audio ===== */
.emoji-panel {
  justify-content: flex-start;
}

.emoji-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.emoji-row::-webkit-scrollbar {
  display: none;
}

.emoji-btn {
  width: auto;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.emoji-btn-icon {
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}

.emoji-btn-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.3px;
  flex: 0 0 auto;
}

.emoji-row-stack {
  justify-content: flex-start;
  align-items: center;
}

.game-emoji-row {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 6px;
  padding: 0 2px;
}

.game-emoji-box {
  display: none !important;
}

.waiting-emoji-row {
  justify-content: flex-start;
  margin-bottom: 8px;
  gap: 6px;
}

.waiting-chat-pane .emoji-btn {
  width: auto;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
}

.emoji-overlay {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.emoji-overlay-icon {
  font-size: 28px;
  animation: emojiPop 1.1s ease forwards;
}

.emoji-overlay-text {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.3px;
  line-height: 1;
  animation: emojiPop 1.1s ease forwards;
}

@media (orientation: landscape) and (max-width: 950px) {
  .emoji-row {
    gap: 4px;
  }

  .emoji-btn {
    height: 24px;
    padding: 0 6px;
    gap: 2px;
  }

  .emoji-btn-icon {
    font-size: 12px;
  }

  .emoji-btn-label {
    font-size: 8px;
    letter-spacing: -0.45px;
  }

  .waiting-chat-pane .emoji-btn {
    height: 24px;
    padding: 0 6px;
  }

  .game-emoji-row {
    margin: 0 4px;
  }

  .emoji-overlay {
    top: 8px;
    padding: 5px 10px;
    border-radius: 14px;
    gap: 6px;
  }

  .emoji-overlay-icon {
    font-size: 22px;
  }

  .emoji-overlay-text {
    font-size: 12px;
  }

  .controls-head {
    gap: 6px;
  }

  
.loser-mini-game-result {
  margin: 6px 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.86), rgba(69, 10, 10, 0.92));
  border: 1px solid rgba(248, 113, 113, 0.42);
  box-shadow: 0 10px 24px rgba(127, 29, 29, 0.24);
  text-align: center;
}

.loser-mini-game-result-badge {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fecaca;
  margin-bottom: 4px;
}

.loser-mini-game-result-name {
  font-size: 24px;
  font-weight: 1000;
  color: #fff5f5;
}

.loser-final-banner {
  width: 100%;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.selected-tile-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 82px;
}

.loser-mini-game-deck .mini-card-back {
  width: 72px;
  min-height: 48px;
  flex: 0 0 72px;
}

.loser-picked-slot .mini-card-back.picked-slot {
  width: 60px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loser-picked-slot .mini-card-back.picked-slot.selected-card {
  width: 64px;
  min-height: 84px;
}

.compact-sort-bar {
    flex: 0 0 auto;
    gap: 4px;
  }

  .compact-sort-bar .sort-btn {
    padding: 5px 7px;
    font-size: 11px;
  }
}


/* ===== v3.10.66 unified controls + inline loser panel + waiting chat highlight ===== */
.controls-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.primary-controls {
  flex: 0 0 auto;
}

.game-emoji-row {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
}


.loser-mini-game-result {
  margin: 6px 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.86), rgba(69, 10, 10, 0.92));
  border: 1px solid rgba(248, 113, 113, 0.42);
  box-shadow: 0 10px 24px rgba(127, 29, 29, 0.24);
  text-align: center;
}

.loser-mini-game-result-badge {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fecaca;
  margin-bottom: 4px;
}

.loser-mini-game-result-name {
  font-size: 24px;
  font-weight: 1000;
  color: #fff5f5;
}

.loser-final-banner {
  width: 100%;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.selected-tile-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 82px;
}

.loser-mini-game-deck .mini-card-back {
  width: 72px;
  min-height: 48px;
  flex: 0 0 72px;
}

.loser-picked-slot .mini-card-back.picked-slot {
  width: 60px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loser-picked-slot .mini-card-back.picked-slot.selected-card {
  width: 64px;
  min-height: 84px;
}

.compact-sort-bar {
  flex: 0 0 auto;
  margin-left: 0;
}

.loser-mini-game-inline-wrap {
  margin-top: 14px;
  width: 100%;
}

.loser-mini-game-panel-inline {
  margin-top: 0;
  width: 100%;
  padding: 16px;
  border-radius: 20px;
  background: rgba(8, 18, 36, 0.96);
}

.loser-mini-game-inline-desc {
  margin-bottom: 4px;
  color: #cbd5e1;
}

.waiting-chat-line.mine .chat-name {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.34);
  color: #dbeafe;
  font-weight: 900;
}

@media (orientation: landscape) and (max-width: 950px) {
  .controls-head {
    gap: 6px;
  }

  .primary-controls {
    gap: 5px;
  }

  .game-emoji-row {
    margin: 0 2px;
  }

  .compact-sort-bar .sort-btn {
    padding: 5px 7px;
    font-size: 11px;
  }

  .loser-mini-game-panel-inline {
    padding: 10px;
  }

  .waiting-chat-line.mine .chat-name {
    padding: 2px 6px;
  }
}


@media (max-width: 900px) {
  .loser-picked-slot {
    flex-basis: 108px;
    min-height: 150px;
    padding: 8px 6px 7px;
  }

  .loser-picked-slot .tile {
    width: 48px;
    height: 68px;
  }

  .loser-mini-game-deck .mini-card-back {
    width: 64px;
    flex-basis: 64px;
  }
}

@media (max-width: 640px) {
  .loser-mini-game-head {
    flex-direction: column;
  }

  .loser-mini-game-actions {
    width: 100%;
  }

  .loser-mini-game-actions button {
    flex: 1 1 0;
  }

  .loser-picked-slot {
    flex-basis: 96px;
    min-height: 138px;
  }

  .loser-picked-slot .tile {
    width: 42px;
    height: 60px;
  }

  .loser-picked-slot .tile-center .tile-number {
    font-size: 18px;
  }

  .loser-mini-game-deck .mini-card-back {
    width: 56px;
    flex-basis: 56px;
    min-height: 44px;
  }

  .loser-mini-game-result-name {
    font-size: 20px;
  }
}


/* ===== v3.11.0 login/admin update base (includes prior loser mini game ux feedback) ===== */
.remaining-hands-panel .loser-mini-game-inline-wrap,
.remaining-hands-panel #loserMiniGamePanel {
  overflow: visible;
}

.loser-mini-game-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 12px;
}

.loser-picked-slot {
  overflow: visible;
}

.loser-final-banner {
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.96), rgba(153, 27, 27, 0.96));
  color: #fff5f5;
  border: 1px solid rgba(254, 202, 202, 0.5);
  box-shadow: 0 8px 18px rgba(127, 29, 29, 0.34);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -0.2px;
  z-index: 2;
}

.loser-picked-note {
  min-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  .loser-final-banner {
    top: -11px;
    font-size: 9px;
    padding: 2px 8px;
  }
}


.loser-mini-game-guide {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

#loserMiniGameRevealBtn.ready {
  background: linear-gradient(180deg, #f59e0b, #ea580c);
  color: #fff7ed;
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.28);
}

#loserMiniGameRevealBtn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

.loser-picked-slot.picked-ready {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18), 0 12px 24px rgba(15, 23, 42, 0.18);
}

.loser-picked-slot.picked-ready .picked-slot,
.loser-picked-slot.picked-ready .selected-card {
  border-color: rgba(96, 165, 250, 0.95);
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.24), rgba(15, 23, 42, 0.9));
  color: #dbeafe;
}

.loser-mini-game-deck .mini-card-back.selected {
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18), 0 12px 22px rgba(30, 64, 175, 0.18);
  transform: translateY(-2px) scale(1.03);
}

@media (max-width: 640px) {
  .loser-mini-game-guide {
    font-size: 12px;
    padding: 9px 10px;
  }
}


/* ===== v3.11.0 pass sound path + loser popup guide sizing carryover ===== */
.loser-start-row {
  margin-top: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

.loser-start-row .loser-mini-game-guide {
  flex: 1 1 auto;
  width: auto;
  margin-top: 0;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
}

.loser-start-row #loserMiniGameStartBtn {
  flex: 0 0 auto;
  min-width: 170px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .loser-start-row {
    flex-direction: column;
    align-items: stretch;
  }

  .loser-start-row .loser-mini-game-guide {
    font-size: 14px;
  }

  .loser-start-row #loserMiniGameStartBtn {
    min-width: 0;
    width: 100%;
  }
}


.login-card {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.login-card-head h4 {
  margin: 0;
  font-size: 16px;
}

.login-status {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.auth-row,
.admin-row {
  margin-top: 8px;
}

.auth-controls {
  margin-top: 10px;
}

#onlineName[readonly] {
  background: rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
}
