/* ==========================================
   MODAKBUL PLAYGROUND STYLES
   Cohesive storybook / night-cabin styling paired with /style.css
   ========================================== */

.pg-hero-cards {
  transform-box: fill-box;
  transform-origin: center;
  animation: pgCardsFloat 3.4s ease-in-out infinite;
}

@keyframes pgCardsFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

.pg-lobby-card {
  max-width: 470px;
}

#pgActiveRoomsOverlay {
  z-index: 30;
}

.pg-create-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pg-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pg-choice-pill {
  background: var(--paper-card);
  border: 2px solid var(--paper-border);
  border-radius: 14px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-dark);
  transition: all 0.2s ease;
}

.pg-choice-pill strong {
  font-size: 13px;
}

.pg-choice-pill small {
  font-size: 11px;
  color: var(--ink-sub);
}

.pg-choice-pill.active {
  background: #fff4e2;
  border-color: var(--accent-fire);
  box-shadow: 0 0 0 3px rgba(229, 109, 73, 0.14);
}

.pg-bg-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.pg-bg-pill {
  background: #f5ebd7;
  border: 1.5px solid #dec9a4;
  border-radius: 11px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #5b4234;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pg-bg-pill.active {
  background: #332724;
  border-color: #f0b357;
  color: #ffe8c2;
}

.btn-outline-shelter {
  width: 100%;
  padding: 10px 14px;
  background: #efe3cf;
  border: 1.5px solid #d4bea0;
  border-bottom: 3px solid #bfa684;
  border-radius: 14px;
  color: #533a2c;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.2s ease, background 0.18s;
}

.btn-outline-shelter:hover {
  background: #e6d5b8;
  transform: translateY(-1.5px);
}

/* ==========================================
   TOP PHASE STATUS BAR
   ========================================== */
.pg-phase-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 16px;
  border-radius: 18px;
  flex-shrink: 0;
  max-width: 100%;
}

.pg-phase-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.pg-mode-chip {
  background: rgba(240, 179, 87, 0.2);
  border: 1px solid rgba(240, 179, 87, 0.45);
  color: #ffe2b3;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.pg-phase-title {
  font-family: 'Gowun Batang', serif;
  color: #fff4df;
  font-size: 13.5px;
  white-space: nowrap;
}

.pg-phase-timer {
  background: rgba(229, 109, 73, 0.34);
  border: 1.5px solid rgba(255, 162, 132, 0.68);
  color: #ffe3d8;
  padding: 2.5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.pg-phase-timer.warning {
  background: rgba(243, 156, 18, 0.36);
  border-color: rgba(255, 200, 102, 0.78);
  color: #ffeab8;
}

.pg-phase-timer.urgent {
  background: rgba(235, 77, 75, 0.58);
  border-color: rgba(255, 136, 134, 0.9);
  color: #fff;
  animation: pulseWarning 0.55s infinite alternate;
}

.pg-phase-sub {
  font-size: 11px;
  color: rgba(245, 224, 196, 0.78);
  text-align: center;
  word-break: keep-all;
}

/* ==========================================
   CENTER FLOATING GAME STAGE
   Sits cleanly above campfire & campers
   ========================================== */
.pg-game-stage {
  position: fixed;
  top: var(--pg-stage-top, 84px);
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 650px));
  max-width: calc(100vw - 24px);
  max-height: calc(var(--app-vh, 100dvh) - var(--pg-stage-top, 84px) - var(--pg-stage-bottom-reserve, 185px));
  overflow-y: auto;
  padding: 12px 15px;
  border-radius: 20px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pg-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pg-stage-heading {
  font-family: 'Gowun Batang', serif;
  font-size: 15.5px;
  font-weight: 700;
  color: #ffe8c4;
}

.pg-stage-header-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.pg-stage-timer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3.5px 11px;
  border-radius: 999px;
  background: rgba(240, 179, 87, 0.22);
  border: 1.5px solid rgba(240, 179, 87, 0.58);
  color: #ffebc7;
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(10, 6, 4, 0.28);
}

.pg-stage-timer-pill.warning {
  background: rgba(243, 156, 18, 0.34);
  border-color: rgba(255, 200, 102, 0.85);
  color: #fff0c2;
}

.pg-stage-timer-pill.urgent {
  background: rgba(235, 77, 75, 0.62);
  border-color: rgba(255, 145, 142, 0.95);
  color: #ffffff;
  animation: pulseWarning 0.55s infinite alternate;
}

.pg-timer-bar-wrap {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 240, 214, 0.12);
  overflow: hidden;
  margin-top: -4px;
  flex-shrink: 0;
}

.pg-timer-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3ba61, #e56d49);
  transition: width 0.12s linear, background 0.2s ease;
}

.pg-timer-bar-fill.warning {
  background: linear-gradient(90deg, #ffd166, #f39c12);
}

.pg-timer-bar-fill.urgent {
  background: linear-gradient(90deg, #ff7675, #eb4d4b);
}

.pg-secret-toggle {
  background: rgba(255, 240, 214, 0.1);
  border: 1px solid rgba(242, 214, 178, 0.3);
  color: #fbe8cb;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.pg-secret-toggle:hover {
  background: rgba(240, 179, 87, 0.22);
}

.pg-secret-card {
  background: rgba(20, 14, 12, 0.7);
  border: 1.5px solid rgba(240, 179, 87, 0.45);
  border-radius: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pg-secret-card.is-liar,
.pg-secret-card.is-mafia {
  border-color: rgba(255, 118, 117, 0.65);
  background: rgba(58, 22, 24, 0.72);
}

.pg-secret-card.is-hidden-mask {
  justify-content: center;
  color: #cbb89f;
  font-size: 12px;
}

.pg-secret-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pg-secret-label {
  font-size: 11px;
  color: rgba(245, 224, 196, 0.75);
}

.pg-secret-value {
  font-family: 'Gowun Batang', serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff3da;
}

.pg-secret-extra {
  font-size: 11.5px;
  color: #ffd58e;
}

.pg-stage-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pg-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pg-setting-box {
  background: rgba(255, 245, 230, 0.06);
  border: 1px solid rgba(242, 214, 178, 0.18);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pg-setting-box label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.pg-inline-select {
  background: rgba(20, 14, 12, 0.75);
  border: 1px solid rgba(240, 179, 87, 0.35);
  color: #fbf2e3;
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 12.5px;
  outline: none;
}

.pg-info-banner {
  background: rgba(255, 240, 214, 0.08);
  border: 1px solid rgba(242, 214, 178, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #f8e8cf;
  text-align: center;
  word-break: keep-all;
}

.pg-hint-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 120px;
  overflow-y: auto;
  padding-right: 4px;
}

.pg-game-stage,
.pg-hint-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 214, 178, 0.28) transparent;
}

.pg-game-stage::-webkit-scrollbar,
.pg-hint-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.pg-game-stage::-webkit-scrollbar-track,
.pg-hint-list::-webkit-scrollbar-track {
  background: transparent;
}

.pg-game-stage::-webkit-scrollbar-thumb,
.pg-hint-list::-webkit-scrollbar-thumb {
  background: rgba(242, 214, 178, 0.26);
  border-radius: 99px;
}

.pg-game-stage::-webkit-scrollbar-thumb:hover,
.pg-hint-list::-webkit-scrollbar-thumb:hover {
  background: rgba(242, 214, 178, 0.46);
}

.pg-hint-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(20, 14, 12, 0.55);
  border: 1px solid rgba(242, 214, 178, 0.16);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
}

.pg-hint-author {
  font-weight: 700;
  white-space: nowrap;
}

.pg-action-form {
  display: flex;
  gap: 6px;
}

.pg-action-input {
  flex: 1;
  min-width: 0;
  background: rgba(20, 14, 12, 0.8);
  border: 1.5px solid rgba(240, 179, 87, 0.42);
  border-radius: 11px;
  padding: 8px 11px;
  color: #fff6e8;
  font-size: 13px;
  outline: none;
}

.pg-action-input:focus {
  border-color: var(--accent-amber);
}

.pg-action-btn {
  background: var(--accent-fire);
  border: none;
  border-bottom: 3px solid var(--accent-fire-edge);
  color: #fffaf2;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}

.pg-action-btn:hover:not(:disabled) {
  background: var(--accent-fire-hover);
  transform: translateY(-1px);
}

.pg-action-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.pg-action-btn.secondary {
  background: rgba(255, 240, 218, 0.14);
  border: 1px solid rgba(242, 214, 178, 0.35);
  border-bottom-width: 2px;
  color: #ffefd6;
}

.pg-action-btn.secondary.active {
  background: rgba(115, 168, 125, 0.36);
  border-color: #82c48f;
}

.pg-action-btn.danger {
  background: #c84b4b;
  border-bottom-color: #8f2d2d;
}

.pg-action-btn.selected {
  box-shadow: 0 0 0 2.5px #ffd166;
  transform: translateY(-1px);
}

.pg-vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
}

.pg-vote-card {
  background: rgba(255, 240, 218, 0.08);
  border: 1.5px solid rgba(242, 214, 178, 0.24);
  border-radius: 13px;
  padding: 9px 10px 8px;
  color: #fff4df;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  text-align: left;
  transition: all 0.16s ease;
}

.pg-vote-user {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.pg-vote-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff7e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-vote-action {
  width: 100%;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(240, 179, 87, 0.16);
  border: 1px solid rgba(240, 179, 87, 0.34);
  color: #ffe2b3;
  transition: all 0.16s ease;
}

.pg-vote-card:hover:not(:disabled) {
  background: rgba(240, 179, 87, 0.2);
  border-color: rgba(240, 179, 87, 0.62);
}

.pg-vote-card:hover:not(:disabled) .pg-vote-action {
  background: rgba(240, 179, 87, 0.3);
  border-color: rgba(240, 179, 87, 0.65);
  color: #fff8eb;
}

.pg-vote-card.selected {
  background: rgba(229, 109, 73, 0.32);
  border-color: #ff8e6b;
  box-shadow: 0 0 0 2px rgba(229, 109, 73, 0.24);
}

.pg-vote-action.is-selected {
  background: rgba(229, 109, 73, 0.44);
  border-color: #ff9a7b;
  color: #ffffff;
}

.pg-vote-card.dead {
  opacity: 0.45;
  cursor: not-allowed;
}

.pg-vote-action.is-dead {
  background: rgba(120, 130, 155, 0.18);
  border-color: rgba(150, 160, 185, 0.28);
  color: #aeb8d0;
}

.pg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pg-result-box {
  background: rgba(20, 14, 12, 0.72);
  border: 1.5px solid rgba(240, 179, 87, 0.45);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pg-result-title {
  font-family: 'Gowun Batang', serif;
  font-size: 16px;
  font-weight: 700;
  color: #ffe3a8;
  text-align: center;
}

.pg-result-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.pg-role-tag {
  background: rgba(255, 240, 218, 0.08);
  border: 1px solid rgba(242, 214, 178, 0.2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: #fbe8cb;
}

.pg-role-tag.bad {
  border-color: rgba(255, 118, 117, 0.55);
  background: rgba(235, 77, 75, 0.2);
  color: #ffd3d3;
}

.pg-row-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pg-badge-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(240, 179, 87, 0.2);
  color: #ffd99c;
  flex-shrink: 0;
}

.pg-badge-pill.dead {
  background: rgba(120, 130, 155, 0.25);
  color: #b7c0d8;
}

.msg-item.mafia-secret {
  background: rgba(200, 55, 55, 0.22);
  border-left: 3px solid #ff6b6b;
  padding: 4px 8px;
  border-radius: 6px;
}

.msg-item.ghost {
  background: rgba(110, 130, 180, 0.16);
  border-left: 3px solid #8ea6db;
  padding: 4px 8px;
  border-radius: 6px;
  color: #c2ceea;
}

/* Override lobby/modal badge styling cleanly */
.room-badge-liar {
  background: #fdf0db;
  color: #9e5614;
  border: 1px solid #ecc995;
}

.room-badge-mafia {
  background: #fae4e4;
  color: #a33333;
  border: 1px solid #eab7b7;
}

/* Playground has no bottom dock -> anchor chat bar flush at the bottom */
body.pg-body .bottom-chat-bar {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* Responsive Playground Stage */
@media (max-width: 1420px) {
  .pg-game-stage {
    width: min(560px, calc(100vw - 24px));
    top: var(--pg-stage-top, 120px);
    max-height: calc(var(--app-vh, 100dvh) - var(--pg-stage-top, 120px) - var(--pg-stage-bottom-reserve, 164px));
  }

  body.pg-body .campers-panel,
  body.pg-body .chat-panel {
    bottom: var(--pg-drawer-bottom, 64px);
    max-height: calc(var(--app-vh, 100dvh) - var(--pg-stage-top, 120px) - var(--pg-drawer-bottom-visual, var(--pg-drawer-bottom, 64px)) - 10px);
  }

  body.pg-body .chat-panel {
    height: min(44dvh, calc(var(--app-vh, 100dvh) - var(--pg-stage-top, 120px) - var(--pg-drawer-bottom-visual, var(--pg-drawer-bottom, 64px)) - 10px));
  }
}

@media (max-width: 768px) {
  .pg-game-stage {
    top: var(--pg-stage-top, 124px);
    width: calc(100vw - 12px);
    padding: 9px 11px;
    max-height: calc(var(--app-vh, 100dvh) - var(--pg-stage-top, 124px) - var(--pg-stage-bottom-reserve, 132px));
  }

  .pg-settings-grid {
    grid-template-columns: 1fr;
  }

  .pg-phase-meter {
    padding: 4px 10px;
  }

  .pg-vote-grid {
    grid-template-columns: 1fr 1fr;
  }

  body.pg-body .bottom-chat-bar {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  body.pg-body .campers-panel,
  body.pg-body .chat-panel {
    bottom: var(--pg-drawer-bottom, 58px);
  }

  body.pg-body.keyboard-open .room-info-pill,
  body.pg-body.keyboard-open .audio-controls,
  body.pg-body.keyboard-open .pg-phase-sub {
    display: none !important;
  }

  body.pg-body.keyboard-open .pg-phase-meter {
    padding: 4px 12px;
    width: 100%;
  }

  body.pg-body.keyboard-open .bottom-chat-bar {
    bottom: calc(var(--kb-bottom, 0px) + 6px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

.pg-user-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-item .voice-badge {
  flex-shrink: 0;
}
