html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 72px;
}

/* Player layout: narrower padded column on phones */
.container-player {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

body.role-admin .container-player {
  max-width: 1100px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 576px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .w-sm-auto {
    width: auto !important;
  }
}

/* Touch-friendly controls for player UI */
.btn-touch {
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-link {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

.quest-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 576px) {
  .quest-board {
    grid-template-columns: 1fr 1fr;
  }
}

.quest-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: none;
  border-radius: 16px;
  background: #f5f5f5;
}

/* Полноценная заливка по типу конкурса */
.quest-card--tone-solo {
  background: #ffe082; /* жёлтый — соло */
}

.quest-card--tone-duo {
  background: #a5d6a7; /* зелёный — двое, не PvP */
}

.quest-card--tone-pvp {
  background: #ef9a9a; /* красный — PvP */
}

.quest-card--tone-final {
  background: #ce93d8; /* фиолетовый — финал */
}

.quest-card--open {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

.quest-card--selected {
  outline: 3px solid #f57f17;
  outline-offset: 2px;
}

.quest-card--locked {
  filter: saturate(0.75) brightness(0.97);
}

.quest-card--tone-solo .quest-card__points,
.quest-card--tone-duo .quest-card__points,
.quest-card--tone-pvp .quest-card__points,
.quest-card--tone-final .quest-card__points {
  color: #212121;
}

.quest-card--tone-solo .quest-icon-placeholder,
.quest-card--tone-duo .quest-icon-placeholder,
.quest-card--tone-pvp .quest-icon-placeholder,
.quest-card--tone-final .quest-icon-placeholder {
  background: rgba(255, 255, 255, 0.45);
  color: #212121;
}

.quest-card__icon {
  text-align: center;
}

.quest-card__title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0;
}

.quest-card__meta {
  font-size: 0.85rem;
  font-weight: 600;
  color: #212121;
  opacity: 0.85;
}

.quest-card__kind {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.quest-card__sep {
  margin: 0 0.2rem;
  opacity: 0.6;
}

.quest-card__points {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0d6efd;
}

.history-list {
  display: grid;
  gap: 1rem;
}

.history-card {
  border: 1px solid #dee2e6;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
}

.history-card__title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
}

.history-card__desc {
  white-space: pre-wrap;
  margin-bottom: 0.75rem;
  line-height: 1.45;
  color: #495057;
}

.history-card__points {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.98rem;
}

.history-card__meta {
  font-size: 0.85rem;
  display: grid;
  gap: 0.15rem;
}

.mafia-history-list {
  display: grid;
  gap: 0.75rem;
}

.mafia-history-card {
  border: 1px solid #dee2e6;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
  color: #212121;
}

.mafia-history-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mafia-history-card__game {
  font-weight: 650;
  font-size: 1.05rem;
}

.mafia-history-card__role {
  font-weight: 600;
}

.mafia-history-card__points {
  font-size: 0.98rem;
}

.mafia-history-card.role-civilian {
  background-color: #e53935;
  border-color: #c62828;
  color: #fff;
}

.mafia-history-card.role-sheriff {
  background-color: #43a047;
  border-color: #2e7d32;
  color: #fff;
}

.mafia-history-card.role-mafia {
  background-color: #9e9e9e;
  border-color: #757575;
  color: #212121;
}

.mafia-history-card.role-don {
  background-color: #212121;
  border-color: #000;
  color: #fff;
}

.mafia-history-card.role-civilian .text-muted,
.mafia-history-card.role-sheriff .text-muted,
.mafia-history-card.role-don .text-muted {
  color: rgba(255, 255, 255, 0.8) !important;
}

.mafia-history-card.role-mafia .text-muted {
  color: rgba(33, 33, 33, 0.7) !important;
}

.quest-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.quest-card__actions .btn,
.quest-card__start {
  width: 100%;
}

@media (min-width: 576px) {
  .quest-card__actions {
    flex-direction: row;
  }

  .quest-card__actions > * {
    flex: 1;
  }
}

.quest-reqs {
  font-size: 0.95rem;
}

.quest-reqs__label {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.quest-reqs__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.quest-reqs__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.35;
}

.quest-reqs__list .is-met {
  color: #198754;
}

.quest-reqs__list .is-unmet {
  color: #6c757d;
}

.quest-reqs__or {
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #2e7d32;
  letter-spacing: 0.04em;
}

.quest-icon {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 14px;
}

.quest-icon-lg {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: 18px;
}

.quest-icon-placeholder {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border-radius: 14px;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
}

.quest-details__desc {
  white-space: pre-wrap;
  font-size: 1.05rem;
  line-height: 1.5;
}

.action-stack {
  display: grid;
  gap: 0.75rem;
}

.quest-body {
  overflow-wrap: anywhere;
}

.quest-body img {
  max-width: 100%;
  height: auto;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  font-size: 0.85rem;
}

/* Admin tables: keep usable on tablet, horizontal scroll on phone if needed */
body.role-admin .table-responsive,
body.role-admin table {
  font-size: 0.95rem;
}

.side-game-table-wrap {
  max-width: 100%;
}

.side-game-table {
  min-width: 1100px;
}

.side-game-table .side-game-login {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  min-width: 7rem;
  white-space: nowrap;
}

.side-game-table thead .side-game-login {
  z-index: 2;
}

.side-game-cell {
  min-width: 4.75rem;
  padding: 0.2rem !important;
  vertical-align: middle;
  transition: background-color 0.15s ease;
}

.side-game-cell.side-game-ci {
  min-width: 3.25rem;
  background: rgba(0, 0, 0, 0.03);
}

.side-game-combo {
  display: flex;
  align-items: stretch;
  min-height: 1.75rem;
  background: transparent;
}

.side-game-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.75rem;
  padding: 0 0.15rem;
  color: inherit;
  -moz-appearance: textfield;
}

.side-game-input:focus {
  outline: none;
  box-shadow: none;
}

.side-game-role {
  flex: 0 0 1.35rem;
  width: 1.35rem;
  max-width: 1.35rem;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: transparent; /* выбранная роль не отображается — только цвет ячейки */
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.55rem;
}

.side-game-role:focus {
  outline: none;
  box-shadow: none;
}

.side-game-role option {
  color: #212121;
  background: #fff;
}

/* Мирный — красный */
.side-game-cell.role-civilian {
  background-color: #e53935;
  color: #fff;
}

/* Шериф — зелёный */
.side-game-cell.role-sheriff {
  background-color: #43a047;
  color: #fff;
}

/* Мафия — серый */
.side-game-cell.role-mafia {
  background-color: #9e9e9e;
  color: #212121;
}

/* Дон — чёрный */
.side-game-cell.role-don {
  background-color: #212121;
  color: #fff;
}

.side-game-cell.role-civilian .side-game-role,
.side-game-cell.role-sheriff .side-game-role,
.side-game-cell.role-don .side-game-role {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

.side-game-cell.role-mafia .side-game-role {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23424242' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}
