:root {
  --bg: var(--tg-theme-bg-color, #000000);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #007aff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #1c1c1e);
  --chip-bg: var(--secondary);
  --surface-bg: color-mix(in srgb, var(--secondary) 42%, var(--bg));
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius: 12px;
  --card-shadow-spill: 8px;
  --safe-bottom: max(
    var(--tg-safe-area-inset-bottom, 0px),
    var(--tg-content-safe-area-inset-bottom, 0px),
    env(safe-area-inset-bottom, 0px)
  );
  --safe-top: max(
    var(--tg-safe-area-inset-top, 0px),
    var(--tg-content-safe-area-inset-top, 0px),
    env(safe-area-inset-top, 0px)
  );
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(16px + var(--safe-bottom));
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--secondary);
}

.header-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.header-settings-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 2px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.header-settings-btn svg {
  width: 22px;
  height: 22px;
}

.header-settings-btn:active {
  background: var(--secondary);
}

.header-settings-btn.active {
  color: var(--accent);
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 0 auto;
  min-width: 72px;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--hint);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

#tab-rating.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tab-games.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

#day-detail:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

.day-games-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-inline: calc(-1 * var(--card-shadow-spill));
  padding-inline: var(--card-shadow-spill);
  padding-block: 4px;
}

#day-detail:not(.hidden) .day-games-scroll {
  padding-bottom: calc(80px + var(--safe-bottom));
}

.day-bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#day-detail:not(.hidden) .day-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 72%, color-mix(in srgb, var(--bg) 88%, transparent));
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.22);
}

.day-bottom-bar .primary-btn,
.day-bottom-bar .secondary-btn {
  margin-top: 0;
}

#modal-new-game .host-password-banner {
  margin-bottom: 12px;
}

.new-game-options {
  margin-top: 4px;
}

.new-game-options .option-btn {
  text-align: left;
  font-size: 16px;
}

.day-close-section {
  margin-top: 8px;
  padding-top: 4px;
}

.day-close-section .secondary-btn {
  width: 100%;
  margin-top: 0;
}

.game-card-live .game-card-title {
  color: var(--accent);
}

.game-card-live-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, var(--secondary));
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.game-card-live-meta {
  margin-top: 8px;
  font-size: 14px;
  color: var(--hint);
}

.rating-player-info {
  flex: 1;
  min-width: 0;
}

.hidden { display: none !important; }

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 2px;
}

.list.compact {
  max-height: 50vh;
  overflow-y: auto;
  padding-inline: var(--card-shadow-spill);
  padding-block: 4px;
}

#rating-list,
#days-list,
#players-list,
.profile-achievements-list,
#modal-achievements .list {
  gap: 12px;
}

.search-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-bg);
  color: var(--text);
  font-size: 15px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}

.search-input::placeholder { color: var(--hint); }

.card,
.game-card {
  background: var(--surface-bg);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.2);
  transition: opacity 0.15s;
}

.card:active,
.game-card:active {
  opacity: 0.92;
}

.card.player-admin-card {
  cursor: default;
}

.card.player-admin-card:active {
  opacity: 1;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
}

.card-sub { font-size: 13px; color: var(--hint); margin-top: 4px; }

.badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.rating-points {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-right: 12px;
  flex-shrink: 0;
}

.rating-row { display: flex; align-items: center; cursor: pointer; }

.rating-history-summary {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.2);
}

.rating-history-summary .card-title {
  font-size: 17px;
}

.rating-history-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

.rating-history-games-total {
  margin-top: 6px;
}

.rating-history-summary .rating-history-profile-btn {
  margin-top: 14px;
  width: 100%;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--accent) 16%, var(--secondary));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.rating-history-day {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 16px;
}

.rating-history-day-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.rating-history-day-points {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.rating-history-role {
  margin-top: 2px;
}

.rating-history-day .points-breakdown {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

#modal-rating-history .modal-scroll-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#modal-rating-history .empty {
  margin: 0;
}

.points-breakdown {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.points-breakdown-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.points-breakdown-label {
  color: var(--text);
}

.points-breakdown-value {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.game-players-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-player-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.game-player-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.card.rating-top-1 {
  border: 2px solid #e8c547;
  box-shadow:
    0 0 10px rgba(232, 197, 71, 0.35),
    0 0 22px rgba(232, 197, 71, 0.18);
}

.card.rating-top-1 .rank {
  background: linear-gradient(145deg, #ffe566, #c9a227);
  color: #1a1400;
  box-shadow: 0 0 12px rgba(232, 197, 71, 0.55);
}

.card.rating-top-1 .rating-points {
  color: #e8c547;
}

.card.rating-top-2 {
  border: 2px solid #b8bcc6;
  box-shadow:
    0 0 10px rgba(184, 188, 198, 0.35),
    0 0 22px rgba(184, 188, 198, 0.16);
}

.card.rating-top-2 .rank {
  background: linear-gradient(145deg, #eef0f4, #9aa0ad);
  color: #1a1a1f;
  box-shadow: 0 0 12px rgba(184, 188, 198, 0.5);
}

.card.rating-top-2 .rating-points {
  color: #c8ccd4;
}

.card.rating-top-3 {
  border: 2px solid #c78650;
  box-shadow:
    0 0 10px rgba(199, 134, 80, 0.35),
    0 0 22px rgba(199, 134, 80, 0.16);
}

.card.rating-top-3 .rank {
  background: linear-gradient(145deg, #e8a56a, #a65f2a);
  color: #1a1008;
  box-shadow: 0 0 12px rgba(199, 134, 80, 0.5);
}

.card.rating-top-3 .rating-points {
  color: #d9956a;
}

.game-players {
  margin-top: 0;
}

.game-card {
  cursor: pointer;
}

.game-card-top {
  margin-bottom: 12px;
}

.game-card-number {
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in srgb, var(--hint) 82%, transparent);
  margin-bottom: 4px;
}

.game-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.game-card-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.game-card-time {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--hint);
  white-space: nowrap;
}

.host-game-history-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.modal-header h3 .host-game-history-title .game-card-number {
  margin-bottom: 0;
}

.modal-header h3 .host-game-history-winner {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.game-role-group {
  margin-top: 14px;
}

.game-role-group:first-of-type {
  margin-top: 0;
}

.game-role-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
  margin-bottom: 8px;
}

.game-card .chip-list.game-players {
  gap: 8px;
}

.game-card .game-player-chip {
  cursor: default;
  pointer-events: none;
  font-size: 15px;
  padding: 10px 14px;
  background: var(--secondary);
  border: 2px solid transparent;
}

.game-card .game-actions {
  margin-top: 16px;
}

.game-card .game-actions .secondary-btn {
  margin-top: 0;
  padding: 12px 16px;
  font-size: 15px;
}

.game-card .game-action-delete {
  background: color-mix(in srgb, var(--danger) 16%, var(--secondary));
  color: var(--danger);
}

.modal-content .card.pick-card {
  background: var(--secondary);
  box-shadow: none;
}

.modal-content .card.pick-card:active {
  opacity: 0.92;
}

.primary-btn, .secondary-btn, .link-btn, .back-btn {
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 20px;
  width: 100%;
  margin-top: 12px;
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-text);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--secondary);
  color: var(--text);
}

.link-btn {
  background: transparent;
  color: var(--accent);
  width: auto;
  padding: 8px 0;
}

.back-btn {
  background: transparent;
  color: var(--accent);
  width: auto;
  padding: 0;
  margin-bottom: 12px;
  font-size: 14px;
}

#modal-host-pick-seat {
  z-index: 110;
}

#modal-host-history {
  z-index: 115;
}

#modal-host-left-table {
  z-index: 116;
}

#modal-host-player-left {
  z-index: 117;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding: 0;
}

#modal-player-profile {
  z-index: 105;
}

.modal-content {
  --modal-surface: var(--surface-bg);
  background: var(--modal-surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  width: 100%;
  max-height: calc(100dvh - var(--safe-top));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.22);
}

.modal-content:not(.modal-with-footer) {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-large {
  max-height: calc(100dvh - var(--safe-top));
}

.modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: start;
  column-gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  align-self: center;
}

.modal-header h3:has(.host-modal-title-round) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.host-modal-title-main {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.host-modal-title-round {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--hint);
  opacity: 0.72;
}

.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--text) 10%, var(--bg));
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  align-self: center;
  justify-self: end;
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-with-footer {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--safe-top));
  overflow: hidden;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.modal-scroll-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  margin-inline: calc(-1 * var(--card-shadow-spill));
  padding-inline: var(--card-shadow-spill);
  padding-block: 4px;
}

.modal-header,
.modal-actions,
.modal-footer-float,
.host-modal-actions {
  flex-shrink: 0;
}

.modal-footer-float {
  flex-shrink: 0;
  padding: 12px 0 0;
  background: linear-gradient(to top, var(--modal-surface) 55%, transparent);
}

.modal-footer-float .primary-btn {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions-single .primary-btn {
  flex: 1;
  margin-top: 0;
}

.modal-actions .primary-btn,
.modal-actions .secondary-btn { flex: 1; margin-top: 0; }

.modal-header + .search-input {
  margin-top: 0;
}

.option-list { display: flex; flex-direction: column; gap: 8px; }

.option-btn {
  background: var(--secondary);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.option-btn.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--secondary));
}

.option-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.modal-hint {
  margin: -8px 0 12px;
}

.role-section {
  margin-bottom: 16px;
}

.role-section h4 {
  font-size: 14px;
  color: var(--hint);
  margin-bottom: 8px;
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: var(--secondary);
  border: 2px solid transparent;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.chip.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--secondary));
}

.chip-check-town {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 30%, var(--secondary));
  color: var(--danger);
  font-weight: 700;
}

.chip-check-mafia {
  border-color: #3d3d3d;
  background: color-mix(in srgb, #3d3d3d 45%, var(--secondary));
  color: #ececec;
  font-weight: 700;
}

.chip .pts { color: var(--hint); font-size: 12px; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
}

label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

label input[type="date"],
label input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  min-height: 0;
  height: 45px;
  padding: 0 12px;
  line-height: 45px;
}

label input[type="date"]::-webkit-date-and-time-value,
label input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
  line-height: 45px;
  height: 45px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

label input[type="date"]::-webkit-datetime-edit,
label input[type="time"]::-webkit-datetime-edit {
  padding: 0;
  line-height: 45px;
}

.hint { font-weight: 400; color: var(--hint); font-size: 12px; }

.toast {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 16px;
  right: 16px;
  bottom: auto;
  background: var(--secondary);
  padding: 14px 16px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.empty {
  text-align: center;
  color: var(--hint);
  padding: 40px 16px;
  font-size: 15px;
}

.game-actions {
  display: flex;
  gap: 8px;
}

.btn-edit {
  background: var(--secondary);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-edit.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  margin-top: 0;
  flex-shrink: 0;
  background: var(--secondary);
  border: 2px solid transparent;
  border-radius: var(--radius);
}

.player-admin-card .btn-edit.btn-icon:active {
  opacity: 0.85;
}

.btn-edit.btn-icon svg {
  width: 18px;
  height: 18px;
}

.rating-help-btn {
  margin: 0;
  width: 100%;
  text-align: center;
}

.help-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.help-body p {
  margin-bottom: 12px;
}

.help-body h4 {
  font-size: 15px;
  margin: 16px 0 8px;
}

.help-body ul {
  margin: 0 0 12px 18px;
  color: var(--hint);
}

.help-body li {
  margin-bottom: 6px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 14px;
}

.help-table th,
.help-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--secondary);
}

.help-table th {
  color: var(--hint);
  font-weight: 600;
  font-size: 13px;
}

.help-table td:last-child,
.help-table th:last-child {
  text-align: right;
  white-space: nowrap;
}

.help-table tr:last-child td {
  border-bottom: none;
}

#close-rating-help {
  margin-top: 0;
}

.primary-btn.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-delete {
  background: color-mix(in srgb, var(--danger) 20%, var(--secondary));
  color: var(--danger);
}

#tab-profile.active,
#tab-settings.active,
#tab-players.active,
#tab-rating-rules.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tab-players .primary-btn {
  margin-top: 0;
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card {
  cursor: default;
}

.profile-card:active {
  opacity: 1;
}

.profile-card-row {
  align-items: center;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
}

.profile-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--secondary);
}

.profile-avatar-img,
.profile-avatar-fallback {
  width: 100%;
  height: 100%;
  display: block;
}

.profile-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent);
}

.profile-rank-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 2px solid var(--surface-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.profile-rank-top-1 {
  background: linear-gradient(145deg, #ffe566, #c9a227);
  color: #1a1400;
}

.profile-rank-top-2 {
  background: linear-gradient(145deg, #eef0f4, #9aa0ad);
  color: #1a1a1f;
}

.profile-rank-top-3 {
  background: linear-gradient(145deg, #e8a56a, #a65f2a);
  color: #1a1008;
}

.profile-text-block {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-name {
  font-size: 18px;
}

.profile-edit-btn {
  margin-top: 0;
  flex-shrink: 0;
  align-self: center;
}

.profile-info .profile-name {
  margin: 0;
  line-height: 1.1;
}

.profile-info .profile-since {
  margin-top: 5px;
  line-height: 1.1;
}

.profile-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-stat-card {
  cursor: default;
  padding: 14px 16px;
}

.profile-stat-card:active {
  opacity: 1;
}

.profile-stat-card .rating-points {
  margin-bottom: 4px;
}

.profile-stat-value {
  font-size: 22px;
}

.profile-history-btn {
  margin-top: 0;
}

.profile-achievements-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.profile-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
}

.profile-section-badge {
  margin: 0;
}

.profile-achievements-preview .secondary-btn {
  margin-top: 0;
}

.achievement-card {
  cursor: default;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.achievement-card:active {
  opacity: 1;
}

.achievement-card-locked {
  opacity: 0.72;
}

.achievement-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
  background: color-mix(in srgb, var(--secondary) 82%, var(--bg));
  padding: 10px;
}

.achievement-icon-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.achievement-body {
  flex: 1;
  min-width: 0;
}

.achievement-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.achievement-desc {
  margin-top: 2px;
}

.achievement-progress-track {
  margin-top: 10px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 78%, var(--bg));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.achievement-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.achievement-progress-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.achievement-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--hint);
}

.achievement-progress-total {
  font-size: 11px;
  font-weight: 500;
  color: var(--hint);
  opacity: 0.45;
  flex-shrink: 0;
}

.achievement-level-badge {
  margin: 0;
  flex-shrink: 0;
}

#modal-achievements .modal-content {
  --modal-surface: color-mix(in srgb, var(--secondary) 26%, var(--bg));
}

#modal-achievements .modal-header h3 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
}

.achievements-modal-title-text {
  min-width: 0;
  flex-shrink: 0;
}

.achievements-modal-count {
  flex-shrink: 0;
  margin: 0;
}

#modal-achievements .modal-scroll-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#modal-achievements .achievement-card {
  background: color-mix(in srgb, var(--secondary) 58%, var(--bg));
}

#modal-player-profile .modal-content {
  --modal-surface: color-mix(in srgb, var(--secondary) 26%, var(--bg));
}

.player-profile-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#modal-player-profile .profile-card,
#modal-player-profile .profile-stat-card,
#modal-player-profile .achievement-card {
  background: color-mix(in srgb, var(--secondary) 58%, var(--bg));
}

#tab-games #create-day-btn {
  margin-top: 0;
  margin-bottom: 12px;
}

#create-day-tiered-fields.hidden,
#create-day-fixed-fields.hidden {
  display: none;
}

label select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--text);
  font-size: 15px;
}

.create-day-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-weight: 500;
}

.create-day-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

#modal-host-conduct #host-list-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 48px;
}

.host-password-banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 12%, var(--secondary));
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.host-password-input {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}

.host-list-footer {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.host-list-footer .primary-btn {
  margin-top: 0;
}

.host-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px;
}

.host-screen-hint {
  margin: 0;
  font-weight: 400;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.45;
}

.host-screen-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.host-screen-actions .primary-btn,
.host-screen-actions .secondary-btn,
.host-screen-actions .link-btn {
  margin-top: 0;
}

.host-screen .host-section-title,
.host-screen .host-highlight,
.host-screen .host-win {
  margin: 0;
}

.host-screen .host-player-count-block {
  margin-bottom: 0;
  padding-bottom: 8px;
}

.host-player-count-block--compact {
  margin-bottom: 0;
  padding: 0;
}

.host-player-count-stepper--compact {
  gap: 12px;
}

.host-screen .host-vote-results {
  margin: 0;
}

.host-screen .host-timer-block {
  margin: 0;
}

.host-modal-actions {
  flex-direction: column;
  margin-top: 0;
  padding-top: 12px;
  gap: 8px;
}

.host-modal-actions .primary-btn,
.host-modal-actions .secondary-btn {
  flex: none;
  width: 100%;
  margin-top: 0;
}

.host-modal-actions #host-primary-btn {
  order: -1;
}

.host-game-tools {
  display: flex;
  gap: 8px;
  width: 100%;
}

.host-game-tools .secondary-btn {
  flex: 1;
  margin-top: 0;
}

.host-nav-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.host-nav-actions .secondary-btn {
  flex: 1;
  margin-top: 0;
}

.host-finish-game-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.host-finish-game-row .primary-btn,
.host-finish-game-row .secondary-btn {
  width: 100%;
  margin-top: 0;
}

.host-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.host-table-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.host-table-section .host-section-title {
  margin-bottom: 10px;
}

.host-table-roles-grid {
  margin-top: 0;
}

.host-table-roles-grid th,
.host-table-roles-grid td {
  vertical-align: middle;
  padding: 10px 8px;
}

.host-table-roles-grid .host-table-role-cell {
  width: 38%;
  font-weight: 600;
  white-space: nowrap;
}

.host-table-roles-grid .host-table-seats-cell {
  width: 62%;
}

.host-table-roles-grid .host-table-role-seats {
  align-items: center;
}

.host-table-role-seats {
  justify-content: flex-start;
  gap: 6px;
  align-items: center;
}

.host-table-seat-chip {
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 600;
}

.host-table-seat-chip--dead {
  opacity: 0.55;
}

.host-table-dead-mark {
  font-size: 13px;
  line-height: 1;
}

.host-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.host-table th,
.host-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.host-table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
}

.host-table-day-block + .host-table-day-block {
  margin-top: 12px;
}

.host-table-day-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
  margin-bottom: 8px;
}

.host-table-chips {
  justify-content: flex-start;
}

.host-table-chip {
  cursor: default;
  font-size: 14px;
  padding: 8px 12px;
}

.host-table-chip--outcome {
  background: color-mix(in srgb, var(--text) 8%, var(--secondary));
  font-size: 13px;
}

.host-table-section + .host-table-section {
  margin-top: 20px;
}

.host-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.host-timeline-day {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--secondary) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.host-timeline-day-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.host-timeline-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.host-timeline-step-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--hint);
}

.host-timeline .host-table-chip {
  background: color-mix(in srgb, var(--secondary) 72%, #000);
}

.host-timeline .host-table-chip--outcome {
  background: color-mix(in srgb, var(--text) 9%, color-mix(in srgb, var(--secondary) 72%, #000));
}

.host-timeline .host-table-chip--dead {
  background: color-mix(in srgb, var(--danger) 16%, color-mix(in srgb, var(--secondary) 68%, #000));
}

.host-timeline .host-table-chip--left {
  background: color-mix(in srgb, var(--secondary) 64%, #000);
  opacity: 0.9;
}

.host-table-vote-rounds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.host-table-body .host-table-chips {
  gap: 8px;
}

.host-table-body .host-table-chip {
  cursor: default;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.35;
}

.host-table-body .chip-seat {
  display: inline-flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.host-table-body .chip-seat-hash {
  opacity: 0.72;
  color: var(--hint);
}

.host-table-death-role {
  color: var(--hint);
  font-weight: 500;
}

.host-table-chip--dead {
  background: color-mix(in srgb, var(--danger) 14%, var(--secondary));
}

.host-table-chip--left {
  opacity: 0.82;
}

.host-history-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--secondary) 55%, transparent);
}

.host-history-item-meta {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 4px;
}

.host-history-item-text {
  font-size: 14px;
  line-height: 1.35;
}

.games-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.games-section-title:first-child {
  margin-top: 0;
}

.host-foul-hint {
  margin: 0 0 12px;
}

.host-foul-chips {
  justify-content: flex-start;
  gap: 8px;
}

.host-foul-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.host-foul-chip--caution {
  border-color: #f1c40f;
  color: #f1c40f;
  background: color-mix(in srgb, #f1c40f 16%, var(--secondary));
}

.host-foul-chip--danger {
  border-color: #e74c3c;
  color: #e74c3c;
  background: color-mix(in srgb, #e74c3c 16%, var(--secondary));
}

.host-cancel-vote-btn {
  width: 100%;
  margin-top: 12px;
}

#modal-host-foul {
  z-index: 1200;
}

#modal-host-conduct .chip-list {
  margin-bottom: 0;
}

#edit-day-tiered-fields.hidden,
#edit-day-fixed-fields.hidden {
  display: none;
}

.day-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.day-header-back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--accent);
  cursor: pointer;
}

.day-header-back svg {
  width: 24px;
  height: 24px;
}

.day-header-info {
  flex: 1;
  min-width: 0;
}

.day-header-datetime {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.day-header-address {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--hint);
}

.day-detail-header .btn-edit.btn-icon {
  margin-top: 0;
}


.host-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 25%, var(--secondary));
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.host-section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.host-subtitle {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.host-field { margin-bottom: 12px; }

.host-field label {
  display: block;
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 6px;
}

.host-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--text);
  font-size: 15px;
}

.host-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 14px;
}

.host-stepper-row,
.host-vote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.host-role-toggle-row {
  min-height: 0;
}

.host-role-toggle-row > span:first-child {
  flex: 1;
  line-height: 1.25;
}

.host-role-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.host-role-checkbox input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.stepper-btn:disabled { opacity: 0.4; }

.host-player-count-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 8px 0 20px;
}

.host-player-count-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
  letter-spacing: 0.02em;
}

.host-player-count-stepper {
  justify-content: center;
  gap: 24px;
}

.host-player-count-value {
  font-size: 52px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.5ch;
  text-align: center;
  line-height: 1;
}

.host-vote-totals {
  margin-bottom: 16px;
}

.host-vote-total-row {
  padding: 12px 0;
}

.host-vote-count {
  flex-shrink: 0;
}

.host-vote-progress {
  margin-bottom: 8px;
}

.host-player-count-btn {
  width: 60px;
  height: 60px;
  font-size: 30px;
  border-radius: 16px;
}

.host-vote-outcome {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.host-vote-outcome-meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.host-vote-outcome-tally {
  margin-bottom: 12px;
}

.host-vote-outcome-tally .host-vote-result-row {
  padding: 6px 0;
}

.host-vote-abst {
  font-size: 0.55em;
  font-weight: 500;
  opacity: 0.5;
  vertical-align: baseline;
}

.host-vote-count-list,
.host-shootout-vote-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 12px;
}

.host-vote-count-row,
.host-shootout-vote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.host-vote-count-label,
.host-shootout-vote-label {
  font-size: 15px;
  font-weight: 600;
}

.host-vote-count-row .host-player-count-stepper,
.host-shootout-vote-row .host-player-count-stepper {
  gap: 12px;
}

.host-vote-count-row .host-player-count-value,
.host-shootout-vote-row .host-player-count-value {
  font-size: 32px;
  min-width: 2ch;
}

.host-vote-count-row .host-player-count-btn,
.host-shootout-vote-row .host-player-count-btn {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

.host-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.host-seat {
  width: 36px;
  font-weight: 700;
  color: var(--accent);
}

.host-highlight {
  font-size: 20px;
  font-weight: 700;
  margin: 12px 0;
}

.host-deaths-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.host-death-row {
  font-size: 18px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-bg, rgba(255, 255, 255, 0.06));
}

.host-timer {
  font-size: clamp(40px, 14vw, 64px);
  font-weight: 700;
  text-align: center;
  margin: 12px 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.host-timer-ms {
  opacity: 0.5;
}

.host-timer-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 12px;
}

.host-timer-panel .host-timer {
  margin: 0;
  text-align: center;
}

.host-timer-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.host-timer-icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 12%, var(--secondary));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.host-timer-icon-btn:active {
  transform: scale(0.96);
}

.host-timer-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.host-timer-blocked {
  color: #e74c3c;
}

@keyframes host-timer-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.04); }
}

.host-timer--urgent {
  color: #e74c3c;
  animation: host-timer-pulse 1s ease-in-out infinite;
}

.host-prostitute-block-chip {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 18px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border: 2px solid #e74c3c;
  background: color-mix(in srgb, #e74c3c 18%, var(--secondary));
  color: #e74c3c;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.host-player-eliminated-chip,
.host-status-chip {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 18px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--secondary));
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.host-announce-chip {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.host-announce-chip-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}

.host-announce-chip-subtitle {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--hint);
}

.host-player-win-chip {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 18px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--success);
  background: color-mix(in srgb, var(--success) 18%, var(--secondary));
  color: var(--success);
}

.host-player-win-chip-label {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.host-game-over-winner-chips {
  justify-content: center;
  margin-top: 12px;
}

.host-game-over-winner-chip {
  border-color: color-mix(in srgb, var(--success) 55%, var(--secondary));
  background: color-mix(in srgb, var(--success) 10%, var(--secondary));
}

.host-game-over-table {
  margin-top: 4px;
}

.host-game-over-award {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--secondary);
}

.host-game-over-award .secondary-btn {
  margin-top: 0;
  width: 100%;
}

.host-game-over-award-hint {
  margin: 0;
}

.host-game-over-award .host-game-over-best-player {
  margin-top: 0;
}

.host-best-player-hint {
  margin: 0 0 12px;
}

.host-best-player-footer {
  display: flex;
  gap: 8px;
}

.host-best-player-footer .secondary-btn {
  flex: 1;
}

.host-game-over-best-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.host-game-over-best-player-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.host-game-over-best-player-chip {
  border-color: color-mix(in srgb, var(--success) 55%, var(--secondary));
  background: color-mix(in srgb, var(--success) 10%, var(--secondary));
}

.host-vote-outcome .host-status-chip {
  margin-bottom: 0;
}

.chip-disabled,
.host-turn-chips-disabled .chip {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.host-turn-chips-disabled {
  pointer-events: none;
}

.host-role-reveal {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin: 8px 0 20px;
  padding: 20px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, var(--secondary));
}

.host-role-reveal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.host-role-reveal-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

.host-role-reveal-seat {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.35em;
  width: 100%;
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.host-role-reveal-seat-item {
  display: inline-flex;
  align-items: baseline;
}

.host-role-reveal-seat-item .chip-seat-hash,
.host-role-reveal-num {
  filter: blur(10px);
  opacity: 0.55;
  user-select: none;
  transition: filter 0.12s ease, opacity 0.12s ease;
}

.host-role-reveal.is-revealed .host-role-reveal-seat-item .chip-seat-hash,
.host-role-reveal.is-revealed .host-role-reveal-num {
  filter: none;
  opacity: 1;
  user-select: auto;
}

.host-role-reveal-eye-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--hint);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.host-role-reveal-eye-btn:active,
.host-role-reveal.is-revealed .host-role-reveal-eye-btn {
  background: color-mix(in srgb, var(--accent) 28%, var(--secondary));
  color: var(--accent);
}

.host-role-reveal-eye-icon {
  width: 24px;
  height: 24px;
}

.host-timer-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.host-speech-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.host-speech-timer-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.host-speech-timer-area .host-timer-panel {
  max-width: 100%;
}

.host-speech-screen .host-nomination-block {
  flex-shrink: 0;
}

.host-vote-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.host-vote-actions .primary-btn,
.host-vote-actions .secondary-btn { margin-top: 0; }

.host-btn-grid,
.host-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.host-btn-grid .secondary-btn,
.host-role-grid .secondary-btn {
  margin-top: 0;
  font-size: 14px;
  padding: 10px 8px;
}

.host-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.host-chip {
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.host-assigned {
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.host-assigned.dead {
  opacity: 0.55;
  text-decoration: line-through;
}

.host-nom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--secondary);
  border-radius: var(--radius);
}

.host-check-result {
  padding: 12px;
  background: color-mix(in srgb, var(--accent) 20%, var(--secondary));
  border-radius: var(--radius);
  font-weight: 700;
  margin: 12px 0;
}

.host-win {
  color: var(--success);
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0;
}

.host-session-row {
  align-items: center;
  gap: 12px;
}

.host-delete-game {
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

#host-new-game-btn { margin-top: 0; }

.admin-auth-hint {
  font-size: 12px;
  color: var(--hint);
  padding: 6px 0 4px;
  line-height: 1.3;
}

.host-seat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.host-seat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(128, 128, 128, 0.25));
  cursor: pointer;
}

.host-seat-row.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--secondary));
}

.host-seat-row .chip {
  cursor: default;
}


.host-turn-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  text-align: center;
}

.host-turn-chips {
  justify-content: flex-start;
  margin: 16px 0 12px;
}

.host-turn-chips .chip {
  font-size: 15px;
  padding: 10px 14px;
}

.chip-seat-hash {
  opacity: 0.5;
}

.host-nomination-block {
  margin-top: 20px;
}

.host-nomination-block .host-section-title {
  font-size: 16px;
  margin-bottom: 8px;
}

.host-nomination-block .host-section-title:not(:first-of-type) {
  margin-top: 16px;
}

.host-nomination-block .host-nominated-chips {
  margin-bottom: 12px;
}

.host-nomination-block .host-turn-chips {
  margin-top: 8px;
}

.host-nominated-label {
  margin: 16px 0 8px;
  font-weight: 600;
}

.host-nominated-chips {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.chip-nominated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 15px;
  background: color-mix(in srgb, var(--accent) 18%, var(--secondary));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.chip-nom-count-bubble,
.chip-count-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.chip-count-bubble--caution {
  background: #f1c40f;
  color: #1a1a1a;
}

.chip-count-bubble--danger {
  background: #e74c3c;
  color: #fff;
}

.host-role-sections .role-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.host-seat-label {
  font-size: 15px;
  font-weight: 600;
}

.host-role-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.host-role-sections .role-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.host-assign-roles-board.host-assign-roles-timer-active
  .role-section:not([data-assign-role="mafia"]):not([data-assign-role="don"]) {
  filter: blur(10px);
  opacity: 0.28;
  pointer-events: none;
  user-select: none;
}

.host-assign-roles-board.host-assign-roles-timer-active
  .role-section:not([data-assign-role="mafia"]):not([data-assign-role="don"]) .chip.selected {
  border-color: transparent;
  background: var(--secondary);
  color: var(--text);
  font-weight: normal;
}

.host-player-row-linked {
  border-left: 3px solid var(--success);
  padding-left: 8px;
}

.host-pick-seat-btn {
  width: auto;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
  flex-shrink: 0;
}

.club-picker {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.club-picker.hidden {
  display: none;
}

.club-picker-card {
  width: min(100%, 360px);
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 20px;
}

.club-picker-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.club-picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.club-picker-item {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  text-align: left;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}

.club-onboarding-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
}

#app.hidden {
  display: none;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 16px;
}

.settings-block {
  padding: 16px;
}

.settings-block-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-label {
  color: var(--hint);
  font-size: 15px;
}

.settings-value {
  font-size: 15px;
  font-weight: 600;
}

.settings-action-btn {
  width: 100%;
}

.settings-hint {
  color: var(--hint);
  font-size: 14px;
  line-height: 1.4;
  margin-top: 10px;
}

.settings-hint-warn {
  color: var(--danger);
}

.settings-sub-renew-btn {
  margin-top: 12px;
}

.subscription-renew-body p {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.subscription-renew-body p:last-child {
  margin-bottom: 0;
}

.subscription-renew-note {
  color: var(--hint);
  font-size: 14px;
}

.subscription-renew-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subscription-renew-footer .secondary-btn,
.subscription-renew-footer .primary-btn {
  width: 100%;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 14px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.settings-nav-btn svg {
  width: 22px;
  height: 22px;
  color: var(--hint);
  flex-shrink: 0;
}

.settings-subheader {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-subheader-text {
  min-width: 0;
  flex: 1;
}

.settings-subheader-title {
  font-size: 18px;
  font-weight: 600;
}

.players-count {
  margin: 4px 0 0;
  color: var(--hint);
  font-size: 14px;
  font-weight: 500;
}

.rating-rules-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-rules-section {
  margin: 8px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.rating-rules-section:first-child {
  margin-top: 0;
}

.rating-rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--secondary);
}

.rating-rule-enabled {
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.rating-rule-row-disabled .rating-rule-label {
  color: var(--hint);
}

.rating-rule-row-disabled .rating-rule-enabled {
  opacity: 0.45;
}

.rating-rule-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}

.rating-rule-points {
  flex: 0 0 72px;
  width: 72px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--secondary);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  text-align: right;
}

.rating-rule-points:disabled {
  opacity: 0.45;
}

.rating-help-disabled {
  color: var(--hint);
}

#tab-rating-rules .primary-btn {
  margin-top: 4px;
}

.max-connect-steps {
  margin: 0 0 16px 1.1em;
  padding: 0;
  line-height: 1.5;
}

.max-connect-code-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.max-connect-code {
  display: block;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface-bg);
  font-size: 16px;
  word-break: break-all;
}

.max-connect-note {
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}
