@import url("/static/fonts/comfortaa.css");

/* NewMood SPA Auth shell (OauthIcons + neu) — shared across nya / zam / zad */
:root {
  --ux-accent: #c24a36;
  --ux-accent-soft: #df7b6a;
  --ux-accent-wash: rgba(194, 74, 54, 0.12);
  --ink: #0a0a0a;
  --ink-soft: #3d3d3d;
  --muted: #6b6b6b;
  --neu-bg: #ebe8e6;
  --line: rgba(10, 10, 10, 0.06);
  --neu:
    3px 3px 5px rgba(10, 10, 10, 0.14),
    -3px -3px 5px rgba(255, 255, 255, 0.95);
  --neu-sm:
    2px 2px 3px rgba(10, 10, 10, 0.12),
    -2px -2px 3px rgba(255, 255, 255, 0.92);
  --neu-in:
    inset 2px 2px 4px rgba(10, 10, 10, 0.12),
    inset -2px -2px 4px rgba(255, 255, 255, 0.9);
  /* Neutral so brand accents (ink Блокнотик / terracotta NewMood) both read well */
  --neu-accent:
    3px 3px 6px rgba(10, 10, 10, 0.22),
    -2px -2px 4px rgba(255, 255, 255, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Comfortaa, system-ui, sans-serif;
  color: var(--ink);
  background: var(--neu-bg);
  color-scheme: light;
}

/* Match app home surface so browser theme-color / chrome align with the page */
body.ux-auth[data-brand="zam"],
body.ux-auth[data-brand="zad"] {
  --neu-bg: #f6eadf;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.auth-shell, .profile-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 24px;
  gap: 18px;
}

.auth-card, .profile-card {
  width: min(420px, 100%);
  background: var(--neu-bg);
  border: none;
  border-radius: 28px;
  box-shadow: var(--neu);
  padding: 28px 24px 22px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  margin-bottom: 14px;
}

.auth-logo {
  width: 108px;
  height: 108px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 8px 18px rgba(10, 10, 10, 0.12));
}

.brand-text { text-align: center; }
.brand-name {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  /* Same token as logo / .btn.primary */
  color: var(--ux-accent);
}
.brand-tagline { display: none; }

h1 { font-size: 1.55rem; margin: 0 0 16px; }
h2 { font-size: 1rem; margin: 0 0 12px; }

.field { display: block; margin-bottom: 12px; position: relative; }
.field input, .stack input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: var(--neu-bg);
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  outline: none;
  box-shadow: var(--neu-in);
}
.field input:focus, .stack input:focus {
  border-color: rgba(215, 87, 64, 0.35);
  box-shadow: var(--neu-in), 0 0 0 3px var(--ux-accent-wash);
}

.pw-field { position: relative; }
.pw-field input { padding-right: 48px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle svg { display: block; }

/* Picture CAPTCHA (after 3 sends): image + refresh, answer field below. */
.captcha-box[hidden] { display: none; }
.captcha-pic {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
}
.captcha-img {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 264px;
  height: auto;
  aspect-ratio: 3 / 1;
  border-radius: 14px;
  box-shadow: var(--neu-in);
  background: #eee;
  user-select: none;
  -webkit-user-drag: none;
}
.captcha-refresh {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--neu-bg);
  /* raised button (sinks in only while pressed); the picture beside it stays a sunken well */
  box-shadow: var(--neu-sm);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: box-shadow 0.15s ease, color 0.15s ease;
}
.captcha-refresh:hover { color: var(--ux-accent); }
.captcha-refresh:active { box-shadow: var(--neu-in); }
.captcha-box input[name="captcha_answer"] { text-transform: uppercase; letter-spacing: 0.12em; }
.captcha-box input[name="captcha_answer"]::placeholder { text-transform: none; letter-spacing: 0; }

/* Consent is a plain row (checkbox + text) — no sunken panel around it. */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 14px;
  padding: 2px 4px;
  cursor: pointer;
}
.consent input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--ux-accent);
}
.consent-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}
.consent-text a {
  color: var(--ux-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.consent-text a:hover {
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: calc(1.15rem - 4px);
  letter-spacing: -0.02em;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.btn.primary {
  width: 100%;
  background: var(--ux-accent);
  color: #fff;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--neu-accent);
}
.btn.primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1; min-width: 120px; }

.auth-switch { text-align: center; color: var(--muted); margin: 16px 0 0; }
.auth-switch a { color: var(--ux-accent); font-weight: 700; text-decoration: none; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
  border: 0;
}
.oauth-label {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
.oauth-row {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  justify-content: center;
  margin-top: 10px;
}
.oauth-btn {
  width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
  color: #fff;
  background: #fff;
  box-shadow: var(--neu-sm);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.oauth-btn .oauth-icon {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}
.oauth-btn.yandex {
  background: #fc3f1d;
  color: #fff;
  box-shadow: 0 8px 18px rgba(252, 63, 29, 0.28);
}
.oauth-btn.vk {
  background: #0077ff;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 119, 255, 0.28);
}
.oauth-btn.mailru {
  background: #005ff9;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 95, 249, 0.28);
}
.oauth-btn.sber {
  background: #21a038;
  color: #fff;
  box-shadow: 0 8px 18px rgba(33, 160, 56, 0.28);
}
.oauth-btn.tg {
  background: #2aabee;
  color: #fff;
  box-shadow: 0 8px 18px rgba(42, 171, 238, 0.28);
}
.oauth-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.error-banner {
  background: var(--ux-accent-wash);
  border: 1px solid rgba(215, 87, 64, 0.28);
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
  font-size: 0.92rem;
}

.site-footer {
  width: min(420px, 100%);
  text-align: center;
  padding: 4px 8px 8px;
}
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  font-size: 0.82rem;
  line-height: 1.4;
}
.site-footer-links + .site-footer-links { margin-top: 6px; }
.site-footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer-links a:hover {
  color: var(--ux-accent);
  text-decoration: underline;
}
.site-footer-sep { color: var(--muted); opacity: 0.55; }
/* accounts.js tidyFooterSeps: a «·» left at the start/end of a wrapped line */
.site-footer-sep.is-edge { display: none; }
.site-footer-sep.is-edge-soft { visibility: hidden; }
.site-footer-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.muted { color: var(--muted); }
.profile-top {
  width: min(420px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto 14px;
}
.back-link, .brand-mini {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.brand-mini img { width: 36px; height: 36px; object-fit: contain; border-radius: 10px; }

.profile-hero { text-align: center; margin-bottom: 18px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; background: var(--ux-accent-wash);
  border: 3px solid rgba(255,255,255,0.8);
}
.panel {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.panel.quiet { border-top: 1px solid var(--line); }
.stack { display: grid; gap: 10px; }
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.avatar-opt {
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 4px;
  background: rgba(255,255,255,0.55);
  cursor: pointer;
}
.avatar-opt.is-selected { border-color: var(--ux-accent); }
.avatar-opt img { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; }
.logout-confirm { margin-top: 10px; }
.toast {
  position: sticky;
  bottom: 8px;
  margin-top: 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

@media (max-width: 480px) {
  .auth-card, .profile-card { padding: 22px 16px 18px; }
  .auth-logo { width: 96px; height: 96px; }
  .brand-name { font-size: 1.75rem; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

/* newmood (brand nya): consent is a plain row — no box around the checkbox and text; primary buttons get
   larger, heavier text (Comfortaa tops out at 700, so a hairline stroke adds the extra weight). */
body.ux-auth[data-brand="nya"] .consent {
  padding: 2px 4px;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body.ux-auth[data-brand="nya"] .btn.primary {
  font-size: 1.1rem;
  letter-spacing: 0;
  -webkit-text-stroke: 0.35px currentColor;
}

/* newmood (brand nya): checkboxes are sunken neumorphic wells; ticked = accent check inside (stays inset). */
body[data-brand="nya"] input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin: -1px 0 0;
  flex-shrink: 0;
  border: none;
  border-radius: 7px;
  background: var(--neu-bg) center / 15px 15px no-repeat;
  box-shadow: var(--neu-in);
  cursor: pointer;
  transition: box-shadow 0.18s ease;
}
body[data-brand="nya"] input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c24a36' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  box-shadow: inset 2px 2px 5px rgba(10, 10, 10, 0.18), inset -2px -2px 4px rgba(255, 255, 255, 0.9);
}
body[data-brand="nya"] input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(194, 74, 54, 0.45);
  outline-offset: 2px;
}

/* newmood (brand nya) login/register: roomier rhythm. Groups: brand → fields → consent → CTA → social → switch;
   bigger gaps between groups than inside them, and «Уже с нами? Войти» clear of the social buttons' glow. */
body.ux-auth[data-brand="nya"] .auth-card {
  padding: 34px 28px 30px;
}
body.ux-auth[data-brand="nya"] .brand-lockup {
  gap: 12px;
  margin-bottom: 26px;
}
body.ux-auth[data-brand="nya"] .error-banner {
  margin-bottom: 18px;
}
body.ux-auth[data-brand="nya"] .field {
  margin-bottom: 14px;
}
body.ux-auth[data-brand="nya"] .consent {
  margin: 8px 0 24px;
  gap: 12px;
}
body.ux-auth[data-brand="nya"] .consent-text {
  line-height: 1.55;
}
body.ux-auth[data-brand="nya"] .btn.primary {
  min-height: 56px;
  margin-top: 0;
}
body.ux-auth[data-brand="nya"] .divider {
  margin: 30px 0 22px;
}
body.ux-auth[data-brand="nya"] .oauth-label {
  margin: 0;
}
body.ux-auth[data-brand="nya"] .oauth-row {
  gap: 18px;
  margin-top: 16px;
}
body.ux-auth[data-brand="nya"] .auth-switch {
  margin: 34px 0 0;
  font-size: 1rem;
}
body.ux-auth[data-brand="nya"] .auth-switch a {
  display: inline-block;
  margin: -8px -6px -8px 0;
  padding: 8px 6px 8px 2px;
}
@media (max-width: 420px) {
  body.ux-auth[data-brand="nya"] .auth-card {
    padding: 30px 22px 26px;
  }
}

/* newmood (brand nya) login/register: the footer sits 15px above the bottom edge (plus the home-indicator
   inset) and the card is centred in the space above it. Card + footer taller than the screen → the auto
   margins collapse and the page scrolls with the footer right after the card. */
body.ux-auth[data-brand="nya"] {
  --auth-vh: 1vh;
}
@supports (height: 1svh) {
  /* small viewport = phone browser bars shown, so the fit holds before any scroll */
  body.ux-auth[data-brand="nya"] { --auth-vh: 1svh; }
}
body.ux-auth[data-brand="nya"] .auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  justify-content: flex-start;
  gap: 20px;
  padding: 20px 16px 15px;
  padding:
    max(env(safe-area-inset-top, 0px), clamp(12px, 4.44 * var(--auth-vh) - 18.2px, 20px))
    max(env(safe-area-inset-right, 0px), 16px)
    calc(15px + env(safe-area-inset-bottom, 0px))
    max(env(safe-area-inset-left, 0px), 16px);
}
body.ux-auth[data-brand="nya"] .auth-card {
  margin: auto 0;
}
body.ux-auth[data-brand="nya"] .site-footer {
  width: min(560px, 100%);
  padding: 0 8px;
}

/* Short screens (phone browsers, 768px laptops): the vertical rhythm eases from the roomy values at ≥860px
   of viewport height down to a compact set at ≤680px, so card + footer still fit one screen. */
body.ux-auth[data-brand="nya"] .auth-shell {
  gap: clamp(14px, 3.33 * var(--auth-vh) - 8.7px, 20px);
}
body.ux-auth[data-brand="nya"] .auth-card {
  padding-top: clamp(22px, 6.67 * var(--auth-vh) - 23.3px, 34px);
  padding-bottom: clamp(20px, 5.56 * var(--auth-vh) - 17.8px, 30px);
}
body.ux-auth[data-brand="nya"] .auth-logo {
  width: clamp(72px, 20 * var(--auth-vh) - 64px, 108px);
  height: clamp(72px, 20 * var(--auth-vh) - 64px, 108px);
}
body.ux-auth[data-brand="nya"] .brand-lockup {
  gap: clamp(8px, 2.22 * var(--auth-vh) - 7.1px, 12px);
  margin-bottom: clamp(16px, 5.56 * var(--auth-vh) - 21.8px, 26px);
}
body.ux-auth[data-brand="nya"] .divider {
  margin: clamp(18px, 6.67 * var(--auth-vh) - 27.3px, 30px) 0 clamp(14px, 4.44 * var(--auth-vh) - 16.2px, 22px);
}
body.ux-auth[data-brand="nya"] .oauth-row {
  margin-top: clamp(12px, 2.22 * var(--auth-vh) - 3.1px, 16px);
}
body.ux-auth[data-brand="nya"] .auth-switch {
  margin-top: clamp(20px, 7.78 * var(--auth-vh) - 32.9px, 34px);
}
@media (max-width: 480px) {
  body.ux-auth[data-brand="nya"] .auth-logo {
    width: clamp(72px, 20 * var(--auth-vh) - 64px, 96px);
    height: clamp(72px, 20 * var(--auth-vh) - 64px, 96px);
  }
  /* phone footer: full width (the legal row fits one line down to 375px), each link gets a ≥24px-tall
     tap row (WCAG 2.5.8), rows stay tight */
  body.ux-auth[data-brand="nya"] .site-footer {
    align-self: stretch;
    width: auto;
    margin: 0 -8px;
    padding: 0;
  }
  body.ux-auth[data-brand="nya"] .site-footer-links {
    gap: 0 7px;
    font-size: 0.78rem;
  }
  body.ux-auth[data-brand="nya"] .site-footer-links a { padding: 4px 0; }
  body.ux-auth[data-brand="nya"] .site-footer-links + .site-footer-links { margin-top: 0; }
  body.ux-auth[data-brand="nya"] .site-footer-copy { margin-top: 6px; }
}
@media (max-width: 420px) {
  body.ux-auth[data-brand="nya"] .auth-card {
    padding-top: clamp(22px, 6.67 * var(--auth-vh) - 23.3px, 30px);
    padding-bottom: clamp(20px, 5.56 * var(--auth-vh) - 17.8px, 26px);
  }
}

/* newmood (brand nya): «© Дневник Эмоций 2026» in bold, same as the app footer */
body[data-brand="nya"] .site-footer-copy {
  font-weight: 700;
}

/* newmood (brand nya): offer/privacy line under the consent box and under the social buttons. */
.consent-note {
  margin: -12px 4px 22px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}
.consent-note a {
  color: var(--ux-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.consent-note.oauth-note {
  margin: 16px 4px 0;
  text-align: center;
}
