/* ── Settings Screen ─────────────────────────────────── */
/* Scoped to #screen-settings and its exclusive classes. */

.settings-container {
  width: 100%;
  max-width: 560px;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 28px;
}

/* ── Username form ─────────────────────────────────────── */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.settings-input:focus {
  border-color: var(--accent);
}

.settings-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.settings-field-status {
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  min-width: 80px;
}

.settings-field-status.checking {
  color: var(--text-dim);
}

.settings-field-status.available {
  color: var(--accent);
}

.settings-field-status.taken {
  color: var(--danger);
}

.settings-submit {
  align-self: flex-start;
  font-size: 10px;
  padding: 10px 20px;
}

.settings-submit:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Avatar card ──────────────────────────────────────── */
.settings-avatar-preview {
  display: flex;
  justify-content: center;
}

.settings-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  overflow: hidden;
}

.settings-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-avatar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-avatar-remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.settings-avatar-remove-btn:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.settings-avatar-remove-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Room visibility toggle ───────────────────────────── */
.settings-toggle-row {
  justify-content: space-between;
}

.settings-toggle-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.settings-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
}

.settings-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.settings-toggle input:checked + .settings-toggle-slider {
  background: rgba(0, 229, 160, 0.15);
  border-color: var(--accent);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

.settings-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Active Games (LIVE NOW) ──────────────────────────── */
.active-games-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-games-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.active-game-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--surface2);
  cursor: pointer;
  transition: background 0.1s;
}

.active-game-entry:hover {
  background: rgba(0, 229, 160, 0.08);
}

.active-game-thumb {
  width: 64px;
  height: 48px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}

.active-game-thumb-placeholder {
  width: 64px;
  height: 48px;
  border-radius: 3px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.active-game-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.active-game-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-game-host {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
}

.active-game-viewers {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.active-game-system {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--accent2);
  background: rgba(0, 184, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Top Games ────────────────────────────────────────── */
.top-games-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-games-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.top-games-tab {
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.top-games-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.top-games-tab.active {
  background: rgba(0, 229, 160, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.top-games-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.top-game-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--surface2);
  cursor: pointer;
  transition: background 0.1s;
}

.top-game-entry:hover {
  background: rgba(0, 229, 160, 0.08);
}

.top-game-rank {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--accent);
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.top-game-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-game-stats {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
