:root {
  --bg-dark: #0d101d;
  --bg-panel: #161b2e;
  --bg-panel-alt: #1e2540;
  --bg-cell: #131829;
  --bg-cell-weekend: #181f36;
  --bg-cell-hover: #232c4b;

  --border-pixel: #334168;
  --border-gold: #fbbf24;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;

  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.25);
  --green-free: #10b981;
  --danger: #ef4444;

  /* Colores de cada miembro de La Compañía */
  --char-carmen: #a855f7;
  --char-adrian: #38bdf8;
  --char-jaime: #22c55e;
  --char-maria: #f43f5e;
  --char-jose: #eab308;
  --char-esmeralda: #14b8a6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 15%, rgba(168, 85, 247, 0.12), transparent 35%),
    radial-gradient(circle at 85% 20%, rgba(251, 191, 36, 0.10), transparent 35%),
    radial-gradient(circle at 50% 85%, rgba(20, 184, 166, 0.10), transparent 40%);
  z-index: 0;
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: block;
}

/* Estilo Pixel Art / RPG Panel */
.pixel-title {
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 4px 0 #78350f, 0 0 20px rgba(251, 191, 36, 0.4);
}

.rpg-panel {
  background: var(--bg-panel);
  border: 2px solid var(--border-pixel);
  border-radius: 12px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* =========================================================
   PANTALLA DE SELECCIÓN DE PERSONAJE
   ========================================================= */
.select-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3.5rem;
  text-align: center;
}

.rpg-badge {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.select-container .pixel-title {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  margin-bottom: 0.85rem;
}

.select-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto 2.25rem;
  line-height: 1.5;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.35rem;
}

.char-card {
  position: relative;
  background: linear-gradient(180deg, #1b223a 0%, #121728 100%);
  border: 3px solid var(--char-color, var(--border-pixel));
  border-radius: 14px;
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5);
}

.char-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.55), 0 0 24px var(--char-glow, rgba(251, 191, 36, 0.25));
}

.char-avatar-frame {
  width: 148px;
  height: 148px;
  border-radius: 12px;
  border: 3px solid var(--char-color);
  background: #0b0e19;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.7);
  position: relative;
}

.char-avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  transition: transform 0.25s ease;
}

.char-card:hover .char-avatar-frame img {
  transform: scale(1.06);
}

.char-class-tag {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.22rem 0.65rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--char-color);
  border: 1px solid var(--char-color);
  margin-bottom: 0.45rem;
}

.char-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.45rem;
}

.char-desc {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.char-enter-btn {
  margin-top: auto;
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 2px solid var(--char-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.char-card:hover .char-enter-btn {
  background: var(--char-color);
  color: #090c15;
}

/* =========================================================
   CABECERA Y BARRA DE MIEMBROS
   ========================================================= */
#screen-calendar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1rem 6.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-sword {
  font-size: 1.65rem;
}

.brand-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.storage-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: inline-block;
}

.member-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-pixel);
  background: var(--bg-cell);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.member-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  image-rendering: pixelated;
}

.member-chip.active {
  border-color: var(--chip-color, var(--gold));
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
}

.active-player-box {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.active-player-pill,
.active-player-box .btn-rpg {
  height: 48px;
  min-width: 164px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem;
  box-sizing: border-box;
}

.active-player-pill {
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0 0.85rem 0 0.45rem;
  background: var(--bg-panel-alt);
  border: 2px solid var(--player-color, var(--gold));
}

.active-player-pill img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.active-player-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.active-player-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* =========================================================
   CONTROLES DE MES Y LEYENDA
   ========================================================= */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.month-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  line-height: 1;
  color: #fff;
  min-width: 235px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 2px; /* compensación óptica de la fuente pixel */
}

.month-nav .btn-icon,
.month-nav .btn-today {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-today {
  background: rgba(251, 191, 36, 0.14);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  padding: 0 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-today:hover {
  background: rgba(251, 191, 36, 0.25);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.legend-pills {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-free {
  background: var(--green-free);
  box-shadow: 0 0 8px var(--green-free);
}

.dot-quest {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* =========================================================
   TABLERO DEL CALENDARIO MENSUAL
   ========================================================= */
.calendar-board {
  padding: 0.85rem;
}

.weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.45rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.weekdays-header > div {
  padding: 0.4rem;
}

.weekdays-header .weekend-col {
  color: var(--gold);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.day-cell {
  min-height: 118px;
  background: var(--bg-cell);
  border: 1.5px solid #242e4c;
  border-radius: 10px;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.day-cell.is-weekend {
  background: var(--bg-cell-weekend);
  border-color: #2e3b61;
}

.day-cell:hover {
  background: var(--bg-cell-hover);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.day-cell.other-month {
  opacity: 0.32;
}

.day-cell.is-today {
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 12px rgba(251, 191, 36, 0.18);
}

.day-cell.has-quest {
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.16) 0%, var(--bg-cell-weekend) 100%);
}

.day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.day-number {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.day-cell.is-today .day-number {
  background: var(--gold);
  color: #0b0e17;
}

.weekend-free-badge {
  font-size: 0.63rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  white-space: nowrap;
  flex-shrink: 0;
}

.free-mob {
  display: none;
}

.cell-events-mobile {
  display: none;
}

.more-events-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding-left: 4px;
}

/* Eventos dentro de la celda del día */
.cell-events {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.event-pill {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.18rem 0.38rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--pill-color, var(--gold));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-pill.quest-pill {
  background: rgba(251, 191, 36, 0.22);
  border: 1px solid var(--gold);
  color: #fef08a;
  font-weight: 700;
}

.event-pill img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.event-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   BOTÓN INFERIOR "¡BUSCAR UN HUECO PARA LA COMPAÑÍA!"
   ========================================================= */
.bottom-quest-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(680px, calc(100% - 1.5rem));
}

.btn-quest-gold {
  width: 100%;
  padding: 0.85rem 1.4rem;
  border-radius: 14px;
  border: 3px solid #fef08a;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #0f172a;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  cursor: pointer;
  box-shadow: 0 6px 0 #78350f, 0 10px 30px rgba(251, 191, 36, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.btn-quest-gold:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 #78350f, 0 14px 36px rgba(251, 191, 36, 0.65);
}

.btn-quest-gold:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #78350f;
}

.quest-sub {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
}

/* =========================================================
   BOTONES GENERALES RPG
   ========================================================= */
.btn-rpg {
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 2px solid var(--border-pixel);
  background: var(--bg-panel-alt);
  color: var(--text-main);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rpg:hover {
  border-color: var(--gold);
}

.btn-primary {
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
  border-color: #fde047;
  color: #0f172a;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}

.btn-music.is-playing {
  border-color: var(--green-free);
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
}

.btn-music.is-muted {
  border-color: var(--border-pixel);
  color: var(--text-muted);
  opacity: 0.85;
}

.btn-icon {
  padding: 0.45rem 0.75rem;
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
}

/* =========================================================
   MODALES (DETALLE DE DÍA Y ORÁCULO BUSCADOR DE HUECOS)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 18, 0.8);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  max-height: 88vh;
  max-height: 86dvh;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.modal-finder-card {
  width: min(740px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-pixel);
  padding: 1.1rem 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 10;
}

.modal-body {
  padding: 1rem 1.25rem 1.35rem;
}

.modal-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}

.modal-title {
  font-size: 1.25rem;
  margin-top: 0.15rem;
}

.btn-close {
  background: transparent;
  border: 1px solid var(--border-pixel);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-close:hover {
  color: #fff;
  border-color: var(--danger);
}

.section-mini-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.day-party-status {
  margin-bottom: 1.1rem;
}

.day-party-avatars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.party-status-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-cell);
  border: 1px solid var(--border-pixel);
  font-size: 0.8rem;
  min-width: 0;
  overflow: hidden;
}

.party-status-text {
  min-width: 0;
  overflow: hidden;
}

.party-status-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-status-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.label-hint {
  font-weight: 400;
  color: var(--gold);
  font-size: 0.74rem;
}

.multi-char-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.multi-char-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-cell);
  border: 2px solid var(--border-pixel);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.14s ease;
  font-size: 0.82rem;
  font-weight: 600;
}

.multi-char-option img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.multi-char-option .check-indicator {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-pixel);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: transparent;
  flex-shrink: 0;
}

.multi-char-option.selected {
  border-color: var(--opt-color, var(--gold));
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.multi-char-option.selected .check-indicator {
  background: var(--opt-color, var(--gold));
  border-color: var(--opt-color, var(--gold));
  color: #090d16;
  font-weight: 900;
}

.party-status-item.is-busy {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
}

.party-status-item.is-free {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}

.party-status-item img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  image-rendering: pixelated;
}

.day-events-section {
  margin-bottom: 1.25rem;
}

.day-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.day-event-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-cell);
  border-left: 4px solid var(--ev-color, var(--gold));
}

.day-event-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.day-event-info img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  image-rendering: pixelated;
}

.btn-delete-ev {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-delete-ev:hover {
  background: var(--danger);
  color: #fff;
}

/* Formulario */
.event-form {
  border-top: 1px solid var(--border-pixel);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-dates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-group input,
.form-group select {
  width: 100%;
  min-width: 0;
  background: var(--bg-cell);
  border: 1.5px solid var(--border-pixel);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
}

/* =========================================================
   ORÁCULO BUSCADOR DE HUECOS
   ========================================================= */
.finder-best-match {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18) 0%, rgba(16, 185, 129, 0.15) 100%);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 1.15rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.best-match-date {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.15rem;
  color: var(--gold);
  margin: 0.5rem 0;
}

.best-match-avatars {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.best-match-avatars img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 2px solid var(--green-free);
  image-rendering: pixelated;
}

.finder-section {
  margin-top: 1rem;
}

.finder-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.finder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--bg-cell);
  border: 1px solid var(--border-pixel);
  flex-wrap: wrap;
}

. toast {
  position: fixed;
  bottom: 5.5rem;
  right: 1.25rem;
  background: #10b981;
  color: #052e16;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  z-index: 90;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.toast.hidden {
  display: none;
}

@media (max-width: 768px) {
  #screen-calendar {
    padding: 0.65rem 0.55rem 6.8rem;
  }

  /* 1. Cabecera compacta y perfectamente alineada en móvil */
  .topbar {
    padding: 0.75rem;
    gap: 0.65rem;
  }

  .brand-title {
    font-size: 0.88rem;
  }

  /* Los 7 botones de filtro forman 2 filas exactas de 4 columnas (Todos ocupa 2) */
  .member-filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
  }

  .member-chip[data-filter="todos"] {
    grid-column: span 2;
    justify-content: center;
  }

  .member-chip {
    padding: 0.28rem 0.35rem;
    font-size: 0.72rem;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .member-chip img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* Jugador activo arriba + Música y Cambiar Héroe al 50% / 50% debajo */
  .active-player-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    width: 100%;
  }

  .active-player-pill {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: 44px;
    justify-content: center;
  }

  .active-player-box .btn-rpg {
    width: 100%;
    min-width: 0;
    height: 40px;
    font-size: 0.76rem;
    padding: 0 0.5rem;
  }

  /* 2. Barra del mes ordenada en filas limpias */
  .calendar-toolbar {
    padding: 0.65rem 0.75rem;
    gap: 0.6rem;
  }

  .month-nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.4rem;
  }

  .month-label {
    font-size: 0.82rem;
    min-width: 0;
    flex: 1;
  }

  .toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .legend-pills {
    justify-content: center;
    font-size: 0.72rem;
    gap: 0.75rem;
  }

  .toolbar-buttons {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.45rem;
    width: 100%;
  }

  .toolbar-buttons .btn-rpg {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* 3. Cuadrícula del calendario adaptada a pantallas estrechas */
  .calendar-board {
    padding: 0.45rem;
  }

  .weekdays-header {
    gap: 0.22rem;
    font-size: 0.66rem;
    margin-bottom: 0.3rem;
  }

  .weekdays-header > div {
    padding: 0.25rem 0;
  }

  .wk-star {
    display: none;
  }

  .calendar-grid {
    gap: 0.22rem;
  }

  .day-cell {
    min-height: 66px;
    padding: 0.22rem;
    border-radius: 7px;
    gap: 0.2rem;
  }

  .day-top {
    justify-content: space-between;
    align-items: center;
  }

  .day-number {
    font-size: 0.74rem;
    width: 20px;
    height: 20px;
    border-radius: 5px;
  }

  .day-cell.is-all-free {
    border-color: rgba(16, 185, 129, 0.45);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-cell-weekend) 100%);
  }

  .weekend-free-badge {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    background: var(--green-free);
    border: none;
    box-shadow: 0 0 6px var(--green-free);
    display: inline-block;
  }

  .free-desk,
  .free-mob {
    display: none;
  }

  .cell-events-desktop {
    display: none;
  }

  .cell-events-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-content: flex-start;
  }

  .mob-avatar-chip {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--chip-color, var(--gold));
    overflow: hidden;
    display: inline-flex;
    flex-shrink: 0;
  }

  .mob-avatar-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
  }

  .mob-multi-count {
    position: absolute;
    bottom: -1px;
    right: -1px;
    background: var(--chip-color, var(--gold));
    color: #090d16;
    font-size: 0.5rem;
    line-height: 1;
    padding: 1px 2px;
    border-radius: 3px;
    font-weight: 800;
  }

  .mob-quest-chip {
    font-size: 0.72rem;
    line-height: 1;
    background: rgba(251, 191, 36, 0.25);
    border: 1px solid var(--gold);
    border-radius: 4px;
    padding: 1px 2px;
  }

  /* 4. Botón inferior compacto en móvil */
  .bottom-quest-bar {
    bottom: 0.55rem;
    width: calc(100% - 1rem);
  }

  .btn-quest-gold {
    padding: 0.65rem 0.75rem;
    border-radius: 11px;
    gap: 0.2rem;
  }

  .quest-title-line {
    font-size: 0.66rem;
    line-height: 1.35;
  }

  .quest-sub {
    font-size: 0.7rem;
  }

  /* 5. Modales y Oráculo en móvil */
  .modal-backdrop {
    padding: 0.5rem;
  }

  .modal-header {
    padding: 0.85rem 0.95rem 0.7rem;
  }

  .modal-title {
    font-size: 1.02rem;
  }

  .modal-body {
    padding: 0.85rem 0.95rem 1.25rem;
  }

  .form-row-two {
    grid-template-columns: 1fr;
  }

  /* "Desde el día" y "Hasta el día" uno al lado del otro en móvil */
  .form-dates-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .form-group-tramo {
    grid-column: 1 / -1;
  }

  .form-dates-grid input[type="date"] {
    padding: 0.5rem 0.45rem;
    font-size: 0.82rem;
  }

  .day-party-avatars,
  .multi-char-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .party-status-item,
  .multi-char-option {
    padding: 0.38rem 0.45rem;
    font-size: 0.75rem;
    gap: 0.4rem;
  }

  .finder-best-match {
    padding: 0.85rem;
  }

  .best-match-date {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .best-match-avatars img {
    width: 32px;
    height: 32px;
  }

  .finder-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
  }

  .finder-item .btn-rpg {
    width: 100%;
    text-align: center;
  }
}
