:root {
  --bg: #07111f;
  --bg-elev: #0d1f35;
  --bg-card: rgba(10, 28, 46, 0.88);
  --line: rgba(131, 178, 226, 0.28);
  --text: #f3f9ff;
  --muted: #9db3cc;
  --ok: #34d399;
  --chip-chat: #52c7ff;
  --chip-sub: #ffbb55;
  --chip-points: #ff7b7b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Bricolage Grotesque", sans-serif;
  background:
    radial-gradient(1100px 620px at 8% 8%, #103861 0%, transparent 60%),
    radial-gradient(900px 560px at 94% 90%, #4e2237 0%, transparent 52%),
    linear-gradient(155deg, #060d18, var(--bg));
  padding: 1.2rem;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  filter: blur(56px);
  border-radius: 999px;
  opacity: 0.55;
  pointer-events: none;
}

.bg-orb-a {
  width: 260px;
  height: 260px;
  top: -60px;
  right: 10%;
  background: #1f7aff;
}

.bg-orb-b {
  width: 280px;
  height: 280px;
  bottom: -70px;
  left: 5%;
  background: #ff6f5e;
}

.layout {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 3;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 45px rgba(1, 7, 16, 0.5);
}

.hero {
  padding: 1.25rem;
  animation: in 520ms ease-out;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.top-right-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand-pill {
  margin: 0;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 195, 250, 0.5);
  color: #d4e9ff;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-chip {
  margin: 0;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: rgba(10, 24, 40, 0.82);
  border: 1px solid rgba(128, 167, 204, 0.45);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
}

.auth-link {
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(131, 178, 226, 0.5);
  color: #d8ecff;
  background: rgba(12, 31, 52, 0.85);
  font-size: 0.74rem;
  padding: 0.3rem 0.72rem;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
}

.auth-link:hover {
  border-color: rgba(112, 189, 255, 0.9);
  color: #ffffff;
}

.auth-logout {
  color: #ffd1d1;
  border-color: rgba(255, 125, 125, 0.5);
}

.user-chip {
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #c8ffe9;
  padding: 0.3rem 0.72rem;
  font-size: 0.74rem;
  font-family: "JetBrains Mono", monospace;
  background: rgba(4, 42, 33, 0.7);
}

h1 {
  margin: 0.8rem 0 0.3rem;
  font-size: clamp(1.6rem, 3.2vw, 2.45rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.kpis {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.kpi {
  border: 1px solid rgba(125, 167, 210, 0.34);
  border-radius: 14px;
  background: rgba(8, 22, 37, 0.64);
  padding: 0.65rem 0.75rem;
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.kpi-value {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.panel {
  padding: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.06rem;
}

.panel-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.events {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.event-item {
  border: 1px solid rgba(128, 172, 216, 0.26);
  border-radius: 14px;
  padding: 0.78rem;
  background: linear-gradient(130deg, rgba(9, 24, 40, 0.74), rgba(13, 30, 49, 0.64));
  display: grid;
  gap: 0.3rem;
  animation: in 280ms ease-out;
}

.event-type {
  width: fit-content;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: rgba(255, 255, 255, 0.2);
}

.event-type.chat-message {
  background: var(--chip-chat);
  color: #0b132b;
}

.event-type.channel-subscribe {
  background: var(--chip-sub);
  color: #1b1b1b;
}

.event-type.channel-channel-points-redeem {
  background: var(--chip-points);
  color: #1b1b1b;
}

.event-type.channel-cheer {
  background: #ffe082;
  color: #2b1a00;
}

.event-content {
  color: var(--text);
}

.event-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
}

.debug-tools {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 18px;
  margin-top: 1rem;
}

.debug-tools h3 {
  margin: 0 0 0.8rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.debug-btn {
  padding: 0.5rem 1rem;
  margin-right: 0.6rem;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid var(--ok);
  color: var(--ok);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 150ms;
}

.debug-btn:hover {
  background: rgba(52, 211, 153, 0.25);
}

.debug-btn:active {
  opacity: 0.7;
}

.eventsub-status {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  line-height: 1.5;
  color: var(--muted);
  max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .layout {
    gap: 0.8rem;
  }

  .hero,
  .panel {
    padding: 0.9rem;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.42rem;
  }
}

@keyframes in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease-out;
}

.modal.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 300ms ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 150ms;
}

.modal-close:hover {
  background: rgba(131, 178, 226, 0.1);
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex-grow: 1;
}

.session-manage-section {
  margin-bottom: 1.5rem;
}

.session-manage-section h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: var(--text);
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-field {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: rgba(12, 31, 52, 0.85);
  border: 1px solid rgba(131, 178, 226, 0.5);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.input-field:focus {
  outline: none;
  border-color: rgba(112, 189, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(112, 189, 255, 0.1);
}

.input-field::placeholder {
  color: var(--muted);
}

.helper-text {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.btn-primary {
  padding: 0.6rem 1.2rem;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid var(--ok);
  color: var(--ok);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 150ms;
  white-space: nowrap;
}

.btn-primary:hover {
  background: rgba(52, 211, 153, 0.25);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}

.btn-primary:active {
  opacity: 0.85;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.granted-users-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.granted-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
}

.granted-user-name {
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
}

.btn-revoke {
  padding: 0.4rem 0.8rem;
  background: rgba(255, 125, 125, 0.15);
  border: 1px solid rgba(255, 125, 125, 0.5);
  color: #ffd1d1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 150ms;
}

.btn-revoke:hover {
  background: rgba(255, 125, 125, 0.25);
}

.btn-revoke:active {
  opacity: 0.7;
}

.session-list {
  display: grid;
  gap: 1rem;
}

.session-list h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: var(--text);
}

.session-item {
  padding: 0.9rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 150ms;
  text-align: left;
}

.session-item:hover {
  border-color: rgba(112, 189, 255, 0.7);
  background: rgba(9, 24, 40, 0.95);
}

.session-item:active {
  opacity: 0.9;
}

.session-owner {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.session-owner-name {
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  font-weight: 600;
}

.session-owner-login {
  font-size: 0.85rem;
  color: var(--muted);
}

.session-badge {
  padding: 0.2rem 0.6rem;
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: var(--ok);
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.available-sessions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.available-sessions-list li {
  list-style: none;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}


.header-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.action-link {
  padding: 0.6rem 1.2rem;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: var(--ok);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 150ms;
}

.action-link:hover {
  background: rgba(52, 211, 153, 0.25);
}

.action-buttons {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.btn-large {
  padding: 1rem 1.5rem;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: var(--ok);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}

.btn-large:hover {
  background: rgba(52, 211, 153, 0.25);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

.btn-large.btn-success {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.6);
  color: #c8ffe9;
}

.btn-large.btn-success:hover {
  background: rgba(52, 211, 153, 0.3);
}

.btn-secondary {
  padding: 0.6rem 1.2rem;
  background: rgba(128, 167, 204, 0.15);
  border: 1px solid rgba(128, 167, 204, 0.5);
  color: var(--muted);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 150ms;
}

.btn-secondary:hover {
  background: rgba(128, 167, 204, 0.25);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.module-config-btn {
  width: fit-content;
  min-width: 220px;
  font-weight: 600;
  color: #d8ecff;
  border-color: rgba(112, 189, 255, 0.65);
  background: linear-gradient(135deg, rgba(35, 83, 126, 0.38), rgba(26, 54, 84, 0.3));
}

.module-config-btn:hover {
  background: linear-gradient(135deg, rgba(47, 108, 162, 0.45), rgba(30, 67, 105, 0.35));
  border-color: rgba(132, 209, 255, 0.75);
}

.module-words-list {
  display: grid;
  gap: 0.55rem;
}

.module-word-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.module-word-delete-btn {
  white-space: nowrap;
}

@media (max-width: 700px) {
  .module-word-row {
    grid-template-columns: 1fr;
  }

  .module-word-delete-btn {
    justify-self: flex-start;
  }
}

.btn-danger {
  padding: 0.6rem 1.2rem;
  background: rgba(255, 125, 125, 0.15);
  border: 1px solid rgba(255, 125, 125, 0.5);
  color: #ffd1d1;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 150ms;
}

.btn-danger:hover {
  background: rgba(255, 125, 125, 0.25);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.game-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.editor-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.game-editor-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.game-editor-content {
  display: grid;
  gap: 2rem;
}

.section-inputs {
  display: grid;
  gap: 1rem;
}

.section-inputs h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--text);
}

.input-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group-vertical label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

textarea.input-field {
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

.section-roles {
  display: grid;
  gap: 1rem;
}

.roles-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.roles-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.search-box {
  margin-bottom: 1rem;
}

.roles-list-container {
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 24, 40, 0.5);
  overflow-y: auto;
}

.roles-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.role-item {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  animation: in 200ms ease-out;
}

.role-info {
  flex: 1;
}

.role-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.role-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.role-badge {
  padding: 0.25rem 0.6rem;
  background: rgba(82, 199, 255, 0.2);
  border: 1px solid rgba(82, 199, 255, 0.5);
  color: var(--chip-chat);
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.role-badge-command {
  background: rgba(255, 187, 85, 0.16);
  border-color: rgba(255, 187, 85, 0.45);
  color: var(--chip-sub);
  font-family: "JetBrains Mono", monospace;
}

.role-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.role-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--ok);
}

.empty-state {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.spacer {
  flex: 1;
}

.section-levels {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.module-launch-actions {
  margin-top: 0.2rem;
}

.module-launch-note {
  margin: 0;
}

.modules-modal .modal-content {
  max-width: 1000px !important;
  width: 95% !important;
  max-height: 90vh !important;
}

.modules-modal-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modules-modal-toolbar .search-box {
  margin-bottom: 0;
}

.modules-modal .levels-list-container {
  max-height: 48vh;
}

.modules-modal .empty-state {
  border: 1px dashed rgba(131, 178, 226, 0.26);
  border-radius: 12px;
  background: rgba(9, 24, 40, 0.36);
}

#streamer-modules-modal .modal-content {
  max-width: 950px !important;
  width: 95% !important;
  max-height: 90vh !important;
}

#level-form-modal .modal-content {
  max-width: 850px !important;
  width: 95% !important;
  max-height: 90vh !important;
}

#module-config-modal .modal-content {
  max-width: 900px !important;
  width: 95% !important;
  max-height: 90vh !important;
}

.levels-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.levels-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.levels-list-container {
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 24, 40, 0.5);
  overflow-y: auto;
}

.levels-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.level-item {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  animation: in 200ms ease-out;
}

.level-info {
  flex: 1;
}

.level-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.level-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.level-badge {
  padding: 0.25rem 0.6rem;
  background: rgba(255, 187, 85, 0.16);
  border: 1px solid rgba(255, 187, 85, 0.45);
  color: var(--chip-sub);
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.level-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.level-roles-display {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.level-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.roles-checkbox-group {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(12, 31, 52, 0.5);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.role-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-checkbox-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--ok);
}

.role-checkbox-item label {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
}

.roles-allowed-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.save-game-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.module-card {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  animation: in 200ms ease-out;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.module-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.module-badge {
  padding: 0.25rem 0.6rem;
  background: rgba(138, 105, 255, 0.2);
  border: 1px solid rgba(138, 105, 255, 0.5);
  color: #b794f6;
  border-radius: 999px;
  font-size: 0.7rem;
  white-space: nowrap;
  font-family: "JetBrains Mono", monospace;
}

.module-description {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
}

.active-module-card {
  border-color: rgba(112, 189, 255, 0.45);
  background: linear-gradient(135deg, rgba(9, 24, 40, 0.96), rgba(8, 38, 52, 0.92));
}

.inline-empty {
  padding: 0.65rem 0;
  text-align: left;
}

.module-preview {
  display: grid;
  gap: 0.35rem;
}

.module-preview p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.module-word-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.25rem;
}

.module-word-list li {
  line-height: 1.35;
}

.image-words-preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 0.6rem;
  border: 1px solid rgba(131, 178, 226, 0.24);
  background: rgba(6, 12, 22, 0.45);
}

.tusmo-board {
  display: grid;
  gap: 0.45rem;
}

.tusmo-word-block {
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(131, 178, 226, 0.2);
  background: rgba(7, 18, 31, 0.35);
  display: grid;
  gap: 0.5rem;
}

.tusmo-word-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: "JetBrains Mono", monospace;
}

.tusmo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tusmo-cell {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.tusmo-green {
  background: rgba(52, 211, 153, 0.28);
  border-color: rgba(52, 211, 153, 0.65);
  color: #d6ffef;
}

.tusmo-yellow {
  background: rgba(255, 187, 85, 0.24);
  border-color: rgba(255, 187, 85, 0.7);
  color: #fff2d5;
}

.tusmo-orange {
  background: rgba(255, 159, 64, 0.24);
  border-color: rgba(255, 159, 64, 0.72);
  color: #fff0d8;
}

.tusmo-red {
  background: rgba(255, 125, 125, 0.18);
  border-color: rgba(255, 125, 125, 0.55);
  color: #ffe0e0;
}

@media (max-width: 768px) {
  .action-buttons {
    grid-template-columns: 1fr;
  }

  .role-item {
    flex-direction: column;
  }

  .role-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .modal-content {
    max-width: 95% !important;
    width: 90% !important;
  }

  .modules-modal .modal-content {
    max-width: 95% !important;
    width: 90% !important;
  }

  #streamer-modules-modal .modal-content {
    max-width: 95% !important;
    width: 90% !important;
  }

  #level-form-modal .modal-content {
    max-width: 95% !important;
    width: 90% !important;
  }

  #module-config-modal .modal-content {
    max-width: 95% !important;
    width: 90% !important;
  }
}

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.selection-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.selection-content {
  display: grid;
  gap: 1.5rem;
}

.games-list-container {
  min-height: 300px;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 24, 40, 0.5);
  overflow-y: auto;
  scroll-behavior: smooth;
}

.games-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.game-item {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms;
  text-align: left;
  animation: in 200ms ease-out;
}

.game-item:hover {
  border-color: rgba(112, 189, 255, 0.7);
  background: rgba(9, 24, 40, 0.95);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

.game-item:active {
  opacity: 0.9;
}

.game-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.game-description {
  margin: 0.4rem 0 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.game-roles-count {
  margin-top: 0.6rem;
  padding: 0.4rem 0.7rem;
  background: rgba(82, 199, 255, 0.15);
  border: 1px solid rgba(82, 199, 255, 0.3);
  color: var(--chip-chat);
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-block;
}

.ui-dialog-content {
  max-width: 460px;
}

.ui-dialog-message {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.ui-dialog-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ui-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1200;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(4, 42, 33, 0.94);
  color: #c8ffe9;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.ui-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.game-control-card {
  padding: 1.5rem;
}

.game-control-card .role-item {
  animation: none;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.control-grid-bottom {
  margin-top: 1rem;
}

.control-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 24, 40, 0.5);
  padding: 1rem;
}

.control-block h2 {
  margin: 0 0 0.8rem 0;
  font-size: 1rem;
}

.control-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#modules-section .module-card {
  animation: none;
}

.launch-options-group {
  align-items: center;
  margin-bottom: 0.8rem;
}

.launch-option-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: "JetBrains Mono", monospace;
}

.launch-option-input {
  flex: 0 0 120px;
}

.control-note {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

select.input-field {
  appearance: none;
}

@media (max-width: 900px) {
  .control-grid {
    grid-template-columns: 1fr;
  }
}
