/* ==============================
   PLAYER — loaded last by every player page, after tokens-base.css (the only
   shared sheet) and the four tier sheets exported from Unity: atoms.css,
   molecules.css, organisms.css, pages.css.
   This file holds what the web-only screens need and Unity does not have:
   loading screen, landing / login, chat list, account settings, report, demo
   end, boot spinner and error card. Every screen is a .ui-frame (pages.css). Then layer 8, the landscape split.
   ============================== */

/* ─── 3.8 TABS (auth variant) ─── */

.nav-item {
  list-style: none;
}

.auth-tabs .nav-link {
  flex: 1;
  padding: var(--space-3);
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
}

/* ─── 3.10 FORMS ─── */

label {
  color: var(--white-50);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-2);
}

/* ─── 3.11 FOCUS & PRESS ─── */

button:focus {
  box-shadow: none;
  outline: none;
}

button:active:not(:disabled) {
  transition: scale var(--transition-fast);
}

a:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: var(--border-width-thick) solid var(--accent-50) !important;
  outline-offset: var(--border-width-thick) !important;
  box-shadow: none !important;
}

/* ─── 6.2 CHAT LIST ─── */

.header-actions {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.chat-list-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-list-body > p {
  margin-top: var(--space-5);
  text-align: center;
  color: var(--white-50);
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: var(--border-width-base) solid var(--accent);
  background: var(--accent-secondary-50);
  cursor: pointer;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.chat-list-item:hover {
  border-color: var(--accent-50);
  box-shadow: 0 0 var(--space-3) var(--accent-secondary-50);
}

.chat-list-avatar {
  width: var(--space-7);
  height: var(--space-7);
  border-radius: var(--radius-md);
  border: var(--border-width-base) solid var(--accent);
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
}

.chat-list-info {
  flex: 1;
  min-width: 0;
}

.chat-list-name {
  margin-bottom: var(--space-1);
}

.chat-list-preview {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-list-time {
  color: var(--white-50);
  font-size: var(--font-size-xs);
  flex-shrink: 0;
}

/* ─── 6.3 AUTH ─── */

.auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fullscreen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-loading);
  background: url('../assets/background.png') no-repeat center center fixed;
  background-size: cover;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  color: var(--white);
  font-size: var(--font-size-lg);
}

.app-loading-screen {
  transition: opacity var(--transition-slow);
  pointer-events: all;
}

.app-loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.fullscreen-overlay h1,
.fullscreen-overlay i {
  font-size: var(--font-size-display);
  color: var(--accent);
}

.fullscreen-overlay h1,
.app-loading-spinner {
  margin-bottom: var(--space-4);
}

.fullscreen-overlay p {
  color: var(--neutral);
}

.auth-card {
  width: 100%;
}

.auth-card-logo,
.auth-tabs {
  margin-bottom: var(--space-5);
}

.auth-card-logo {
  text-align: center;
}

.auth-card-logo h1 {
  color: var(--accent);
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.auth-card-logo select {
  width: auto;
  display: inline-block;
  font-size: var(--font-size-sm);
  padding: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.turnstile-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.auth-error,
.auth-success {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
  display: none;
  background: var(--feedback);
  border: var(--border-width-base) solid var(--feedback);
  color: var(--white);
}

.auth-error.show,
.auth-success.show {
  display: block;
}

.auth-error {
  --feedback: var(--danger);
}

.auth-success {
  --feedback: var(--success);
}

.password-requirements {
  font-size: var(--font-size-xs);
  color: var(--white-50);
  margin-top: var(--space-2);
}

.auth-forgot {
  text-align: right;
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}

.auth-forgot a,
.auth-back-link a {
  color: var(--accent-light);
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.auth-forgot a:hover,
.auth-back-link a:hover {
  text-decoration: underline;
}

.auth-back-link {
  text-align: center;
  margin-top: var(--space-3);
}

.auth-form-desc {
  color: var(--white-50);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}

.auth-form-desc--centered {
  text-align: center;
}

.auth-form-desc--centered .auth-form-desc__icon {
  font-size: var(--font-size-lg);
  color: var(--accent-light);
  margin-bottom: var(--space-2);
  display: block;
}

.account-settings-body {
  padding: var(--space-4);
  max-width: var(--space-10);
  margin: 0 auto;
  overflow-y: auto;
  flex: 1;
}

.account-section {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-width-base) solid var(--white-10);
}

.account-section:last-child {
  border-bottom: none;
}

.account-section h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-3);
  color: var(--white);
}

.account-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.account-field label {
  min-width: var(--space-8);
  font-size: var(--font-size-sm);
  color: var(--white-50);
}

.account-field .form-control {
  flex: 1;
}

.account-field .btn-light {
  flex-shrink: 0;
}

.account-value {
  color: var(--white-50);
  font-size: var(--font-size-sm);
}

.account-danger-zone {
  border-color: var(--danger-50);
}

.account-danger-zone p {
  color: var(--white-50);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-3);
}

.account-delete-confirm {
  display: none;
  margin-top: var(--space-3);
}

.account-delete-confirm.show {
  display: block;
}

.report-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.report-body .glass-panel {
  width: 100%;
  max-width: var(--space-9);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: center;
}

/* ─── 7.1 SPACING ─── */

.mb-3 {
  margin-bottom: var(--space-4) !important;
}

.mb-4 {
  margin-bottom: var(--space-5) !important;
}

/* ─── Boot overlay (from init-overlay.css) ─── */

.init-progress {
  margin-top: var(--space-4);
  color: var(--white-50);
  font-size: var(--font-size-sm);
  max-width: 28ch;
  text-align: center;
}

.init-reload-btn {
  margin-top: var(--space-4);
}

.init-error-overlay {
  display: flex;
  z-index: var(--z-overlay);
}

.init-error-card {
  max-width: var(--space-9);
  text-align: center;
  padding: var(--space-5);
}

.init-error-card h2 {
  margin-bottom: var(--space-3);
}

.init-error-card p {
  margin-bottom: var(--space-4);
  opacity: var(--disabled-opacity);
}

.init-error-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── 8. SCREEN LAYOUT ───
   Same as Unity's ScreenLayout. Scale: the page is drawn at --ui-scale, which
   js/screen-layout.js fits to the UI's area and caps. Landscape (width >
   height), the one screen cutoff: the layout fills the right half; the left
   half is an empty pane reserved for later. */
body {
  zoom: var(--ui-scale, 1);
}

@media (orientation: landscape) {
  html {
    background: var(--accent-secondary-deep);
  }

  body {
    margin-left: 50%;
    transform: translateZ(0); /* keeps position: fixed overlays in the right half */
  }
}
