/* Login, registration and password pages — design system «ночная смена». Everything is scoped under .dh-auth. */
@font-face { font-family: "DH Hikasami"; src: url("/fonts/hikasami/Hikasami-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "DH Golos"; src: url("/fonts/golos/GolosText-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DH Golos"; src: url("/fonts/golos/GolosText-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DH Golos"; src: url("/fonts/golos/GolosText-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@property --dh-sa { syntax: "<angle>"; inherits: false; initial-value: 72deg; }

.dh-auth {
  --bg: #f3f6f9; --surface: #ffffff; --surface-2: #e9eff4; --surface-3: #dce5ed;
  --night: #0a1118; --night-2: #131e29; --night-3: #1b2836; --on-night: #eaf2f8; --on-night-muted: #93a5b5;
  --line: #d3dde6; --line-strong: #7f8fa0; --ink: #0b1117; --ink-2: #3e4c59; --muted: #5a6977;
  --brand: #1fa1f1; --brand-hover: #4fb6f5; --brand-strong: #0a6dad; --brand-soft: #dcf0fd; --on-brand: #03121d;
  --ai: #ffb224; --success: #0e7a53; --danger: #c4281c; --danger-soft: #fde5e3;
  --f-display: "DH Hikasami", "DH Golos", system-ui, sans-serif;
  --f-body: "DH Golos", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1); --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  background: var(--bg); color: var(--ink); font-family: var(--f-body); -webkit-font-smoothing: antialiased;
}
.dh-auth *, .dh-auth *::before, .dh-auth *::after { box-sizing: border-box; }
/* app.css sets fonts on a/button/label/p/h1/h2 directly; keep ours inside the auth pages */
.dh-auth a, .dh-auth button, .dh-auth label, .dh-auth p, .dh-auth li, .dh-auth input { font-family: var(--f-body); }
.dh-links p { margin: 0; font: 400 14.5px/20px var(--f-body); }
.dh-auth a { color: var(--brand-strong); text-decoration: none; font-weight: 500; }
.dh-auth a:hover { color: var(--ink); text-decoration: underline; }
.dh-auth :focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.dh-ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- night panel ---------- */
.dh-aside { position: relative; overflow: hidden; background: var(--night); color: var(--on-night); padding: 40px 48px; display: flex; flex-direction: column; gap: 32px; }
.dh-aside::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(234,242,248,.14) 1px, transparent 1.2px); background-size: 28px 28px; -webkit-mask-image: radial-gradient(80% 70% at 30% 30%, #000 30%, transparent 85%); mask-image: radial-gradient(80% 70% at 30% 30%, #000 30%, transparent 85%); pointer-events: none; }
.dh-aside::after { content: ""; position: absolute; left: -30%; bottom: -30%; width: 110%; height: 70%; background: radial-gradient(closest-side, rgba(255,178,36,.16), transparent); pointer-events: none; }
.dh-aside > * { position: relative; z-index: 1; }
.dh-aside-logo { display: inline-flex; align-self: flex-start; }
.dh-aside-logo img { height: 44px; width: auto; display: block; }
.dh-aside-body { display: flex; flex-direction: column; gap: 24px; margin-block: auto; }
.dh-aside-title { margin: 0; font: 600 44px/46px var(--f-display); letter-spacing: -.03em; color: var(--on-night); text-wrap: balance; }
.dh-lamp { color: var(--ai); text-shadow: 0 0 30px rgba(255,178,36,.45); }
.dh-aside-text { margin: 0; font: 400 16px/25px var(--f-body); color: var(--on-night-muted); max-width: 40ch; }
.dh-aside-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.dh-aside-list li { display: flex; align-items: flex-start; gap: 12px; font: 400 16px/23px var(--f-body); color: var(--on-night-muted); }
.dh-aside-list .dh-ic { color: var(--ai); margin-top: 1px; }
.dh-aside-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.dh-aside-steps li { display: flex; gap: 14px; align-items: flex-start; }
.dh-aside-steps li > span { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--night-2); border: 1px solid #22303f; font: 600 13px/1 ui-monospace, "SF Mono", Consolas, monospace; color: var(--brand); }
.dh-aside-steps b { display: block; font: 600 16px/22px var(--f-body); color: var(--on-night); }
.dh-aside-steps small { font: 400 14px/20px var(--f-body); color: var(--on-night-muted); }
.dh-aside-free { margin: 0; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 14px; border-radius: 999px; background: rgba(61,214,155,.12); color: #63e2b0; font: 600 13.5px/18px var(--f-body); }
.dh-aside-free .dh-ic { width: 16px; height: 16px; stroke-width: 2.2; }
.dh-aside-partner { margin: 0; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: rgba(19,30,41,.8); border: 1px solid #22303f; font: 400 13px/18px var(--f-body); color: var(--on-night-muted); }
.dh-aside-partner b { display: block; color: var(--on-night); font-weight: 600; font-size: 14px; }
.dh-aside-seal { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); }
.dh-aside-seal .dh-ic { width: 18px; height: 18px; stroke-width: 2.2; }

/* stopwatch (same as the site finale; pure CSS, GPU transforms) */
.dh-watch { position: relative; width: 132px; height: 140px; }
.dh-watch-crown { position: absolute; left: 50%; top: 0; width: 18px; height: 8px; margin-left: -9px; border-radius: 3px; background: var(--on-night); }
.dh-watch-face { position: absolute; left: 6px; top: 14px; width: 120px; height: 120px; border-radius: 50%; background: var(--night-2); border: 6px solid var(--on-night); }
.dh-watch-face::after { content: ""; position: absolute; inset: -16px; border-radius: 50%; border: 1.5px solid var(--ai); opacity: .3; animation: dh-halo 3.2s var(--ease-io) infinite; }
.dh-watch-sector { position: absolute; inset: 20%; border-radius: 50%; background: conic-gradient(var(--brand) 0 var(--dh-sa), transparent 0); animation: dh-sec 12s linear -2.4s infinite; }
.dh-watch-h, .dh-watch-m { position: absolute; left: 50%; bottom: 50%; border-radius: 4px; background: var(--on-night); transform-origin: 50% 100%; will-change: transform; }
.dh-watch-h { width: 6px; height: 28px; margin-left: -3px; animation: dh-turn 144s linear -38.4s infinite; }
.dh-watch-m { width: 5px; height: 42px; margin-left: -2.5px; animation: dh-turn 12s linear -2.4s infinite; }
.dh-watch-hub { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--ai); box-shadow: 0 0 0 3px var(--night-2); }
@keyframes dh-turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes dh-sec { from { --dh-sa: 0deg; } to { --dh-sa: 360deg; } }
@keyframes dh-halo { 0%, 100% { transform: scale(1); opacity: .3; } 50% { transform: scale(1.06); opacity: .05; } }

/* ---------- form side ---------- */
.dh-auth-main { display: flex; align-items: center; justify-content: center; padding: 48px max(24px, env(safe-area-inset-right, 0px)) 48px max(24px, env(safe-area-inset-left, 0px)); min-width: 0; }
.dh-card { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 22px; animation: dh-rise 700ms var(--ease) both; }
.dh-card--wide { max-width: 560px; }
@keyframes dh-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.dh-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; margin-left: -6px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font: 500 14px/20px var(--f-body); cursor: pointer; }
.dh-back:hover { background: var(--surface-2); color: var(--ink); }
.dh-back .dh-ic { width: 18px; height: 18px; }
.dh-head { display: flex; flex-direction: column; gap: 8px; }
.dh-title { margin: 0; font: 600 38px/42px var(--f-display); letter-spacing: -.025em; color: var(--ink); text-wrap: balance; }
.dh-sub { margin: 0; font: 400 16px/24px var(--f-body); color: var(--ink-2); }
.dh-group { display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(11,17,23,.05); }
.dh-group-h { display: flex; align-items: center; gap: 10px; font: 600 12px/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
.dh-group-h span { font: 600 12px/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 0; color: var(--brand-strong); background: var(--brand-soft); border-radius: 6px; padding: 4px 6px; }
.dh-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.dh-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dh-field > label, .dh-label { font: 500 14px/20px var(--f-body); color: var(--ink); }
.dh-hint { margin: 0; font: 400 13px/18px var(--f-body); color: var(--muted); }
.dh-err { margin: 0; min-height: 0; font: 500 13px/18px var(--f-body); color: var(--danger); }
.dh-err:empty { display: none; }
.dh-input-wrap { position: relative; }
.dh-auth .dh-input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: 400 16px/20px var(--f-body); transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease); }
.dh-auth .dh-input::placeholder { color: var(--muted); opacity: 1; }
.dh-auth .dh-input:hover { border-color: var(--ink-2); }
.dh-auth .dh-input:focus { outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 4px var(--brand-soft); }
.dh-auth .dh-input--invalid, .dh-auth .dh-input--invalid:hover { border-color: var(--danger); background: var(--danger-soft); }
.dh-input--pad { padding-right: 52px !important; }
.dh-eye { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.dh-eye:hover { background: var(--surface-2); color: var(--ink); }
.dh-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.dh-seg button { height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font: 600 15px/20px var(--f-body); cursor: pointer; transition: background-color 220ms var(--ease), color 120ms, box-shadow 220ms var(--ease); }
.dh-seg button:hover { color: var(--ink); }
.dh-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11,17,23,.08), 0 4px 12px -4px rgba(11,17,23,.12); }
.dh-help { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); font: 400 13.5px/20px var(--f-body); color: var(--ink-2); }
.dh-help .dh-ic { color: var(--brand-strong); margin-top: 1px; width: 18px; height: 18px; }
.dh-check { display: flex; gap: 12px; align-items: flex-start; font: 400 14px/21px var(--f-body); color: var(--ink-2); cursor: pointer; }
.dh-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand-strong); cursor: pointer; }
.dh-actions { display: flex; flex-direction: column; gap: 14px; }
.dh-alert { margin: 0; padding: 12px 14px; border-radius: 14px; font: 500 14px/20px var(--f-body); }
.dh-alert:empty { display: none; }
.dh-alert--err { background: var(--danger-soft); color: var(--danger); }
.dh-alert--ok { background: #dcf4e9; color: var(--success); }
.dh-auth .dh-submit { position: relative; height: 54px; border: 0; border-radius: 14px; background: var(--brand); color: var(--on-brand); font: 600 16.5px/20px var(--f-body); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 0 0 1px rgba(31,161,241,.4), 0 14px 36px -12px rgba(31,161,241,.6); transition: background-color 120ms var(--ease), transform 120ms var(--ease); }
.dh-auth .dh-submit:hover { background: var(--brand-hover); }
.dh-auth .dh-submit:active { transform: translateY(1px); }
.dh-auth .dh-submit:disabled { opacity: .7; cursor: progress; }
.dh-submit .dh-ic { transition: transform 220ms var(--ease); }
.dh-submit:hover .dh-ic { transform: translateX(3px); }
.dh-spin { width: 22px; height: 22px; display: block; }
.dh-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font: 400 14.5px/20px var(--f-body); color: var(--ink-2); }
.dh-links p { margin: 0; }
.dh-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 400 13px/18px var(--f-body); }
.dh-sep::before, .dh-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 1020px) {
  .dh-auth { grid-template-columns: minmax(0, 1fr); }
  .dh-aside { padding: 20px max(20px, env(safe-area-inset-left, 0px)); gap: 0; flex-direction: row; align-items: center; }
  .dh-aside-body, .dh-aside-partner { display: none; }
  .dh-aside-logo img { height: 36px; }
  .dh-auth-main { align-items: flex-start; padding-top: 28px; }
  .dh-title { font-size: 32px; line-height: 36px; }
}
@media (max-width: 520px) {
  .dh-row2 { grid-template-columns: minmax(0, 1fr); }
  .dh-group { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .dh-auth *, .dh-auth *::before, .dh-auth *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* registration: shop found from ID + API key */
.dh-shop { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px dashed var(--line-strong); background: var(--bg); transition: border-color 220ms var(--ease), background-color 220ms var(--ease), box-shadow 220ms var(--ease); }
.dh-shop--found { border: 1.5px solid var(--success); background: #f1fbf6; box-shadow: 0 10px 30px -16px rgba(14,122,83,.45); animation: dh-pop 500ms var(--ease) both; }
.dh-shop--error { border: 1.5px solid var(--danger); background: var(--danger-soft); }
.dh-shop--checking { border-style: solid; border-color: var(--brand); }
@keyframes dh-pop { from { transform: scale(.98); } to { transform: none; } }
.dh-shop-av { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--night); color: var(--ai); font: 600 20px/1 var(--f-display); }
.dh-shop-av--idle { background: var(--surface-2); }
.dh-shop-av--wait { background: var(--brand-soft); color: var(--brand-strong); }
.dh-shop-av--err { background: var(--danger); color: #fff; }
.dh-shop-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dh-shop-txt b { font: 600 16px/22px var(--f-body); color: var(--ink); overflow-wrap: anywhere; }
.dh-shop-txt small { font: 400 13px/18px var(--f-body); color: var(--ink-2); }
.dh-shop-ok { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: #dcf4e9; color: var(--success); font: 600 12.5px/16px var(--f-body); }
.dh-shop-ok .dh-ic { width: 14px; height: 14px; stroke-width: 2.4; }
.dh-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); font: 500 13.5px/19px var(--f-body); color: var(--brand-strong); }
.dh-auth .dh-linkbtn { align-self: flex-start; border: 0; background: transparent; padding: 0; color: var(--brand-strong); font: 500 14px/20px var(--f-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dh-auth .dh-linkbtn:hover { color: var(--ink); }

/* «Как получить API-ключ» (/api-key) — public help page in the auth frame. */
.dh-key { gap: 24px; } .dh-key .dh-back { text-decoration: none; align-self: flex-start; }
.dh-key-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.dh-key-steps li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; }
.dh-key-steps li > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); font: 600 13px/1 ui-monospace, "SF Mono", Consolas, monospace; }
.dh-key-steps b { display: block; font: 600 16px/22px var(--f-body); color: var(--ink); margin-top: 2px; }
.dh-key-steps p { margin: 4px 0 0; font: 400 15px/23px var(--f-body); color: var(--ink-2); } .dh-key-steps a, .dh-key .dh-links a { color: var(--brand-strong); font-weight: 500; }
.dh-key-go { flex-direction: column; align-items: stretch; gap: 12px; } .dh-key-go .dh-submit { display: flex; align-items: center; justify-content: center; text-decoration: none; } .dh-key-go .dh-links { display: block; margin: 0; text-align: center; }
.dh-key-why { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); } .dh-key-why h2 { margin: 0 0 6px; font: 600 15px/21px var(--f-body); color: var(--ink); } .dh-key-why p { margin: 0; font: 400 14.5px/22px var(--f-body); color: var(--ink-2); }
.dh-key-steps p b { display: inline; font: inherit; font-weight: 600; margin: 0; color: var(--ink); }
.dh-key .dh-help b { color: var(--ink); font-weight: 600; }
