body.mode-lobby,
body.mode-game {
  overflow: hidden;
  height: 100vh;
}

body.mode-lobby .shell,
body.mode-game .shell {
  width: 100%;
  max-width: none;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

body.mode-lobby .lobby-only,
body.mode-game .game-only {
  display: block;
}

/* Base button enhancements */
button:active:not(:disabled) {
  transform: scale(0.98);
  filter: brightness(0.9);
}

.legacy-action-btn:active:not(:disabled),
.legacy-launch-btn:active:not(:disabled),
.legacy-submit-btn:active:not(:disabled),
.legacy-ghost-btn:active:not(:disabled) {
  transform: scale(0.96);
  filter: brightness(0.92);
}

button:focus-visible {
  outline: 2px solid #f2d38c;
  outline-offset: 2px;
}

/* Loading state for buttons */
.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

/* Pulse animation for the Start button */
@keyframes pulse-gold {
  0% { box-shadow: 0 0 0 0 rgba(242, 211, 140, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(242, 211, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 211, 140, 0); }
}

#btn-start:not(:disabled) {
  animation: pulse-gold 2s infinite;
}

body.mode-lobby .game-only,
body.mode-game .lobby-only {
  display: none !important;
}

#play-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.play-topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 160px 190px auto;
  min-height: 41px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(31, 16, 12, 0.55);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  color: #f7efe2;
  font-family: "Montserrat", sans-serif;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-block {
  min-width: 0;
  min-height: 60px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-right: 1px solid rgba(0, 0, 0, 0.28);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  height: 60px;
}

.topbar-block-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.topbar-block-btn:hover,
.topbar-block-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.topbar-block-btn:disabled,
.topbar-block-btn.is-disabled {
  cursor: default;
  opacity: 0.55;
}

.topbar-block-btn:disabled:hover,
.topbar-block-btn:disabled:focus-visible,
.topbar-block-btn.is-disabled:hover,
.topbar-block-btn.is-disabled:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.topbar-histo {
  justify-content: space-between;
}

.topbar-block-room {
  justify-content: flex-start;
  text-transform: none;
  letter-spacing: 0;
}

.topbar-block-room strong {
  color: #f2d38c;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-block-count {
  color: rgba(247, 239, 226, 0.9);
  letter-spacing: 0.03em;
  text-transform: none;
}

.topbar-block-premium {
  justify-content: space-between;
}

.toggle-icon {
  font-size: 0.6rem;
  opacity: 0.72;
}

.topbar-block-icons {
  padding: 0;
  display: flex;
  gap: 0;
  align-self: stretch;
  align-items: stretch;
  overflow: hidden;
}

.topbar-icon-btn {
  width: 54px;
  min-width: 54px;
  height: 100%;
  border: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.28);
  background-color: rgba(255, 255, 255, 0.08);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px 22px;
  cursor: pointer;
}

.topbar-icon-btn:hover,
.topbar-icon-btn:focus-visible {
  background-color: rgba(255, 255, 255, 0.14);
}

.topbar-icon-refresh {
  background-image: url("img/ui/icons/refresh.svg");
}

.topbar-icon-download {
  background-image: url("img/ui/icons/download.svg");
}

.topbar-icon-clear {
  background-image: url("img/ui/icons/clear-chat.svg");
}

.topbar-icon-bug {
  background-image: url("img/ui/icons/bug.svg");
}

.topbar-icon-settings {
  background-image: url("img/ui/icons/settings.svg");
}

.topbar-icon-quit {
  background-image: url("img/ui/icons/quit.svg");
}

/* Header history icon (home page topbar) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.08);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}

.header-icon-btn:hover,
.header-icon-btn:focus-visible {
  background-color: rgba(255, 255, 255, 0.16);
}

.header-icon-history {
  background-image: url("img/ui/icons/history.svg");
  filter: invert(1) brightness(0.9);
}

.play-stage {
  position: relative;
  flex: 1;
  height: calc(100vh - 40px);
  min-height: calc(100vh - 40px);
  padding: 0 0 8px;
  overflow: hidden;
  transition: background 1.5s ease-in-out;
}

.play-stage::before,
.play-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.play-stage::before {
  top: -36px;
  height: 220px;
  bottom: auto;
  background: url("img/scenes/clouds1.png") repeat-x top left;
  opacity: 0.34;
  animation: legacy-clouds 120s linear infinite;
  -webkit-mask-image: linear-gradient(
    180deg,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 72%,
    rgba(0, 0, 0, 0.82) 84%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    180deg,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 72%,
    rgba(0, 0, 0, 0.82) 84%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 1;
}

.play-stage::after {
  background: url("img/scenes/village-day-new.png") no-repeat center center / cover;
  opacity: 0.94;
  transition: opacity 1.5s ease-in-out, background 1.5s ease-in-out;
  z-index: 0;
}

body.clouds-disabled .play-stage::before {
  animation: none;
  opacity: 0.16;
}

body.scene-lobby .play-stage,
body.scene-day .play-stage {
  background: linear-gradient(180deg, #5aafd7 0%, #dbe8ef 58%, #ebebea 100%);  transition: background 1.5s ease-in-out;
}

body.scene-lobby .play-stage::after {
  background: url("img/scenes/village-day-new.png") no-repeat center center / cover;
}

body.scene-day .play-stage::after {
  background: url("img/scenes/village-day-new.png") no-repeat center center / cover;
}

body.scene-night .play-stage {
  background: linear-gradient(180deg, #1b253e 0%, #263d68 100%);  transition: background 1.5s ease-in-out;
}

body.scene-night .play-stage::after {
  background: url("img/scenes/nuit-user.png") no-repeat center center / cover;
  opacity: 0.92;  transition: opacity 1.5s ease-in-out;
}

.history-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid rgba(32, 16, 12, 0.65);
  box-shadow: 10px 0 20px rgba(0, 0, 0, 0.35);
}

body.history-open .history-sidebar {
  transform: translateX(0);
}

.history-header {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-day-tag {
  padding: 7px 10px;
  text-align: center;
  background: rgba(238, 227, 204, 0.95);
  color: #6b4d3e;
  font-family: "Acme", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-arrow {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f8efe1;
  font-size: 1rem;
  cursor: pointer;
}

.history-arrow:hover,
.history-arrow:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.history-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-entry + .history-entry {
  margin-top: 5px;
}

.history-time {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 238, 214, 0.58);
  font-size: 0.72rem;
}

.history-text {
  color: #fff1df;
  font-size: 0.87rem;
  line-height: 1.4;
}

.play-grid {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 350px;
  gap: 8px;
padding: 6px 6px 0;
  box-sizing: border-box;
  transition: margin-left 0.28s ease;
  overflow: hidden;
}

body.history-open .play-grid {
  margin-left: 280px;
}

.play-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}

.play-column-left {
  overflow-x: hidden;
  overflow-y: auto !important;
  scrollbar-width: none;
  padding-bottom: 12px;
  box-sizing: border-box;
  height: 100%;
}

.play-column-right {
  overflow-x: hidden;
  overflow-y: auto !important;
  scrollbar-width: none;
  padding-bottom: 12px;
  box-sizing: border-box;
  height: 100%;
}

.play-column-center {
  overflow: hidden;
}

.legacy-panel {
  position: relative;
  overflow: visible;
  max-width: 100%;
  border-radius: 4px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  box-sizing: border-box;
}

.legacy-panel-burgundy {
  background:
    linear-gradient(180deg, rgba(113, 24, 25, 0.96), rgba(88, 21, 20, 0.98)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 48%);
  color: #fff0e2;
}

.legacy-panel-parchment {
  border: 1.5px solid rgba(75, 40, 30, 0.5) !important;
  background:
    linear-gradient(180deg, rgba(223, 197, 129, 0.9), rgba(212, 179, 106, 0.92)),
    url("img/textures/background-compo.png") center center / cover no-repeat;
  color: #631e18;
}

.legacy-panel-players {
  flex: 0 0 auto;
  background:
    linear-gradient(180deg, rgba(121, 80, 66, 0.85), rgba(108, 68, 55, 0.9)),
    url("img/textures/background-players.png") center center / 88% no-repeat;
  color: #fff1df;
}

.legacy-panel-tight {
  flex: 0 0 auto;
}

.legacy-launch-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.legacy-panel-header {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.legacy-panel-header h3 {
  margin: 0;
  color: #fff9ef;
  font-family: "Montserrat", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.legacy-panel-header-parchment {
  background: rgba(162, 133, 79, 0.72);
}

.legacy-panel-header-players {
  background: rgba(88, 56, 45, 0.72);
}

.legacy-panel-body {
  padding: 6px 10px;
}

.legacy-panel-body-parchment,
.legacy-panel-body-players {
  min-height: 0;
}

.legacy-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legacy-panel-footer {
  padding-top: 0;
}

.legacy-field {
  display: block;
  margin-top: 4px;
}

.legacy-pill-btn,
.legacy-action-btn,
.legacy-ghost-btn,
.legacy-submit-btn,
.legacy-launch-btn {
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  font-family: "Source Sans Pro", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.legacy-pill-btn,
.legacy-ghost-btn,
.legacy-action-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #fff2e4;
}

.legacy-pill-btn:hover,
.legacy-action-btn:hover,
.legacy-ghost-btn:hover,
.legacy-submit-btn:hover,
.legacy-launch-btn:hover {
  filter: brightness(1.08);
}

.legacy-pill-btn:disabled,
.legacy-action-btn:disabled,
.legacy-ghost-btn:disabled,
.legacy-submit-btn:disabled,
.legacy-launch-btn:disabled,
.legacy-adjust-btn:disabled,
.topbar-icon-btn:disabled,
.legacy-chat-send:disabled,
.legacy-chat-icon-btn:disabled {
  opacity: 0.48;
  cursor: default;
  filter: none;
}

.legacy-pill-btn-twitter {
  width: 100%;
  background: linear-gradient(180deg, #3f9af3, #2477be);
  border-color: rgba(0, 0, 0, 0.25);
}

.invite-friends-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invite-friend-chip {
  padding: 6px 12px;
  background: rgba(84, 58, 51, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff3e5;
  font-size: 0.84rem;
}

.invite-link-tools {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.invite-link-status {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(255, 243, 229, 0.9);
}

.invite-link-status.is-public {
  color: #c9f1ba;
}

.invite-link-status.is-local-only {
  color: #f3d58c;
}

.invite-link-status.is-error {
  color: #ffb4b4;
}

.legacy-config-summary {
  display: grid;
  gap: 8px;
}

.legacy-config-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.9rem;
}

.legacy-adjust-pair {
  display: flex;
  gap: 6px;
}

.legacy-adjust-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff2e4;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.legacy-adjust-btn:hover,
.legacy-adjust-btn:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.legacy-config-crest {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.legacy-config-crest-img {
  width: 60px;
  height: 80px;
  object-fit: cover;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.25));
}

.legacy-mini-actions {
  display: flex;
}

.legacy-ghost-btn {
  width: 100%;
}

.legacy-ribbon {
  width: 218px;
  height: 58px;
  margin: 8px auto 10px;
  padding: 0 24px;
  position: relative;
  background: url("img/textures/background-chrono.png") no-repeat center / 100% 100%;
  background-position: center -5px;
  color: #5e1717;
  font-family: "Acme", sans-serif;
  font-size: 1.15rem;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  text-indent: 0.06em;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.25));
}

.legacy-ribbon::before,
.legacy-ribbon::after {
  display: none;
}

.legacy-panel-copy {
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.35;
}

.legacy-panel-copy-muted {
  color: rgba(255, 241, 223, 0.74);
}

.legacy-launch-btn {
  margin-top: 10px;
  background: linear-gradient(180deg, #c62c27, #9e1d1a);
  color: #fff6ea;
  border-color: rgba(0, 0, 0, 0.35);
  font-family: "Acme", sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legacy-submit-btn {
  background: linear-gradient(180deg, #e0c88b, #d6b36e);
  color: #4c2e21;
  border-color: rgba(0, 0, 0, 0.3);
}

.legacy-center-board {
  position: relative;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: -4px;
  background: rgba(245, 245, 243, 0.97);
  border: 1px solid rgba(184, 196, 205, 0.98);
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.legacy-rules-block {
  padding: 14px 18px;
  color: var(--hybrid-ink);
  line-height: 1.5;
  font-size: 0.92rem;
}

.legacy-rules-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--hybrid-gold);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.legacy-rules-block p {
  margin-top: 10px;
  color: var(--hybrid-muted);
}

.legacy-rules-block ul {
  margin: 6px 0;
  padding-left: 18px;
}

.legacy-rules-block li + li {
  margin-top: 3px;
}

.legacy-channel-note {
  margin: 0;
  padding: 10px 18px 0;
  color: #6a7481;
  font-size: 0.86rem;
}

.winner-banner {
  margin: 12px 18px 0;
  padding: 9px 12px;
  border: 1px solid rgba(112, 147, 93, 0.35);
  background: rgba(118, 164, 95, 0.14);
  color: #37512f;
  text-align: center;
  font-family: "Acme", sans-serif;
  font-size: 1.2rem;
}

.chat-toolbar {
  padding: 10px 18px 8px;
}

.chat-toolbar.is-hidden {
  display: none;
}

.chat-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.play-column-left::-webkit-scrollbar,
.play-column-right::-webkit-scrollbar,
.chat-tabs::-webkit-scrollbar,
.legacy-action-form::-webkit-scrollbar {
  display: none;
}

.chat-tabs:empty {
  display: none;
}

.chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px 4px 0 0;
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chat-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chat-tab.is-active {
  background: rgba(40, 30, 25, 0.85);
  color: #ffe8c8;
  border-bottom-color: transparent;
}

.chat-tab-badge {
  background: #c62c27;
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}

.chat-messages-container {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-messages::-webkit-scrollbar {
  display: none;
}

.btn-scroll-chat {
  position: absolute;
  bottom: calc(var(--chat-composer-height, 46px) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 6px 14px;
  background: rgba(30, 25, 20, 0.9);
  border: 1px solid rgba(216, 188, 121, 0.4);
  border-radius: 999px;
  color: #d8bc79;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-scroll-chat.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-message {
  display: grid;
  grid-template-areas: "avatar message";
  grid-template-columns: auto 1fr;
  gap: 8px;
  max-width: 100%;
  margin-bottom: 0;
  animation: chat-slide-in 0.3s ease-out;
}

@keyframes chat-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-avatar {
  grid-area: avatar;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: #555;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.chat-message-own {
  grid-template-areas: "avatar message";
  grid-template-columns: auto 1fr;
  align-self: flex-start;
}

.chat-message-own .chat-avatar {
  display: none;
}

.chat-message-other {
  align-self: flex-start;
}

.chat-message-centered,
.chat-phase-separator,
.chat-message-banner {
  display: flex;
  grid-template-areas: "message";
  grid-template-columns: 1fr;
  align-self: flex-start;
  max-width: 100%;
  text-align: left;
}

.chat-bubble {
  grid-area: message;
  position: relative;
  padding: 1px 6px 1px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  word-break: break-word;
}

.chat-message-own .chat-bubble {
  background: transparent;
  border-radius: 0;
  color: inherit;
  border: none;
}

.chat-message-other .chat-bubble {
  background: transparent;
  border-radius: 0;
  color: inherit;
  border: none;
}

.chat-phase-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 8px 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #d8bc79;
  border-top: 1px solid rgba(216, 188, 121, 0.2);
  border-bottom: 1px solid rgba(216, 188, 121, 0.2);
  background: rgba(216, 188, 121, 0.06);
}

.chat-phase-separator .chat-role-icon-small {
  width: 20px;
  height: 20px;
  border-radius: 3px;
}

.chat-message-role-prompt {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(216, 188, 121, 0.1);
  border-left: 3px solid #d8bc79;
  border-radius: 4px;
  font-style: italic;
}

.chat-message-role-prompt .chat-system-text {
  color: #6b5432;
}

.chat-message-system {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.chat-message-system .chat-system-icon {
  color: #8b9aa7;
  font-size: 0.94rem;
  line-height: 1.2;
}

.chat-system-main {
  min-width: 0;
}

.chat-system-text {
  margin: 0;
  color: #b0bac5;
  font-size: 0.88rem;
  line-height: 1.4;
}

.chat-system-time {
  display: block;
  margin-top: 2px;
  color: #70757c;
  font-size: 0.68rem;
}

.chat-message-system.is-entry .chat-system-icon,
.chat-message-system.is-entry .chat-system-text {
  color: #5a9c41;
}

.chat-message-system.is-entry {
  justify-content: start;
  text-align: left;
}

.chat-message-system.is-entry .chat-system-main {
  justify-self: start;
  text-align: left;
}

.chat-message-system.is-exit .chat-system-icon,
.chat-message-system.is-exit .chat-system-text,
.chat-message-system.is-danger .chat-system-icon,
.chat-message-system.is-danger .chat-system-text {
  color: #a04a47;
}

.chat-message-system.is-exit .chat-system-icon {
  transform: scaleX(-1);
}

.chat-message-banner {
  margin: 10px 0;
  padding: 9px 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(113, 161, 92, 0.24), rgba(84, 134, 67, 0.24));
  border: 1px solid rgba(100, 147, 75, 0.28);
  color: #2f4b23;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-role-icon {
  width: 32px;
  height: 32px;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-role-icon-small {
  width: 18px;
  height: 18px;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-message-user .chat-meta-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.76rem;
  color: #8f969d;
}

.chat-message-user .chat-meta-inline strong {
  color: #364760;
  font-size: 0.75rem;
}

.chat-message-user.chat-message-wolves .chat-meta-inline strong {
  color: #c62c27;
}

.chat-message-user.chat-message-lovers .chat-meta-inline strong {
  color: #e87fa0;
}

.chat-message-user.chat-message-siblings .chat-meta-inline strong {
  color: #7eb8e0;
}

.chat-message-user.chat-message-dead .chat-meta-inline strong {
  color: #8a8a8a;
}

.chat-message-user.chat-message-spectators .chat-meta-inline strong {
  color: #a0a0a0;
}

.chat-message-user p {
  margin: 1px 0 0;
  color: #24364d;
  line-height: 1.42;
}

.chat-message-user.chat-message-wolves p {
  color: #7b261b;
}

.chat-message-user.chat-message-dead p {
  color: #6c5f80;
}

.chat-message-user.chat-message-lovers p {
  color: #824766;
}

.chat-message-user.chat-message-siblings p {
  color: #365b78;
}

.chat-message-user.chat-message-spectators p {
  color: #5f646b;
}

.legacy-chat-form {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 7px;
  border-top: 1px solid rgba(173, 171, 165, 0.45);
  background: rgba(246, 246, 244, 0.96);
}

.legacy-chat-input {
  min-height: 30px;
}

.legacy-chat-actions {
  display: flex;
  gap: 6px;
}

.legacy-chat-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(123, 109, 95, 0.2);
  background: rgba(0, 0, 0, 0.03);
  color: #5f4d40;
  font-size: 1rem;
  cursor: pointer;
}

.legacy-chat-send {
  min-width: 80px;
  height: 30px;
  border: none;
  background: linear-gradient(180deg, var(--hybrid-gold), color-mix(in srgb, var(--hybrid-gold) 70%, #000));
  color: var(--hybrid-bg-deep, #0b0e11);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.chat-bottom-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 14px 12px;
}

.chat-bottom-actions:not(:has(button:not(.hidden))) {
  display: none;
}

.legacy-side-note {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.legacy-panel-body-players {
  height: auto;
  display: flex;
  flex-direction: column;
}

.composition-panel,
.players-panel {
  min-height: 0;
  overflow-x: hidden;
  max-width: 100%;
}

.composition-panel {
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.players-panel {
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.composition-panel::-webkit-scrollbar,
.players-panel::-webkit-scrollbar {
  display: none;
}

.composition-panel::-webkit-scrollbar,
.players-panel::-webkit-scrollbar {
  display: none;
}

.composition-section + .composition-section {
  margin-top: 14px;
}

.composition-section.is-compact + .composition-section.is-compact {
  margin-top: 10px;
}

.composition-section-title {
  margin: 0 0 8px;
  color: #6e120f;
  font-weight: 700;
  font-size: 0.95rem;
}

.composition-panel-game-archive .composition-section-title {
  margin-bottom: 6px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.archive-role-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px 4px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.archive-role-fan {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-items: start;
  max-width: 100%;
  box-sizing: border-box;
}

.archive-role-card {
  position: relative;
  width: 100%;
  aspect-ratio: 46 / 64;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
  box-sizing: border-box;
}

.play-column-right .archive-role-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px 5px;
  padding: 4px 6px 0;
  width: 100%;
}

.play-column-right .archive-role-card {
  position: relative;
  width: 100%;
  aspect-ratio: 46 / 64;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transform: rotate(var(--archive-rotation, 0deg));
  transition: transform 0.14s ease, filter 0.14s ease;
  box-sizing: border-box;
}

.play-column-right .archive-role-card:hover,
.play-column-right .archive-role-card:focus-visible,
.play-column-right .archive-role-card.is-active {
  transform: rotate(var(--archive-rotation, 0deg)) translateY(-2px) scale(1.02);
}

.play-column-right .composition-section-title {
  overflow-wrap: anywhere;
}

.play-column-right .composition-panel {
  padding: 4px 6px 0;
  box-sizing: border-box;
}

.composition-panel-game-archive {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.composition-panel-game-archive .archive-role-grid-compact {
  gap: 4px 5px;
  align-items: center;
}

.composition-panel-game-archive .archive-role-card {
  width: 100%;
  height: auto;
  aspect-ratio: 46 / 64;
}

.composition-panel-game-archive .archive-role-card:hover,
.composition-panel-game-archive .archive-role-card:focus-visible,
.composition-panel-game-archive .archive-role-card.is-active {
  transform: rotate(var(--archive-rotation, 0deg)) translateY(-1px) scale(1.03);
}

.composition-panel-game-archive .archive-role-image-layer.is-back {
  transform: translate(2px, -1px) rotate(7deg);
}

.composition-panel-game-archive .archive-role-image-layer.is-front {
  transform: rotate(-6deg);
}

.composition-panel-game-archive .archive-role-count {
  top: -4px;
  right: -2px;
  width: 17px;
  height: 17px;
}

.composition-panel-game-archive .archive-role-count-value {
  font-size: 0.62rem;
}

.play-column-right .archive-role-image-layer.is-back {
  transform: translate(2px, -1px) rotate(6deg);
}

.play-column-right .archive-role-count {
  top: -2px;
  right: -1px;
  width: 16px;
  height: 16px;
}

.play-column-right .archive-role-count-value {
  font-size: 0.62rem;
}

.archive-role-card:hover,
.archive-role-card:focus-visible,
.archive-role-card.is-active {
  transform: rotate(var(--archive-rotation, 0deg)) translateY(-3px) scale(1.06);
  z-index: 2;
}

.archive-role-card:focus-visible {
  outline: 2px solid rgba(255, 240, 205, 0.72);
  outline-offset: 2px;
}

.archive-role-stack {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.archive-role-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.archive-role-image-layer {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 3px 4px rgba(43, 27, 18, 0.2));
}

.archive-role-image-layer.is-back {
  transform: translate(4px, -1px) rotate(8deg);
  opacity: 0.92;
}

.archive-role-image-layer.is-front {
  transform: rotate(-7deg);
}

.archive-role-card.is-dead .archive-role-image {
  filter: grayscale(1) brightness(0.92);
}

.archive-role-count {
  position: absolute;
  top: -6px;
  right: -3px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fffefc;
  color: #7c241b;
  border: 1px solid rgba(108, 80, 54, 0.8);
  transform: rotate(45deg);
}

.archive-role-count-value {
  transform: rotate(-45deg);
  font-size: 0.68rem;
  font-weight: 700;
}

.players-summary {
  display: block;
  margin-bottom: 12px;
  color: #f0d18a;
  font-family: "Acme", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.list-player-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 4px 10px;
  margin: 2px 0;
  background: transparent;
  box-shadow: none;
  border-radius: 4px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.list-player-row:hover {
  background: rgba(84, 54, 45, 0.82);
  box-shadow: 0 1px 4px rgba(32, 15, 12, 0.28);
}

.list-player-row + .list-player-row {
  border-top: none;
}

.list-player-row.is-dead {
  background: transparent;
  box-shadow: none;
  opacity: 0.6;
}

.list-player-row.is-dead:hover {
  background: rgba(68, 44, 37, 0.66);
}

.list-player-row.is-dead .list-player-name {
  color: rgba(255, 241, 223, 0.4);
  text-decoration: line-through;
}

.list-player-row.is-vote-target .list-player-name {
  color: #ffd37d;
}

.list-player-row.is-offline .list-player-name {
  opacity: 0.66;
}

.player-list-left {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 54px;
  min-width: 54px;
}

.btn-suspect-icon,
.player-role-card-static {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.btn-suspect-icon {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.btn-suspect-icon:hover .mini-suspec-card,
.btn-suspect-icon:focus-visible .mini-suspec-card {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.mini-suspec-card {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.player-vote-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff4e8;
  font-size: 0.72rem;
  font-weight: 700;
}

.player-vote-badge.is-clickable {
  cursor: pointer;
}

.player-vote-badge.is-clickable:hover,
.player-vote-badge.is-clickable:focus-visible {
  transform: translateY(-1px) scale(1.06);
  border-color: rgba(255, 243, 221, 0.34);
}

.player-vote-badge.has-votes,
.player-vote-badge.is-selected {
  background: #7a2117;
}

.list-player-body {
  min-width: 0;
  padding: 4px 8px;
  border-radius: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.list-player-row:hover .list-player-body {
  background: rgba(84, 54, 45, 0.82);
}

.list-player-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.list-player-name {
  min-width: 0;
  color: #fff6eb;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.list-player-name:hover {
  text-decoration: underline;
}

.list-player-role-reveal {
  font: 600 0.72rem/1.2 var(--hybrid-font-ui, sans-serif);
  color: rgba(255, 220, 160, 0.85);
  letter-spacing: 0.03em;
  margin-top: 1px;
}

.list-player-row.is-dead .list-player-role-reveal {
  color: rgba(255, 220, 160, 0.45);
}

.list-player-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-left: 2px;
}

.list-player-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  font-size: 0.9rem;
  line-height: 1;
  text-shadow: none;
  box-shadow: none;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* Badge tones are now purely emoji-based — no background/border needed */

.vote-finger {
  color: #f3ca63;
  font-size: 0.92rem;
  white-space: nowrap;
}

.list-player-mark {
  color: #e7c46a;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.btn-kick-player {
  margin-left: auto;
  padding: 0 6px;
  background: none;
  border: none;
  color: var(--hybrid-danger, #ff5e5e);
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.55;
  line-height: 1;
}
.btn-kick-player:hover {
  opacity: 1;
}

.spectator-row {
  color: rgba(255, 241, 223, 0.75);
  font-size: 0.88rem;
}

.game-role-detail-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(400px, calc(100% - 20px));
  padding: 1px 0 0;
  background:
    linear-gradient(180deg, rgba(61, 37, 31, 0.92), rgba(41, 23, 19, 0.95)),
    url("img/textures/background-role.png") top center / 100% no-repeat;
  color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
  z-index: 12;
  overflow: visible;
}

.game-role-detail-panel.is-opening {
  animation: role-detail-sheet-rise 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-role-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 20px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  opacity: 0.5;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
  z-index: 1;
}

.game-role-detail-close:hover {
  opacity: 1;
}

.game-role-detail-card-frame {
  position: absolute;
  top: -118px;
  left: 50%;
  width: min(250px, 70vw);
  box-sizing: border-box;
  padding: 6px;
  border-radius: 18px;
  border: 2px solid transparent;
  background:
    var(--card-premium-surface) padding-box,
    var(--card-premium-ornaments),
    linear-gradient(145deg, #71503a 0%, #19120d 55%, rgba(255, 255, 255, 0.88) 100%) border-box;
  transform: translate(-50%, 0) scale(0.46);
  box-shadow:
    inset 0 0 0 1px var(--card-frame-highlight),
    0 0 0 1px var(--card-frame-bronze),
    0 0 0 4px rgba(255, 255, 255, 0.66),
    0 16px 28px rgba(0, 0, 0, 0.32),
    0 0 20px rgba(255, 255, 255, 0.18);
  filter: saturate(1.05) contrast(1.03);
  transition:
    transform 1s cubic-bezier(0.8, 0, 0, 1),
    box-shadow 0.24s ease,
    filter 0.24s ease;
}

.game-role-detail-panel.is-opening .game-role-detail-card-frame {
  animation: role-detail-card-rise 0.5s cubic-bezier(0.18, 0.9, 0.32, 1.08);
}

.game-role-detail-card-frame:hover {
  transform: translate(-50%, -30%) scale(1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 0 1px var(--card-frame-bronze),
    0 0 0 2px rgba(255, 255, 255, 0.4),
    0 24px 34px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(255, 255, 255, 0.24);
  filter: saturate(1.12) contrast(1.05);
}

@keyframes role-detail-sheet-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 42px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes role-detail-card-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 40px) scale(0.38);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -5px) scale(0.485);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.46);
  }
}

.game-role-detail-card {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  object-fit: cover;
  border-radius: 12px;
}

.game-role-detail-title {
  margin: 114px 0 1em;
  text-align: center;
  font-family: "Acme", sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.game-role-detail-text {
  background-color: rgba(18, 9, 7, 0.58);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.legacy-modal-root {
  position: absolute;
  inset: 0;
  z-index: 40;
}

.legacy-modal-root.hidden {
  display: none;
}

.legacy-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.54);
}

.legacy-modal-card {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 36px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(92, 31, 26, 0.98), rgba(77, 24, 21, 0.99)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 45%);
  color: #fff3e5;
  border: 2px solid rgba(244, 226, 189, 0.38);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.42);
}

.legacy-modal-card.hidden {
  display: none;
}

.legacy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legacy-modal-header h2 {
  margin: 0;
  color: #fff8ef;
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.legacy-modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff3e5;
  font-size: 1.2rem;
  cursor: pointer;
}

.legacy-modal-body {
  padding: 16px;
}

.legacy-modal-body p {
  margin-top: 0;
  line-height: 1.45;
}

.legacy-settings-preferences {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.legacy-toggle,
.legacy-select-field,
.legacy-range-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legacy-audio-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legacy-audio-volume-row .legacy-audio-mute-btn {
  flex-shrink: 0;
  width: 28px;
  min-height: unset;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.legacy-audio-volume-row .legacy-audio-mute-btn:hover,
.legacy-audio-volume-row .legacy-audio-mute-btn:focus-visible {
  background: transparent;
  border-color: transparent;
  transform: none;
}

.legacy-audio-volume-row .legacy-range-field {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  border: none;
}

.legacy-audio-mute-btn {
  width: 46px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  color: #f0d18a;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.legacy-audio-mute-btn:hover,
.legacy-audio-mute-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(240, 209, 138, 0.38);
  color: #fff1c6;
  transform: translateY(-1px);
}

.legacy-audio-mute-btn.is-muted {
  background: rgba(180, 73, 64, 0.16);
  border-color: rgba(214, 110, 100, 0.42);
  color: #f29488;
}

.legacy-audio-mute-btn.is-muted:hover,
.legacy-audio-mute-btn.is-muted:focus-visible {
  background: rgba(180, 73, 64, 0.22);
  border-color: rgba(242, 148, 136, 0.56);
  color: #ffd1c8;
}

.legacy-audio-mute-icon {
  width: 20px;
  height: 20px;
}

.legacy-audio-mute-slash {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.legacy-audio-mute-btn.is-muted .legacy-audio-mute-slash {
  opacity: 1;
}

.legacy-toggle input {
  width: 18px;
  height: 18px;
}

.legacy-range-field strong {
  font-size: 0.88rem;
  color: #f0d18a;
}

.legacy-range-field input[type="range"] {
  width: 100%;
}

.settings-replay-section {
  grid-column: 1 / -1;
}

.settings-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 4px 0 12px;
}

.settings-replay-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.settings-replay-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-group {
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-group-conseil {
  border: 0;
  border-left: 3px solid var(--hybrid-gold);
  background: linear-gradient(135deg, rgba(201, 164, 106, 0.12) 0%, rgba(201, 164, 106, 0.04) 100%);
  border-radius: var(--hybrid-radius-md);
  padding: 14px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-group-conseil h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--hybrid-gold);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.settings-group-conseil h3::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>') no-repeat center/contain;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>') no-repeat center/contain;
}

.settings-group h3 {
  margin: 0 0 10px;
  color: #ffffff;
  font-family: var(--hybrid-font-ui, "Montserrat", sans-serif);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.settings-conseil-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--hybrid-ink, #e0dde8);
  line-height: 1.5;
}

.settings-conseil-text kbd {
  display: inline-block;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hybrid-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--hybrid-radius-sm);
  color: var(--hybrid-gold-soft);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  transform: translateY(-1px);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.start-blocker {
  margin: 16px 0 0;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff3e5;
  font-weight: 700;
  position: relative;
}

.start-blocker[data-tooltip] {
  cursor: help;
}

.legacy-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legacy-modal-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legacy-modal-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legacy-modal-kv strong {
  color: #f0d18a;
  font-size: 0.84rem;
}

.legacy-modal-kv span {
  color: #fff3e5;
  font-size: 0.84rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.legacy-modal-item-transfer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legacy-modal-item-transfer .legacy-action-btn {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.78rem;
}

.legacy-modal-note {
  margin-top: 14px;
  color: rgba(255, 243, 229, 0.72);
}

.legacy-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.legacy-modal-composition {
  min-height: 180px;
}

.guide-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.guide-chat-header span {
  font-weight: 600;
  color: #f0d18a;
}

.guide-chat-messages {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}

.guide-chat-msg {
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.guide-chat-msg strong {
  color: #f0d18a;
}

.guide-chat-input-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.guide-chat-input-row .chat-input {
  flex: 1;
  min-width: 0;
}

.legacy-composition-editor {
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff3e5;
}

.legacy-composition-editor-toolbar {
  display: flex;
  gap: 8px;
}

.legacy-composition-balance {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 0;
}

.legacy-composition-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legacy-composition-balance-title {
  color: #fff8ed;
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.legacy-composition-balance-status {
  color: rgba(255, 248, 237, 0.9);
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
}

.legacy-composition-balance[data-tone="balanced"] .legacy-composition-balance-status {
  color: #81c784;
}

.legacy-composition-balance[data-tone="village"] .legacy-composition-balance-status {
  color: #64b5f6;
}

.legacy-composition-balance[data-tone="wolves"] .legacy-composition-balance-status {
  color: #ffb74d;
}

.legacy-composition-balance[data-tone="swing"] .legacy-composition-balance-status {
  color: #ffd58c;
}

.legacy-composition-balance[data-tone="invalid"] .legacy-composition-balance-status {
  color: #e57373;
}

.legacy-composition-balance-track {
  position: relative;
  height: 26px;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(
      90deg,
      #2462ad 0%,
      #2c72c6 46%,
      #6b3c50 50%,
      #8f2b2d 54%,
      #b92d2d 100%
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 10px 22px rgba(0, 0, 0, 0.18);
}

.legacy-composition-balance-center {
  position: absolute;
  left: 50%;
  top: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid rgba(20, 16, 18, 0.82);
}

.legacy-composition-balance-thumb {
  position: absolute;
  left: var(--balance-position, 50%);
  top: 50%;
  width: 20px;
  height: 34px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffffff 0%, #f2ece5 100%);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(71, 49, 44, 0.12);
}

.legacy-composition-balance-caption {
  margin: 0;
  color: rgba(255, 243, 229, 0.74);
  font-size: 0.75rem;
  line-height: 1.35;
}

.legacy-composition-editor-intro {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legacy-composition-editor-title {
  margin: 0 0 6px;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legacy-composition-editor-note {
  margin: 0;
  color: rgba(255, 243, 229, 0.82);
  font-size: 0.92rem;
}

.legacy-composition-editor-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legacy-composition-editor-heading {
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff8ed;
  font-family: "Montserrat", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legacy-composition-editor-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px 6px;
}

.legacy-composition-editor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px;
  position: relative;
  transition: transform 0.2s ease;
}

.legacy-composition-editor-avatar {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  /* Couleur par camp — valeurs par défaut (village) */
  --team-color: #2a67b4;
  --team-glow: rgba(42, 103, 180, 0.45);
  --team-bg: rgba(42, 103, 180, 0.18);
}

/* Loups — rouge */
.legacy-composition-editor-avatar.role-team-wolves {
  --team-color: #b71c1c;
  --team-glow: rgba(183, 28, 28, 0.45);
  --team-bg: rgba(139, 34, 48, 0.22);
  background: var(--team-bg);
}

/* Village — bleu */
.legacy-composition-editor-avatar.role-team-village {
  --team-color: #2a67b4;
  --team-glow: rgba(42, 103, 180, 0.45);
  --team-bg: rgba(42, 103, 180, 0.18);
  background: var(--team-bg);
}

/* Solo / gagnent seuls — gris */
.legacy-composition-editor-avatar.role-team-solo {
  --team-color: #7a7a8a;
  --team-glow: rgba(120, 120, 140, 0.45);
  --team-bg: rgba(100, 100, 120, 0.18);
  background: var(--team-bg);
}


/* Loup-garou blanc : gagne seul → aura grise */
.legacy-composition-editor-avatar.role-key-whiteWerewolf {
  --team-color: #7a7a8a;
  --team-glow: rgba(120, 120, 140, 0.45);
  --team-bg: rgba(100, 100, 120, 0.18);
  background: var(--team-bg);
}

/* Chien-loup : aura rouge en éditeur de composition */
.legacy-composition-editor-avatar.role-key-wolfDog {
  --team-color: #b71c1c;
  --team-glow: rgba(183, 28, 28, 0.45);
  --team-bg: rgba(139, 34, 48, 0.22);
  background: var(--team-bg);
}

/* Joueur de flûte : aura grise en éditeur de composition */
.legacy-composition-editor-avatar.role-key-flutePlayer {
  --team-color: #7a7a8a;
  --team-glow: rgba(120, 120, 140, 0.45);
  --team-bg: rgba(100, 100, 120, 0.18);
  background: var(--team-bg);
}

/* Aura active : couleur selon le camp */
.legacy-composition-editor-card.is-active .legacy-composition-editor-avatar {
  outline: 2px solid var(--team-color);
  outline-offset: -2px;
  box-shadow: 0 0 14px var(--team-glow);
}

.legacy-composition-editor-image {
  width: 58px;
  height: 58px;
  object-fit: cover;
  z-index: 1;
}

.legacy-composition-editor-count {
  position: absolute;
  left: 2px;
  top: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--team-color, #2a67b4);
  color: #fff;
  font-family: "Montserrat", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.legacy-composition-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 900;
  z-index: 5;
  color: #fff;
}

.legacy-composition-badge.is-bavarde,
.archive-role-badge-bavarde {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: #fff;
  color: #b71c1c; 
  font-family: inherit;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(15deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 1px solid rgba(0,0,0,0.1);
  z-index: 25;
  pointer-events: none;
  border-radius: 1px;
}




.legacy-composition-editor-label {
  text-align: center;
  color: #fff8ed;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.1;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-composition-editor-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(183, 28, 28, 0.9);
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 2px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.legacy-composition-editor-card:hover .legacy-composition-editor-controls,
.legacy-composition-editor-card.is-active:hover .legacy-composition-editor-controls {
  opacity: 1;
}

.legacy-composition-editor-btn {
  width: 24px;
  height: 20px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.legacy-composition-editor-btn:hover {
  background: rgba(255,255,255,0.2);
}

.legacy-composition-editor-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.legacy-composition-editor-btn:hover,
.legacy-composition-editor-btn:focus-visible {
  background: #7569f3;
}

.legacy-composition-editor-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.legacy-notes-grid {
  justify-content: center;
}

.lgel-tooltip {
  position: fixed;
  z-index: 60;
  max-width: 280px;
  padding: 10px 12px;
  background: #1b2b4b;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.35;
  box-shadow: 0 10px 22px rgba(13, 20, 34, 0.34);
  pointer-events: none;
  opacity: 0;
}

.lgel-tooltip strong {
  font-weight: 700;
  color: #fff;
}

.lgel-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #1b2b4b;
  transform: translateX(-50%) rotate(45deg);
}

.muted {
  color: #77808a;
  font-style: italic;
}

.game-build-bar {
  position: absolute;
  right: 8px;
  bottom: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

@keyframes legacy-clouds {
  from {
    background-position-x: 0;
  }
  to {
    background-position-x: -1677px;
  }
}

@media (max-width: 1365px) {
  body.mode-lobby,
  body.mode-game {
    overflow: auto;
  }

  .play-grid {
    height: auto;
    height: 100%;
    grid-template-columns: 290px minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1180px) {
  .play-topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .play-stage {
    overflow: visible;
  }

  .play-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .history-sidebar {
    position: fixed;
    top: 41px;
  }

  body.history-open .play-grid {
    margin-left: 0;
  }

  .legacy-settings-preferences,
  .settings-grid,
  .legacy-chat-form {
    grid-template-columns: 1fr;
  }

  .game-role-detail-panel {
    position: static;
    transform: none;
    width: auto;
    margin: 110px 10px 0;
  }
}
/* --- Premium Configuration Flags --- */
.legacy-flags-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 4px 0;
  padding: 4px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.flag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.flag-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.flag-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flag-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}

.flag-sub-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #f7d58c;
  letter-spacing: 0.03em;
}

.flag-sub:has(input:disabled) {
  opacity: 0.3;
  pointer-events: none;
}

.flag-info {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff1df;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.flag-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  color: #f7d58c;
}

/* Premium Switch */
.premium-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
}

.premium-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.3);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: #d1d5db;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input:checked + .switch-slider {
  background-color: #9e1d1a;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
}

input:checked + .switch-slider:before {
  transform: translateX(16px);
  background-color: #fff9ef;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.premium-switch:hover .switch-slider {
  border-color: rgba(255, 255, 255, 0.3);
}

body.mode-game .legacy-flags-grid {
  display: none !important;
}

/* --- New Role Card Styling --- */
.legacy-action-card {
  background:
    linear-gradient(rgba(138, 42, 42, 0.94), rgba(90, 26, 26, 0.98)),
    url('img/textures/background-role.png');
  background-size: cover;
  border: 1px solid rgba(0,0,0,0.4);
  padding: clamp(18px, 3vw, 30px) clamp(10px, 2vw, 15px) clamp(10px, 2vw, 15px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  position: relative;
  overflow: visible;
  margin: 0 0 10px;
  width: 100%;
  min-height: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.legacy-action-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-height: 0;
}

.legacy-action-form {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.play-column-left::-webkit-scrollbar,
.play-column-right::-webkit-scrollbar,
.chat-tabs::-webkit-scrollbar,
.legacy-action-form::-webkit-scrollbar {
  display: none;
}

.legacy-inline-action-btn {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 10px;
}

.legacy-action-role-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding-top: 92px;
  width: 100%;
}

.legacy-action-icon-wrapper {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 127px;
  height: 120px;
  box-sizing: border-box;
  padding: 4px;
  border: 2px solid transparent;
  box-shadow: 
    inset 0 0 0 1px var(--card-frame-highlight),
    0 0 0 1px var(--card-frame-bronze),
    0 0 0 3px rgba(255, 255, 255, 0.1),
    0 8px 20px var(--card-frame-shadow),
    0 0 12px var(--card-frame-glow);
  background:
    var(--card-premium-surface) padding-box,
    var(--card-premium-ornaments),
    linear-gradient(145deg, #71503a 0%, #19120d 55%, rgba(255, 255, 255, 0.88) 100%) border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10;
  border-radius: 8px;
}

.legacy-action-role-card {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0 !important; /* Override legacy margin */
}

.role-intro {
  margin: 0;
  font-size: 0.82rem;
  color: #f0f0f0;
  font-family: 'Source Sans Pro', sans-serif;
  text-align: center;
  width: 100%;
}

.role-name {
  font-weight: bold;
  font-size: 1.05rem;
  color: #ffffff;
  font-family: 'Acme', sans-serif;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
}

.role-objective {
  margin: 1px auto 0;
  font-size: 0.82rem;
  color: #fff;
  font-family: 'Source Sans Pro', sans-serif;
  opacity: 0.95;
  text-align: center;
  max-width: 280px;
  min-height: 2.4em;
}

.legacy-action-role-copy.is-typewriting-label .role-name::after,
.legacy-action-role-copy.is-typewriting-description .role-objective::after {
  content: "|";
  display: inline-block;
  margin-left: 2px;
  color: #f2d38c;
  animation: role-copy-caret 0.85s steps(1, end) infinite;
}

@keyframes role-copy-caret {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

/* Enhanced Ribbon */
.legacy-ribbon {
  width: 218px;
  height: 58px;
  margin: 15px auto 10px;
  padding: 0 24px;
  background: url("img/textures/background-chrono.png") no-repeat center / 100% 100%;
  background-position: center -5px;
  box-shadow: none;
  color: #5e1717 !important;
  font-family: 'Acme', sans-serif;
  font-size: 1.15rem;
  text-transform: uppercase;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.25));
}

.legacy-action-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  padding-top: 10px;
}

#action-submit-button {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #b32a26, #8c1e1a);
  border: 1px solid rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 0 #5e1411, 0 6px 15px rgba(0,0,0,0.4);
  color: #fff !important;
  padding: 9px 10px;
  font-family: 'Acme', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.1s ease;
}

#action-submit-button:hover {
  transform: translateY(1px);
  box-shadow: 0 3px 0 #5e1411, 0 4px 10px rgba(0,0,0,0.4);
}

#action-submit-button:active {
  transform: translateY(4px);
  box-shadow: none;
}

#btn-copy-invite-game {
  opacity: 0.6;
  font-size: 0.8rem;
}

.legacy-ribbon::before, .legacy-ribbon::after {
  display: none !important;
}

.legacy-action-status-area {
  margin: 10px 0;
  color: #fff6ed;
  font-size: 0.95rem;
  text-align: center;
}

/* Status Area */
.legacy-action-status-area {
  margin-top: 4px;
  text-align: center;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legacy-composition-badge.is-bavarde.is-voyante-bavarde,
.archive-role-badge-bavarde.is-voyante-bavarde {
  color: #db4d96;
}

.legacy-composition-badge.is-bavarde.is-chasseur-bavard,
.archive-role-badge-bavarde.is-chasseur-bavard {
  color: #2f9d58;
}

.legacy-action-message {
  font-size: clamp(0.78rem, 1.2vw, 0.9rem);
  color: #ffffff;
  line-height: 1.35;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  word-break: break-word;
}

.action-separator {
  height: 0;
  border: none;
  border-top: 1px solid rgba(255, 242, 225, 0.15);
  margin: 8px 0;
}

.action-guide-text {
  margin: 0;
  color: rgba(255, 242, 225, 0.82);
  font-size: 0.74rem;
  font-style: italic;
  text-align: center;
  line-height: 1.25;
}

.chat-role-icon-inline {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  border-radius: 2px;
}

/* Archive fidelity refresh */
.play-topbar {
  grid-template-columns: 276px 140px minmax(0, 1fr) auto;
  min-height: 40px;
  background:
    linear-gradient(180deg, rgba(132, 91, 76, 0.96), rgba(103, 69, 57, 0.99)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 55%);
  border-bottom: 1px solid rgba(35, 20, 14, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  color: #f7efe2;
  font-family: "Source Sans Pro", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.topbar-block {
  min-height: 40px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(0, 0, 0, 0.34);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-block-room {
  gap: 10px;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
}

.topbar-block-room strong {
  max-width: 100%;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
}

.topbar-room-count {
  color: rgba(255, 243, 221, 0.76);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}

.topbar-block-btn {
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.14);
}

.topbar-block-btn:hover,
.topbar-block-btn:focus-visible {
  background: rgba(255, 255, 255, 0.17);
  color: #ffffff;
}

.topbar-block-btn.is-disabled,
.topbar-block-btn[aria-disabled="true"] {
  color: rgba(247, 239, 226, 0.54);
  background: rgba(255, 255, 255, 0.08);
}

.topbar-block-btn.is-disabled:hover,
.topbar-block-btn.is-disabled:focus-visible,
.topbar-block-btn[aria-disabled="true"]:hover,
.topbar-block-btn[aria-disabled="true"]:focus-visible {
  color: rgba(247, 239, 226, 0.54);
  background: rgba(255, 255, 255, 0.08);
}

.toggle-icon {
  font-size: 0.56rem;
  opacity: 0.8;
  transform: scaleX(1.4);
}

.topbar-block-icons {
  background: transparent;
}

.topbar-icon-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.16);
  background-size: 22px 22px;
}

.topbar-icon-btn:hover,
.topbar-icon-btn:focus-visible {
  background-color: rgba(255, 255, 255, 0.2);
}

.topbar-icon-btn.is-disabled,
.topbar-icon-btn[aria-disabled="true"] {
  background-color: rgba(255, 255, 255, 0.08);
}

.topbar-icon-btn.is-disabled:hover,
.topbar-icon-btn.is-disabled:focus-visible,
.topbar-icon-btn[aria-disabled="true"]:hover,
.topbar-icon-btn[aria-disabled="true"]:focus-visible {
  background-color: rgba(255, 255, 255, 0.08);
}

.play-stage {
  height: calc(100vh - 40px);
  min-height: calc(100vh - 40px);  transition: background 1.5s ease-in-out;
}

.play-stage::before {
  top: -88px;
  height: 310px;
  opacity: 0.5;
  animation-duration: 86s;
}

.play-stage::after {
  top: -4px;
  bottom: -2px;
  height: auto;
  background-position: center bottom;
  background-size: cover;
}

.history-sidebar {
  width: 250px;
  background: linear-gradient(180deg, rgba(83, 58, 49, 0.99), rgba(63, 41, 34, 0.99));
  border-right: 1px solid rgba(27, 15, 11, 0.68);
  box-shadow: 11px 0 24px rgba(0, 0, 0, 0.36);
}

body.history-open .play-grid {
  margin-left: 250px;
}

.history-header {
  min-height: 50px;
  grid-template-columns: 34px 1fr 34px;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.14);
}

.history-day-tag {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-family: 'Acme', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-arrow {
  width: 38px;
  height: 38px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.4);
  font-family: monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.history-arrow:hover {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.history-arrow {
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.history-content {
  padding: 10px 12px 18px;
}

.history-entry {
  margin-bottom: 24px;
}

.history-time-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: 'Source Sans 3', sans-serif;
  font-style: italic;
  font-weight: 600;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.history-time-divider::before,
.history-time-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.history-text {
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.history-text b,
.history-text strong {
  font-weight: 700;
  color: #fff;
}

.history-detail-line {
  margin-top: 2px;
}

.history-mini-role {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-left: 4px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.history-hacked-badge {
  filter: drop-shadow(0 0 3px rgba(0, 255, 136, 0.6));
}

.history-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  opacity: 0.5;
}

.history-empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  color: #dfc49d;
}

.history-empty-state p {
  font-size: 0.85rem;
  color: #ffffff;
  font-style: italic;
}

.play-grid {
  grid-template-columns: 276px minmax(0, 1fr) 308px;
  gap: 10px;
  padding: 8px 8px 0;
}

.play-column {
  gap: 8px;
}

.play-column-left,
.play-column-right {
  padding-bottom: 8px;
}

.legacy-panel {
  border: 1.5px solid rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.legacy-panel-burgundy {
  background:
    linear-gradient(180deg, rgba(113, 24, 25, 0.96), rgba(88, 21, 20, 0.98)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 48%);
  color: #fff0e2;
}

.list-player-name:hover {
  text-decoration: underline;
}

.legacy-panel-parchment {
  border: 1.5px solid rgba(75, 40, 30, 0.5) !important;
  background:
    linear-gradient(180deg, rgba(228, 201, 142, 0.97), rgba(213, 178, 102, 0.99)),
    url("img/textures/background-compo.png") center center / cover no-repeat;
}

.legacy-panel-players {
  background:
    linear-gradient(180deg, rgba(120, 82, 67, 0.97), rgba(102, 66, 54, 0.99)),
    url("img/textures/background-players.png") center center / 92% no-repeat;
}

.legacy-panel-header {
  padding: 6px 10px 5px;
  background: linear-gradient(180deg, rgba(36, 19, 13, 0.24), rgba(14, 8, 6, 0.08));
}

.legacy-panel-header h3 {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
}

.legacy-panel-body {
  padding: 8px 10px;
}

.legacy-panel-salon .legacy-panel-body {
  padding-bottom: 10px;
}

.legacy-sidebar-tools {
  gap: 4px;
  margin-bottom: 10px;
}

.legacy-bot-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.legacy-pill-btn,
.legacy-action-btn,
.legacy-ghost-btn,
.legacy-submit-btn,
.legacy-launch-btn {
  min-height: clamp(27px, 3.5vh, 38px);
  padding: clamp(5px, 0.8vh, 8px) clamp(8px, 1.2vw, 14px);
  font-size: clamp(0.72rem, 1.1vw, 0.82rem);
  letter-spacing: 0.02em;
}

.legacy-action-btn,
.legacy-ghost-btn {
  text-align: left;
}

.legacy-adjust-btn {
  width: 26px;
  height: 24px;
}

.legacy-adjust-pair {
  gap: 4px;
}

.legacy-advanced-options {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.legacy-advanced-options.is-disabled-host {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.legacy-advanced-summary {
  list-style: none;
  cursor: pointer;
  color: #f0d18a;
  font-family: "Acme", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.legacy-advanced-summary::-webkit-details-marker {
  display: none;
}

.legacy-advanced-summary::after {
  content: "+";
  float: right;
  color: rgba(255, 255, 255, 0.82);
}

.legacy-advanced-options[open] .legacy-advanced-summary::after {
  content: "-";
}

.legacy-flags-grid {
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.flag-item {
  padding: 5px 7px;
}

.flag-info {
  font-size: 0.75rem;
}

.legacy-start-strip {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.legacy-launch-btn {
  min-height: 35px;
  text-align: center;
  font-size: 1.12rem;
}

.legacy-launch-btn-wide {
  width: 100%;
}

.legacy-action-footer .legacy-ghost-btn {
  width: 100%;
}

.legacy-center-board {
  background: linear-gradient(180deg, rgba(244, 244, 240, 0.99), rgba(232, 232, 227, 0.98));
  border: 1px solid rgba(117, 101, 88, 0.42);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.legacy-rules-block {
  padding: 12px 16px 10px;
  color: #4b5964;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(240, 240, 236, 0.78));
}

.legacy-rules-kicker {
  color: #66778a;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legacy-rules-block ul {
  margin: 4px 0 0;
}

.legacy-channel-note {
  padding: 6px 16px 0;
  color: #7b6555;
  font-size: 0.78rem;
}

.legacy-channel-note.is-faded {
  opacity: 0;
  max-height: 0;
}

.winner-banner {
  margin: 10px 16px 0;
  padding: 8px 10px;
  font-size: 1.08rem;
}

.chat-toolbar {
  padding: 6px 16px 4px;
}

.chat-messages {
  margin: 0 12px;
  padding: 10px 8px 12px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.chat-message-system {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
}

.chat-system-text {
  font-size: 0.87rem;
  color: #5f6870;
  line-height: 1.38;
}

.chat-message-banner {
  padding: 7px 10px;
  border-radius: 0;
  box-shadow: none;
}

.chat-message-user .chat-meta strong {
  color: #3d4b58;
}

.legacy-chat-form {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 5px;
  padding: 5px 8px 6px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.legacy-chat-input {
  min-height: 28px;
}

.legacy-chat-icon-btn {
  width: 28px;
  height: 28px;
  color: #ffe6bf;
}

.legacy-chat-send {
  min-width: 72px;
  height: 28px;
  font-size: 0.82rem;
}

.chat-bottom-actions {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  background: rgba(94, 63, 52, 0.99);
}

.chat-bottom-actions .legacy-ghost-btn {
  width: 100%;
}

.list-player-row {
  grid-template-columns: 46px minmax(0, 1fr) 16px;
  gap: 8px;
  min-height: 34px;
  padding: 3px 4px;
  margin: 0;
  background: transparent;
  border-bottom: 1px solid transparent;
  border-radius: 0;
}

.list-player-row:hover {
  background: rgba(84, 54, 45, 0.82);
  box-shadow: none;
}

.list-player-row.is-dead {
  background: transparent;
  opacity: 0.78;
}

.list-player-row.is-host .list-player-name {
  color: #ffe3a0;
}

.player-list-left {
  gap: 6px;
  width: 54px;
  min-width: 54px;
}

.btn-suspect-icon,
.player-role-card-static {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.mini-suspec-card {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.mini-suspec-card-hacked {
  filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.6)) saturate(0.3) brightness(0.8);
  border: 1px solid rgba(0, 255, 136, 0.4);
  border-radius: 4px;
}

.player-vote-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 0.72rem;
}

.list-player-name {
  font-size: 0.88rem;
}

.list-player-badges {
  gap: 5px;
}

.list-player-badge {
  font-size: 0.78rem;
}

.list-player-body {
  padding: 3px 8px;
  background: transparent;
}

.list-player-row:hover .list-player-body {
  background: rgba(84, 54, 45, 0.82);
}



.list-player-mark {
  font-size: 0.67rem;
}

.spectator-row {
  padding: 2px 0;
  font-size: 0.82rem;
}

@media (max-width: 1365px) {
  .play-grid {
    grid-template-columns: 230px minmax(0, 1fr) 292px;
  }

  .play-topbar {
    grid-template-columns: 230px 140px minmax(0, 1fr) auto;
  }
}

@media (max-width: 1180px) {
  .topbar-room-count {
    display: none;
  }

  .legacy-panel-salon,
  .legacy-panel-salon-config { margin-bottom: 10px; 
    display: block;
  }
}


/* Image-fidelity Lounge Config Layout */
.legacy-config-main-area {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.08);
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.legacy-config-values {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legacy-config-label {
  background: #a12423;
  color: #fff;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: "Acme", sans-serif;
  text-align: center;
  border: 4px solid #7d1c1a;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legacy-config-toggles-top {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.legacy-config-controls {
  flex: 0 0 92px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.legacy-config-crest-small {
  width: 58px;
  height: 70px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px;
  margin-bottom: 2px;
}

.legacy-config-crest-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.legacy-adjust-row {
  display: flex;
  gap: 4px;
  width: 100%;
}

.legacy-adjust-square-btn {
  flex: 1;
  height: 28px;
  background: #a12423;
  border: 3px solid #7d1c1a;
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legacy-adjust-square-btn:hover {
  background: #c32b2b;
}

.legacy-mini-square-btn {
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legacy-mini-square-btn svg {
  width: 18px;
  height: 18px;
}

.legacy-config-toggles-bottom {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* Proportion alignment with LGE archive */
.play-grid {
  width: min(1416px, calc(100% - 24px));
  margin: 8px auto 0;
  padding: 0;
  gap: 12px;
  grid-template-columns:
    clamp(320px, 24vw, 348px)
    minmax(0, 1fr)
    clamp(320px, 24vw, 344px);
}

body.history-open .play-grid {
  width: min(1416px, calc(100% - 284px));
  margin-left: 260px;
  margin-right: 12px;
}

body.mode-lobby .play-column-left {
  align-self: start;
}

body.mode-lobby .play-column-right,
body.mode-game .play-column-right {
  display: block !important;
  overflow-y: auto !important;
  scrollbar-width: none;
  height: 100% !important;
  box-sizing: border-box;
  padding-bottom: 20px;
}

.legacy-panel-parchment,
.legacy-panel-players-main {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  position: relative !important;
  margin-bottom: 12px !important;
  float: none !important;
  clear: both !important;
}

.spectators-inline {
  margin-top: 4px;
}

.spectators-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
}

.spectators-separator::before,
.spectators-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 241, 223, 0.25);
}

.spectators-separator-label {
  color: rgba(255, 241, 223, 0.6);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.spectators-inline-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legacy-panel-header,
.legacy-panel-body {
  display: block !important;
  height: auto !important;
}

.composition-panel,
.players-panel {
  display: block !important;
  height: auto !important;
  overflow: visible !important;
}

.legacy-panel-players-main .legacy-panel-body {
  box-sizing: border-box;
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
}

body.mode-lobby .legacy-panel-players-main .players-panel {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  overflow-y: visible;
}

body.mode-game .legacy-panel-players-main .players-panel {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  overflow-y: visible;
}

@media (max-width: 1560px) {
  .play-grid {
    width: calc(100% - 20px);
    grid-template-columns: 312px minmax(0, 1fr) 312px;
    gap: 10px;
  }

  body.history-open .play-grid {
    width: calc(100% - 280px);
  }
}

@media (max-width: 1365px) {
  .play-grid {
    width: calc(100% - 18px);
    grid-template-columns: 292px minmax(0, 1fr) 292px;
  }

  body.history-open .play-grid {
    width: calc(100% - 278px);
  }

}

/* Lobby Ready Button */
.legacy-ready-btn {
  width: 100%;
  height: 64px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #d32f2f, #b71c1c);
  color: #fff;
  font-family: "Acme", sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 4px 0 #7f0000,
    0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.1s ease;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
}

.legacy-ready-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.legacy-ready-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 
    0 1px 0 #7f0000,
    0 1px 4px rgba(0, 0, 0, 0.4);
}

.legacy-ready-btn.is-ready {
  background: linear-gradient(180deg, #388e3c, #1b5e20);
  box-shadow: 
    0 4px 0 #0d3b0d,
    0 4px 12px rgba(0, 0, 0, 0.4);
}

.legacy-ready-btn.is-ready:active {
  box-shadow: 
    0 1px 0 #0d3b0d,
    0 1px 4px rgba(0, 0, 0, 0.4);
}

.legacy-ready-btn.hidden {
  display: none !important;
}








/* Fluid transition helper */
.is-revealing-role .lobby-only {
  opacity: 0;
  pointer-events: none;
}
.is-revealing-role .game-only {
  display: block !important;
  opacity: 1;
}

.player-list-left.is-lobby-spacer {
  width: 54px; /* 24px icon + 24px badge + 6px gap */
  flex-shrink: 0;
}

/* Vote confirmation feedback */
.vote-confirmed {
  background-color: rgba(76, 175, 80, 0.2) !important;
  border-left: 3px solid #4caf50 !important;
}

.vote-confirmed .list-player-name {
  color: #4caf50 !important;
  font-weight: bold;
}

/* Urgent countdown */
.countdown-urgent {
  color: #ff5252 !important;
  text-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
  animation: blink-red 1s infinite;
}

@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

body.mode-lobby .list-player-row {
  grid-template-columns: 0 minmax(0, 1fr) 16px;
  gap: 4px;
  padding-left: 0;
}

body.mode-lobby .player-list-left.is-lobby-spacer {
  width: 0;
  overflow: hidden;
}

body.mode-lobby .list-player-body {
  padding-left: 0;
  padding-right: 4px;
}

/* Phase Overlay */
.phase-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.95) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  backdrop-filter: blur(4px);
}

.phase-overlay.is-visible {
  opacity: 1;
}

.phase-overlay.active {
  opacity: 1;
}

.phase-overlay.to-night,
.phase-overlay.is-night {
  color: #9db1ff;
  text-shadow: 0 0 20px rgba(100, 150, 255, 1);
}

.phase-overlay.to-day,
.phase-overlay.is-day {
  color: #ffde82;
  text-shadow: 0 0 20px rgba(255, 200, 50, 1);
}

.phase-icon {
  font-size: 8rem;
  margin-bottom: 20px;
  animation: phase-icon-float 2.2s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes phase-icon-float {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 10px currentColor); }
  50% { transform: scale(1.1) rotate(5deg); filter: drop-shadow(0 0 30px currentColor); }
}


/* =============================================
   ACTION MODE TABS (Angel sonder/châtier)
   ============================================= */

.role-action-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}

.action-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 242, 225, 0.75);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}

.action-tab-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.action-tab-btn.is-active {
  background: rgba(216, 188, 121, 0.18);
  border-color: #d8bc79;
  color: #f2d38c;
}

.action-tab-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.angel-tab-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.angel-tab-cost {
  font-size: 0.68rem;
  opacity: 0.75;
  font-style: italic;
}

.angel-tab-cost-feathers {
  color: #f2d38c;
  opacity: 0.9;
}

.angel-feather-count {
  font-style: normal !important;
  font-weight: 600;
  color: #f2d38c !important;
  opacity: 0.95;
}

/* Pyromane — onglet "Poser" actif en orange feu */
.pyro-mode-tabs .action-tab-btn.is-active {
  background: rgba(255, 152, 0, 0.15);
  border-color: #ff9800;
  color: #ff9800;
}

/* Pyromane — onglet "Déclencher" actif en rouge vif */
.pyro-mode-tabs .ignite-tab.is-active {
  background: rgba(255, 61, 0, 0.12);
  border-color: #ff3d00;
  color: #ff3d00;
}

/* Pyromane — bouton d'ignition flamboyant */
.pyro-ignite-btn {
  background: linear-gradient(135deg, #ff9800, #ff3d00) !important;
  box-shadow: 0 2px 20px rgba(255, 61, 0, 0.4) !important;
  position: relative;
  overflow: hidden;
}

.pyro-ignite-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.25) 0%, transparent 50%);
  animation: pyro-ember-flicker 1.8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes pyro-ember-flicker {
  0%   { opacity: 0.4; transform: scale(0.95); }
  100% { opacity: 1;   transform: scale(1.05); }
}

/* =============================================
   ACTION TARGET GRID — Wolfy-style click-to-target
   ============================================= */

.action-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
  gap: 6px;
  padding: 2px 0 0;
}

.action-target-card {
  display: grid;
  grid-template-columns: clamp(22px, 2.2em, 32px) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  min-width: 0;
}

.action-target-card:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.action-target-card.is-selected {
  background: rgba(216, 188, 121, 0.22);
  border-color: #d8bc79;
  box-shadow: 0 0 12px rgba(216, 188, 121, 0.3);
}

.action-target-card.is-selected .action-target-avatar {
  box-shadow: 0 0 0 2px #d8bc79;
}

.action-target-card:active:not(.is-selected) {
  transform: scale(0.95);
}

.action-target-avatar {
  width: clamp(22px, 2.2em, 32px);
  height: clamp(22px, 2.2em, 32px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  font-family: "Acme", sans-serif;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: box-shadow 0.18s ease;
  flex-shrink: 0;
}

.action-target-name {
  font-size: clamp(0.65rem, 1.1vw, 0.78rem);
  color: rgba(255, 246, 235, 0.88);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.15;
}

.action-target-card .action-target-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d8bc79;
  color: #2a1d17;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dual-select variant (cupid, flute, whiteRabbit) */
.action-target-card.is-first .action-target-avatar {
  box-shadow: 0 0 0 2px #e87fa0;
}
.action-target-card.is-first {
  border-color: #e87fa0;
  background: rgba(232, 127, 160, 0.15);
}
.action-target-card.is-second .action-target-avatar {
  box-shadow: 0 0 0 2px #7eb8e0;
}
.action-target-card.is-second {
  border-color: #7eb8e0;
  background: rgba(126, 184, 224, 0.15);
}

/* Witch potion UI */
.witch-potion-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

/* ── Witch sections (new design) ── */
.witch-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.witch-section-muted {
  opacity: 0.55;
}

.witch-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.witch-section-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1;
}

.witch-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff6eb;
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.witch-section-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.witch-badge-available {
  background: rgba(100, 200, 90, 0.18);
  color: #8de083;
  border: 1px solid rgba(100, 200, 90, 0.3);
}

.witch-badge-required {
  background: rgba(220, 80, 60, 0.2);
  color: #f0857a;
  border: 1px solid rgba(220, 80, 60, 0.35);
}

.witch-section-note {
  font-size: 0.75rem;
  color: rgba(255, 242, 225, 0.5);
  margin: 0;
}

.witch-note-required {
  color: #f0857a;
  font-weight: 600;
}

/* Victim card */
.witch-victim-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.witch-victim-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff6eb;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
}

.witch-victim-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.witch-victim-card.is-selected {
  border-color: #6fcf6a;
  background: rgba(100, 200, 90, 0.15);
}

.witch-victim-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.witch-victim-name {
  flex: 1;
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
}

.witch-victim-action {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 242, 225, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.15s;
}

.witch-victim-card.is-selected .witch-victim-action {
  color: #6fcf6a;
}

/* Legacy potion btn (kept for safety) */
.witch-status-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.witch-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.witch-status-available {
  color: #a8e6a0;
  background: rgba(100, 200, 90, 0.1);
  border-color: rgba(100, 200, 90, 0.2);
}

.witch-status-used {
  color: rgba(255, 242, 225, 0.35);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  text-decoration: line-through;
}

.witch-potion-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: clamp(6px, 0.8vh, 10px) clamp(8px, 1.2vw, 12px);
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #fff6eb;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  font-size: clamp(0.78rem, 1.2vw, 0.9rem);
  text-align: left;
  flex-wrap: wrap;
}

.witch-potion-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.witch-potion-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.witch-potion-btn.is-active {
  border-color: #d8bc79;
  background: rgba(216, 188, 121, 0.18);
}

.witch-potion-icon {
  width: clamp(18px, 2em, 24px);
  height: clamp(18px, 2em, 24px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.witch-potion-icon-heal {
  background: rgba(76, 175, 80, 0.25);
}

.witch-potion-icon-poison {
  background: rgba(198, 44, 39, 0.25);
}

.witch-potion-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.witch-potion-label strong {
  color: #fff;
  font-size: 0.82rem;
}

.witch-potion-label small {
  color: rgba(255,255,255,0.55);
  font-size: 0.7rem;
}

/* =============================================
   PLAYER AVATAR COLORS
   ============================================= */

.avatar-color-0 { background: linear-gradient(135deg, #c62c27, #8b1a15); }
.avatar-color-1 { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.avatar-color-2 { background: linear-gradient(135deg, #1565c0, #0d47a1); }
.avatar-color-3 { background: linear-gradient(135deg, #6a1b9a, #4a148c); }
.avatar-color-4 { background: linear-gradient(135deg, #e65100, #bf360c); }
.avatar-color-5 { background: linear-gradient(135deg, #00838f, #006064); }
.avatar-color-6 { background: linear-gradient(135deg, #ad1457, #880e4f); }
.avatar-color-7 { background: linear-gradient(135deg, #4e342e, #3e2723); }
.avatar-color-8 { background: linear-gradient(135deg, #283593, #1a237e); }
.avatar-color-9 { background: linear-gradient(135deg, #558b2f, #33691e); }
.avatar-color-10 { background: linear-gradient(135deg, #d84315, #b71c1c); }
.avatar-color-11 { background: linear-gradient(135deg, #00695c, #004d40); }

/* Player list avatar enhancement */
.list-player-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  font-family: "Acme", sans-serif;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.list-player-row .list-player-avatar {
  margin-right: 2px;
}

.list-player-row.is-dead .list-player-avatar {
  filter: grayscale(0.7) brightness(0.6);
}

/* =============================================
   BUTTON UX IMPROVEMENTS
   ============================================= */

/* Universal active press effect */
.legacy-action-btn:active:not(:disabled),
.legacy-launch-btn:active:not(:disabled),
.legacy-ghost-btn:active:not(:disabled),
.btn-primary:active:not(:disabled),
.btn-create-massive:active:not(:disabled) {
  transform: scale(0.96) translateY(1px);
  filter: brightness(0.9);
}

/* Loading spinner */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.is-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.is-loading::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

/* Focus visible rings */
.legacy-action-btn:focus-visible,
.legacy-launch-btn:focus-visible,
.legacy-ghost-btn:focus-visible,
.legacy-submit-btn:focus-visible,
.btn-primary:focus-visible,
.chat-tab:focus-visible {
  outline: 2px solid #d8bc79;
  outline-offset: 2px;
}

/* Secondary action button (pass/skip) */
.secondary-action-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: clamp(6px, 0.8vh, 10px) clamp(8px, 1.2vw, 14px);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: rgba(255,246,235,0.7);
  font-family: inherit;
  font-size: clamp(0.72rem, 1.1vw, 0.85rem);
  cursor: pointer;
  transition: all 0.18s ease;
}

.secondary-action-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff6eb;
}

.secondary-action-btn:active {
  transform: scale(0.97);
}

/* Judge bègue — encart armer le second vote (au-dessus de la liste) */
@keyframes judge-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(201, 164, 106, 0.2); }
  70%  { box-shadow: 0 0 0 8px rgba(201, 164, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 164, 106, 0); }
}

.judge-arm-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
  padding: 16px 20px;
  border: 1px solid rgba(201, 164, 106, 0.3);
  border-radius: var(--hybrid-radius-md);
  background: linear-gradient(135deg, rgba(201, 164, 106, 0.07) 0%, rgba(201, 164, 106, 0.02) 100%);
  text-align: center;
  animation: judge-pulse 3s infinite;
}

.judge-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--hybrid-gold-soft, #e5d1a8);
  font-family: var(--hybrid-font-title, "Acme", sans-serif);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}

.judge-banner-header svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.judge-banner-desc {
  font-size: clamp(0.72rem, 1.1vw, 0.84rem);
  color: rgba(201, 164, 106, 0.7);
  margin: 0 0 14px 0;
  line-height: 1.4;
}

.judge-arm-banner .secondary-action-btn {
  margin-top: 0;
  width: auto;
  min-width: 200px;
  border-color: rgba(201, 164, 106, 0.55);
  background: rgba(201, 164, 106, 0.12);
  color: var(--hybrid-gold-soft, #e5d1a8);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
}

.judge-arm-banner .secondary-action-btn:hover {
  background: rgba(201, 164, 106, 0.22);
  border-color: rgba(201, 164, 106, 0.8);
  color: #fff;
}

.judge-armed-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  animation: judge-state-in 0.35s ease forwards;
}

@keyframes judge-state-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.judge-armed-icon {
  color: var(--hybrid-success, #5cda89);
  margin-bottom: 4px;
}

.judge-armed-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.judge-arm-label {
  margin: 0;
  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
  color: var(--hybrid-gold-soft, #e5d1a8);
  font-weight: 600;
  line-height: 1.3;
}

.judge-arm-label--spent {
  color: rgba(201, 164, 106, 0.4);
  font-weight: 400;
  font-style: italic;
}

.judge-arm-subtext {
  margin: 0;
  font-size: clamp(0.65rem, 0.9vw, 0.76rem);
  color: rgba(201, 164, 106, 0.5);
  line-height: 1.3;
}

/* =============================================
   END GAME — Role Reveal Ceremony
   ============================================= */

.endgame-reveal {
  padding: 12px 0;
}

.endgame-reveal-title {
  text-align: center;
  color: #d8bc79;
  font-family: "Acme", sans-serif;
  font-size: 1.15rem;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.endgame-reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.endgame-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  transition: all 0.3s ease;
}

.endgame-player-card.is-dead {
  opacity: 0.5;
}

.endgame-player-card.is-winner {
  border-color: rgba(216, 188, 121, 0.4);
  background: rgba(216, 188, 121, 0.1);
}

.endgame-player-card.is-me {
  border-color: rgba(216, 188, 121, 0.6);
  box-shadow: 0 0 8px rgba(216, 188, 121, 0.2);
}

.endgame-card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
}

.endgame-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.endgame-card-name {
  font-size: 0.72rem;
  color: rgba(255, 246, 235, 0.88);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.endgame-card-role {
  font-size: 0.66rem;
  color: #d8bc79;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Winner banner enhancement */
.winner-banner {
  text-align: center;
  padding: 14px 18px;
  margin: 8px 0;
  border-radius: 8px;
  font-family: "Acme", sans-serif;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, rgba(216, 188, 121, 0.25), rgba(165, 45, 36, 0.25));
  border: 1px solid rgba(216, 188, 121, 0.3);
  animation: winner-glow 2s ease-in-out infinite;
}

@keyframes winner-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(216, 188, 121, 0.15); }
  50% { box-shadow: 0 0 24px rgba(216, 188, 121, 0.35); }
}

/* =============================================
   CHAT REFINEMENTS
   ============================================= */

/* Better chat tab styling */
.chat-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: none;
  border-radius: 6px 6px 0 0;
  background: rgba(255,255,255,0.06);
  color: rgba(255,246,235,0.6);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.chat-tab:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,246,235,0.85);
}

.chat-tab.is-active {
  background: rgba(40, 46, 25, 0.9);
  color: #f0d18a;
}

/* Tab-specific colors when active */
.chat-tab.is-active[data-channel-id="wolves"] {
  background: rgba(140, 30, 25, 0.5);
  color: #ff9e9e;
}

.chat-tab.is-active[data-channel-id="lovers"] {
  background: rgba(180, 60, 100, 0.4);
  color: #ffb8d0;
}

.chat-tab.is-active[data-channel-id="siblings"] {
  background: rgba(50, 100, 160, 0.4);
  color: #a8d4f5;
}

.chat-tab.is-active[data-channel-id="dead"] {
  background: rgba(80, 80, 80, 0.5);
  color: #c0c0c0;
}

.chat-tab-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #c62c27;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-tab-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Chat message channel-specific author colors */
.chat-message-wolves .chat-meta strong { color: #ff6b6b; }
.chat-message-lovers .chat-meta strong { color: #e87fa0; }
.chat-message-siblings .chat-meta strong { color: #7eb8e0; }
.chat-message-dead .chat-meta strong { color: #999; }
.chat-message-spectators .chat-meta strong { color: #aaa; }

/* Phase separator enhancement */
.chat-phase-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  margin: 12px 0;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d8bc79;
  border-top: 1px solid rgba(216, 188, 121, 0.15);
  border-bottom: 1px solid rgba(216, 188, 121, 0.15);
  background: rgba(216, 188, 121, 0.05);
  border-radius: 4px;
}

.chat-phase-separator-label {
  flex: 0 0 auto;
}

.chat-role-icon-small {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

/* Role prompt messages */
.chat-message-role-prompt {
  background: rgba(216, 188, 121, 0.08) !important;
  border-left: 3px solid #d8bc79 !important;
  border-radius: 0 6px 6px 0 !important;
  padding-left: 10px !important;
}

.chat-message-role-prompt .chat-system-text {
  font-style: italic;
  color: #e8d5a8;
}

/* =============================================
   ACTION STATUS / PROGRESS INDICATORS
   ============================================= */

.action-progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.action-progress-dots {
  display: flex;
  gap: 4px;
}

.action-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.3s ease;
}

.action-progress-dot.is-filled {
  background: #d8bc79;
}

.action-progress-text {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.5);
}

/* =============================================
   NIGHT AMBIANCE ENHANCEMENTS
   ============================================= */

body.scene-night .legacy-action-card {
  border-color: rgba(80, 100, 180, 0.3);
}

body.scene-night .legacy-panel-burgundy {
  border-color: rgba(60, 80, 140, 0.2);
}

body.scene-day .legacy-action-card {
  border-color: rgba(216, 188, 121, 0.2);
}

/* Smooth transitions between phases */
.legacy-action-card,
.legacy-panel-burgundy,
.legacy-panel-parchment,
.legacy-panel-players {
  transition: border-color 0.8s ease;
}

/* =============================================
   VOTE RESULT ANIMATION
   ============================================= */

@keyframes vote-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.player-vote-badge.is-highlight {
  animation: vote-pulse 0.5s ease;
}

/* =============================================
   RESPONSIVE — Action grid
   ============================================= */

@media (max-width: 1180px) {
  .action-target-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr));
    gap: 5px;
  }
}

@media (max-width: 780px) {
  .action-target-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr));
    gap: 4px;
  }
  .action-target-card {
    padding: 5px 6px;
    gap: 4px;
  }
  .legacy-action-card {
    padding: 14px 8px 10px;
  }
  .legacy-action-form {
    padding-inline: 8px;
  }
  .endgame-reveal-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* =============================================
   LAYOUT FIXES
   ============================================= */

body.mode-game .play-grid {
  min-height: 0;
  align-items: stretch;
}

body.mode-game .play-column-left,
body.mode-game .play-column-right {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
  height: 100% !important;
}

body.mode-game .play-column-left {
  flex: 1 1 auto;
  overflow-y: auto !important;
  overflow-x: hidden;
}

body.mode-game .play-column-right {
  flex: 1 1 auto;
  overflow-y: auto !important;
  overflow-x: hidden;
}

body.mode-game .play-column-left > .legacy-panel,
body.mode-game .play-column-right > .legacy-panel {
  flex: 0 0 auto;
  min-height: 0;
}

body.mode-game .legacy-panel-players-main {
  flex: 0 0 auto !important;
  display: block !important;
  min-height: 0 !important;
}

body.mode-game .legacy-panel-players-main .legacy-panel-body {
  display: block !important;
  flex: 0 0 auto;
  min-height: 0 !important;
  height: auto !important;
}

body.mode-game .legacy-panel-players-main .players-panel {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow-y: visible !important;
}

body.mode-game .legacy-action-card {
  flex: 0 0 auto;
  min-height: 0;
}

body.mode-game .legacy-action-card-inner,
body.mode-game .legacy-action-form {
  min-height: 0;
}

/* Icon alignment cleanup for topbar and settings flags. */
.toggle-icon,
.topbar-icon-btn,
.flag-icon {
  line-height: 1;
  vertical-align: middle;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flag-icon svg,
.topbar-icon-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}
