/* ==========================================================================
   Auth — Page-specific layout and styles
   ========================================================================== */

/* Layout shell */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3.8vw, 28px);
}
.sheet {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  animation: fadeIn var(--d-fade) var(--ease) both;
}
.frame {
  padding: clamp(20px, 4.6vw, 32px);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.mode .chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}

/* Story + Tabs */
.story {
  margin-top: var(--space-2);
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
  display: grid;
  gap: var(--space-2);
}
.story p {
  margin: 0;
  line-height: 1.75;
  color: #e9e9e9;
}
.mini-tabs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
  flex-wrap: wrap;
}

.t {
  border: 1px solid var(--line);
  background: #202020;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.t:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}
.t.primary {
  background: var(--accent);
  color: #1b1b1b;
  border: none;
}
.step {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}

/* OAuth */
.oauth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
@media (max-width: 420px) {
  .oauth {
    grid-template-columns: 1fr;
  }
}
.oauth a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: #1b1b1b;
  background: var(--accent);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease),
    opacity 200ms var(--ease);
  position: relative;
  line-height: 1;
  white-space: nowrap;
}
.oauth a:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}
.oauth svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.oauth .spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.28);
  border-top-color: transparent;
  display: none;
  animation: spin 700ms linear infinite;
  flex: 0 0 auto;
}
.oauth .loading .spinner {
  display: inline-block;
}
.oauth .loading .oauth-label {
  opacity: 0.6;
}

/* Status Banner */
#status {
  min-height: 0;
  margin-top: var(--space-2);
}
.feedback {
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 1;
  transition: opacity 350ms var(--ease);
}
.feedback.fade {
  opacity: 0;
}
.ok {
  background: rgba(163, 177, 138, 0.12);
  border: 1px solid rgba(163, 177, 138, 0.28);
  color: #e9e9e9;
}
.err {
  background: rgba(255, 96, 96, 0.1);
  border: 1px solid rgba(255, 96, 96, 0.22);
  color: #ffdede;
}
.sheet.shake {
  animation: shake 220ms ease;
}

/* Form Shell */
.form {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-3);
}
.row2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: end;
}
.tools {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  min-height: 40px;
}
.tools .btn {
  flex-shrink: 0;
}

/* OTP strip */
.otp {
  display: none;
  margin-top: var(--space-2);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1f1f1f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono",
    monospace;
  font-weight: 800;
  color: var(--accent);
}
.otp .tools {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.otp .btn {
  min-width: 72px;
}

/* Footer actions */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: 2px;
}
.key {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #1b1b1b;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease),
    opacity 180ms var(--ease);
}
.key:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}
.key[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}
.key svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.key-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.26);
  border-top-color: transparent;
  display: none;
  animation: spin 700ms linear infinite;
}
.key.loading .key-spinner {
  display: inline-block;
}
.links {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* Create Account Layout */
#groupRegister .reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
  animation: fadeSlideIn var(--d-slide) var(--ease) both;
  margin-top: 2px;
}
#groupRegister .reg-col {
  display: grid;
  gap: var(--space-2);
}
#groupRegister .tight {
  margin-top: 0;
}
#groupRegister .row2.tight {
  gap: var(--space-2);
}
#groupRegister .helper.single-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
  min-height: 18px;
}
#groupRegister .strength-compact {
  margin-top: 6px;
}
#groupRegister .strength-compact .note-s {
  font-size: 12px;
}
#groupRegister label {
  margin-bottom: 6px;
}
@media (max-width: 680px) {
  #groupRegister .reg-grid {
    grid-template-columns: 1fr;
  }
  #groupRegister .helper.single-line {
    white-space: normal;
  }
  .tools {
    justify-content: flex-start;
  }
}

/* OTP / Reset specifics */
#groupOTP .field input {
  letter-spacing: 0.08em;
}
#groupReset .field + .field {
  margin-top: 6px;
}

/* Mobile spacing */
@media (max-width: 560px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  .key {
    width: 100%;
  }
}
