/* In-browser player layout — load after app-shared.css */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(93, 134, 216, 0.18), transparent 28%),
    linear-gradient(180deg, #091120 0%, #07101d 55%, #060d18 100%);
  color: var(--text);
}

.player-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.player-shell > .player-site-header {
  flex: 0 0 auto;
  position: relative;
  z-index: 100;
}

.player-auth-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-right: 0.25rem;
  white-space: nowrap;
}

#unity-container {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100%;
  background: transparent;
  outline: none;
}

body.auth-open #unity-container {
  pointer-events: none;
  user-select: none;
}

body.auth-open #unity-canvas {
  pointer-events: none;
}

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 85vw);
  text-align: center;
  pointer-events: none;
}

#unity-loading-bar .label {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

#unity-progress-bar-empty {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}

#unity-warning {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  max-width: min(520px, 92vw);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: rgba(7, 16, 29, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.player-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.auth-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 14, 0.82);
  z-index: 10000;
  pointer-events: auto;
}

.auth-gate[hidden] {
  display: none;
}

.auth-panel.app-modal-panel {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.auth-tab {
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 0.45rem 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.auth-tab:hover {
  color: var(--text);
  border-color: rgba(0, 200, 200, 0.35);
}

.auth-tab.active {
  color: var(--text);
  background: rgba(0, 200, 200, 0.12);
  border-color: rgba(0, 200, 200, 0.45);
}

.auth-form {
  display: grid;
  gap: 0.65rem;
}

/* Full-width fields: direct inputs and inputs inside .auth-confirm-wrap (grid children differ in sizing). */
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  pointer-events: auto;
  touch-action: manipulation;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
  outline: 2px solid rgba(93, 134, 216, 0.45);
  outline-offset: 1px;
}

.auth-confirm-wrap {
  width: 100%;
  min-width: 0;
}

.auth-show-password {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.auth-show-password input {
  width: auto;
  margin: 0;
}

.auth-text-link {
  justify-self: start;
  padding: 0;
  margin: -0.25rem 0 0;
  border: none;
  background: none;
  color: rgba(120, 200, 255, 0.95);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.auth-text-link:hover {
  color: #b8e8ff;
}

.auth-primary-full {
  width: 100%;
}

.auth-oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-oauth-divider::before,
.auth-oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

.auth-google-btn {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.22);
}

.auth-confirm-wrap[hidden] {
  display: none !important;
}

.auth-form .auth-show-password input[type="checkbox"] {
  width: auto;
  min-width: 1rem;
  accent-color: rgba(0, 200, 200, 0.85);
  padding: 0;
  border: none;
  background: transparent;
}

.auth-row {
  display: flex;
  gap: 0.5rem;
}

.auth-row .btn {
  flex: 1;
}

.btn-guest {
  width: 100%;
  margin-top: 0.15rem;
}

.auth-message {
  min-height: 1.1rem;
  font-size: 0.8rem;
}

.guest-download-note {
  position: absolute;
  left: 28.5rem;
  bottom: 1rem;
  z-index: 12;
  font-size: 0.8rem;
  color: #ffd4a8;
  background: rgba(18, 12, 6, 0.88);
  border: 1px solid rgba(255, 173, 92, 0.4);
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  max-width: min(360px, calc(100vw - 2rem));
}

@media (max-width: 980px) {
  .guest-download-note {
    left: 1rem;
    bottom: 1rem;
  }
}
