/* Локальный вход / регистрация / профиль — современная панель поверх игры */

:root {
  --lam-bg: #f7f7f8;
  --lam-bg-elevated: #ffffff;
  --lam-text: #1a1a1a;
  --lam-muted: #5c5c5c;
  --lam-border: rgba(0, 0, 0, 0.08);
  --lam-gold: #e8c547;
  --lam-gold-hover: #f0d060;
  --lam-radius: 14px;
  --lam-radius-sm: 10px;
  --lam-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.local-auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000000;
  font-family: "avenir", system-ui, -apple-system, "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.local-auth-modal.is-open {
  display: block;
}

/* Второе окно (сброс пароля) поверх окна входа */
.local-auth-modal--forgot {
  z-index: 1000001;
}

.local-auth-modal--forgot .local-auth-dim {
  background: rgba(10, 12, 20, 0.65);
}

.local-auth-modal .local-auth-dim {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 28, 0.55);
  backdrop-filter: saturate(1.1) blur(6px);
  -webkit-backdrop-filter: saturate(1.1) blur(6px);
}

.local-auth-modal .local-auth-panel {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  margin: 0 auto;
  max-width: 380px;
  width: calc(100% - 28px);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--lam-bg);
  padding: 20px 22px 22px;
  box-shadow: var(--lam-shadow);
  border-radius: var(--lam-radius);
  box-sizing: border-box;
  border: 1px solid var(--lam-border);
}

/* Профиль: широкая панель, контент в колонках на десктопе */
#profile-modal .local-auth-panel.profile-modal-panel {
  max-width: min(1040px, calc(100vw - 32px));
  width: calc(100% - 32px);
  max-height: min(90vh, 880px);
  padding: 20px 24px 22px;
}

.local-auth-modal .local-auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  color: #444;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.local-auth-modal .local-auth-close:hover {
  color: #111;
  background: rgba(0, 0, 0, 0.07);
}

.local-auth-modal .local-auth-title {
  margin: 0 44px 16px 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--lam-text);
  text-align: center;
  letter-spacing: -0.02em;
}

.local-auth-modal .local-auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  border-bottom: none;
}

.local-auth-modal .local-auth-tabs button {
  flex: 1;
  padding: 10px 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--lam-muted);
  cursor: pointer;
  border-bottom: none;
  margin-bottom: 0;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.local-auth-modal .local-auth-tabs button:hover {
  color: var(--lam-text);
}

.local-auth-modal .local-auth-tabs button.active {
  color: var(--lam-text);
  font-weight: 700;
  background: var(--lam-bg-elevated);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.local-auth-modal .local-auth-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--lam-muted);
  margin-bottom: 6px;
}

.local-auth-modal .local-auth-form input[type="email"],
.local-auth-modal .local-auth-form input[type="password"],
.local-auth-modal .local-auth-form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--lam-border);
  background: var(--lam-bg-elevated);
  font-family: inherit;
  font-size: 15px;
  border-radius: var(--lam-radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.local-auth-modal .local-auth-form input:focus {
  border-color: rgba(232, 197, 71, 0.65);
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.2);
  outline: none;
}

.local-auth-modal .local-auth-form button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 13px 16px;
  border: none;
  background: var(--lam-gold);
  color: #1d1d1b;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--lam-radius-sm);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.local-auth-modal .local-auth-form button[type="submit"]:hover {
  filter: brightness(1.06);
}

.local-auth-modal .local-auth-form button[type="submit"]:active {
  transform: scale(0.99);
}

.local-auth-modal .local-auth-form.is-hidden {
  display: none;
}

.local-auth-modal .local-auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--lam-text);
  margin: -4px 0 12px;
  cursor: pointer;
  user-select: none;
}

.local-auth-modal .local-auth-remember input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.local-auth-modal .local-auth-forgot-line {
  margin: 14px 0 0;
  text-align: center;
}

/* «Забыли пароль?» — как текстовая ссылка, без вида системной кнопки */
.local-auth-modal .local-auth-forgot-line .local-auth-text-btn {
  display: inline-block;
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #1d4ed8;
  background: transparent;
  border: none;
  border-radius: var(--lam-radius-sm);
  cursor: pointer;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.local-auth-modal .local-auth-forgot-line .local-auth-text-btn:hover {
  color: #1e40af;
  background: rgba(37, 99, 235, 0.08);
  text-decoration: underline;
}

.local-auth-modal .local-auth-text-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
  -webkit-appearance: none;
  appearance: none;
}

.local-auth-modal .local-auth-text-btn:hover {
  color: #1d4ed8;
}

.local-auth-modal .local-auth-lead {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lam-muted);
  text-align: center;
}

.local-auth-modal .local-auth-btn-primary {
  width: 100%;
  margin-top: 6px;
  padding: 13px 16px;
  border: none;
  background: var(--lam-gold);
  color: #1d1d1b;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--lam-radius-sm);
  transition: filter 0.15s ease, transform 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
}

.local-auth-modal .local-auth-btn-primary:hover {
  filter: brightness(1.06);
}

.local-auth-modal .local-auth-btn-primary:active {
  transform: scale(0.99);
}

.local-auth-modal .local-auth-form--forgot input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--lam-border);
  background: var(--lam-bg-elevated);
  font-family: inherit;
  font-size: 15px;
  border-radius: var(--lam-radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.local-auth-modal .local-auth-form--forgot input[type="email"]:focus {
  border-color: rgba(232, 197, 71, 0.65);
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.2);
  outline: none;
}

.local-auth-modal .local-auth-forgot-footer {
  margin: 16px 0 0;
  text-align: center;
}

.local-auth-modal .local-auth-link-quiet {
  display: inline-block;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--lam-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.local-auth-modal .local-auth-link-quiet:hover {
  color: var(--lam-text);
  background: rgba(0, 0, 0, 0.04);
}

.local-auth-modal .local-auth-hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lam-muted);
  text-align: center;
}

.local-auth-modal .local-auth-hint a {
  color: #2563eb;
  text-decoration: none;
}

.local-auth-modal .local-auth-hint a:hover {
  text-decoration: underline;
}

.local-auth-modal .local-auth-legal-sep {
  color: #aaa;
  text-decoration: none;
}

.local-auth-modal .local-auth-requisites {
  margin: 8px 0 0;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--lam-muted);
  text-align: center;
  opacity: 0.92;
}

.local-auth-modal .local-auth-msg {
  margin-top: 12px;
  min-height: 1.2em;
  font-size: 13px;
  color: #c00;
  text-align: center;
}

.local-auth-modal .local-auth-msg.ok {
  color: #15803d;
}

/* ——— Профиль: сетка колонок ——— */
.profile-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px 20px;
  align-items: start;
  margin-top: 4px;
}

/* Планшет: две колонки, уведомления на всю ширину */
@media (min-width: 640px) and (max-width: 899px) {
  .profile-modal-grid {
    grid-template-columns: 1fr 1fr;
  }
  .profile-modal-col--notifications {
    grid-column: 1 / -1;
  }
}

/* Десктоп: три колонки в ряд */
@media (min-width: 900px) {
  .profile-modal-grid {
    grid-template-columns: minmax(210px, 1.05fr) minmax(200px, 0.95fr) minmax(230px, 1fr);
  }
}

.profile-modal-col {
  min-width: 0;
}

.profile-modal-body {
  margin: 0;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lam-text);
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  background: var(--lam-bg-elevated);
  border: 1px solid var(--lam-border);
  border-radius: var(--lam-radius-sm);
  max-height: min(42vh, 320px);
  overflow-y: auto;
}

.profile-modal-subheading {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--lam-text);
  letter-spacing: -0.01em;
}

.profile-modal-muted {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--lam-muted);
}

.profile-modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--lam-muted);
  margin-bottom: 4px;
}

/* Слайдеры: видимая дорожка + градиент (WebKit / Firefox) */
.profile-modal-range {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  height: 32px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.profile-modal-range:focus {
  outline: none;
}

.profile-modal-range:focus-visible {
  outline: 2px solid var(--lam-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.profile-modal-range::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

#profile-modal-cube-mix::-webkit-slider-runnable-track {
  background: linear-gradient(to right, #e8dcc8 0%, #d4b896 50%, var(--lam-gold) 100%);
}

#profile-modal-cube-hue::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    #e62828,
    #e6c628,
    #28e628,
    #28d0e6,
    #3b28e6,
    #c828e6,
    #e62828
  );
}

.profile-modal-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--lam-gold);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.profile-modal-range::-moz-range-track {
  height: 10px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

#profile-modal-cube-mix::-moz-range-track {
  background: linear-gradient(to right, #e8dcc8 0%, #d4b896 50%, var(--lam-gold) 100%);
}

#profile-modal-cube-hue::-moz-range-track {
  background: linear-gradient(
    to right,
    #e62828,
    #e6c628,
    #28e628,
    #28d0e6,
    #3b28e6,
    #c828e6,
    #e62828
  );
}

.profile-modal-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--lam-gold);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.profile-modal-range::-moz-range-progress {
  background: transparent;
}

.profile-modal-cube-tint {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--lam-border);
  border-radius: var(--lam-radius-sm);
  background: var(--lam-bg-elevated);
}

.profile-modal-cube-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.profile-modal-cube-preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--lam-border);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.profile-modal-notifications {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--lam-border);
  border-radius: var(--lam-radius-sm);
  background: var(--lam-bg-elevated);
}

.profile-modal-unread {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--lam-muted);
  display: none;
}

.profile-modal-notifications-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  max-height: min(38vh, 280px);
  overflow-y: auto;
}

.profile-modal-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--lam-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-modal-yookassa-text {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lam-text);
}

.profile-modal-yookassa-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 540px) {
  .profile-modal-yookassa-actions {
    grid-template-columns: 1fr;
  }
}

.profile-modal-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--lam-radius-sm);
  padding: 10px 14px;
  border: none;
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.profile-modal-btn:active {
  transform: scale(0.99);
}

.profile-modal-btn--block {
  width: 100%;
  box-sizing: border-box;
}

.profile-modal-btn--secondary {
  border: 1px solid var(--lam-border);
  background: rgba(0, 0, 0, 0.03);
  color: var(--lam-text);
}

.profile-modal-btn--secondary:hover {
  background: rgba(0, 0, 0, 0.06);
}

.profile-modal-btn--pay {
  background: #1e7a3a;
  color: #fff;
  padding: 12px 14px;
  font-weight: 700;
}

.profile-modal-btn--pay:hover {
  filter: brightness(1.06);
}

.profile-modal-btn--ghost {
  border: 1px solid var(--lam-border);
  background: var(--lam-bg-elevated);
  color: var(--lam-text);
}

.profile-modal-btn--shop {
  background: var(--lam-gold);
  color: #1d1d1b;
  padding: 13px 16px;
  font-weight: 700;
  font-size: 15px;
}

.profile-modal-btn--shop:hover {
  filter: brightness(1.05);
}

#profile-modal-error,
.profile-modal-error {
  margin: 0;
  font-size: 13px;
  color: #b91c1c;
  padding: 10px 12px;
  background: rgba(185, 28, 28, 0.08);
  border-radius: var(--lam-radius-sm);
  border: 1px solid rgba(185, 28, 28, 0.2);
}
