:root {
  --text-main: #f4f7ff;
  --text-dim: rgba(229, 236, 255, 0.75);
  --magenta: #ba47ff;
  --cyan-strong: #00a7ff;
  --flow-font-family: "Roboto", sans-serif;
  --flow-primary-bg: linear-gradient(135deg, #2764ff 0%, #675bff 58%, #9165ff 100%);
  --flow-primary-shadow: 0 18px 40px rgba(39, 100, 255, 0.26);
  --flow-primary-focus: 3px solid rgba(70, 113, 255, 0.3);
  --flow-secondary-bg: rgba(255, 255, 255, 0.06);
  --flow-secondary-bg-hover: rgba(255, 255, 255, 0.12);
  --flow-secondary-border: rgba(255, 255, 255, 0.16);
  --flow-secondary-border-hover: rgba(255, 255, 255, 0.3);
  --flow-success-color: #8fffd8;
  --flow-button-color: var(--text-main);
  --flow-button-font-size: 0.95rem;
  --flow-button-font-weight: 500;
  --flow-button-letter-spacing: 0.01em;
  --flow-button-min-height: 48px;
  --flow-button-radius: 999px;
  --flow-button-padding: 0 24px;
  --flow-button-transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.flow-modal[hidden] {
  display: none;
}

.flow-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.flow-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 28, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.flow-panel {
  position: relative;
  z-index: 1;
  width: min(492px, 100%);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(12, 18, 52, 0.96), rgba(17, 9, 45, 0.96));
  box-shadow: 0 24px 80px rgba(2, 6, 22, 0.45);
  font-family: var(--flow-font-family);
  padding: 48px 24px;
}

#legal-modal .flow-panel {
  width: min(800px, 100%);
}

.flow-back,
.flow-close {
  appearance: none;
  position: absolute;
  top: 8px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
}

.flow-back {
  left: 8px;
  background: transparent url("../images/Icon_back.svg") center / 28px 28px no-repeat;
}

.flow-close {
  right: 8px;
  background: transparent url("../images/Icon_close.svg") center / 28px 28px no-repeat;
}

.flow-back:hover,
.flow-back:focus-visible,
.flow-close:hover,
.flow-close:focus-visible {
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.flow-close:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.flow-header {
  display: grid;
  gap: 10px;
}

#sdk-modal .flow-header,
#sdk-modal .sdk-code-field,
#sdk-modal .flow-actions,
#verification-modal .flow-header,
#signout-confirmation-modal .flow-header,
#verification-modal .flow-divider,
#verification-modal .flow-progress,
#verification-modal .flow-consent-notice,
#verification-modal .flow-google-row,
#verification-modal .flow-actions,
#verification-modal .flow-inline-action,
#verification-modal .avatar-limit-copy,
#verification-modal #avatar-limit-feedback,
#verification-modal #avatar-limit-sections,
#signout-confirmation-modal .flow-actions {
  width: min(100%, 400px);
  margin-right: auto;
  margin-left: auto;
}

.flow-eyebrow {
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(197, 211, 255, 0.7);
}

.flow-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2rem);
  line-height: 1.06;
}

.flow-header p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
}

.flow-field {
  display: grid;
  gap: 8px;
  width: min(100%, 400px);
  margin-top: 18px;
  margin-right: auto;
  margin-left: auto;
}

.flow-field span {
  font-size: 0.9rem;
  color: rgba(232, 238, 255, 0.92);
}

.flow-field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(5, 11, 32, 0.88);
  color: var(--text-main);
  font: inherit;
}

.flow-field input[readonly] {
  opacity: 0.82;
}

.flow-field input:focus {
  outline: 2px solid rgba(0, 167, 255, 0.5);
  outline-offset: 2px;
}

.flow-google-row {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.flow-google-row[hidden] {
  display: none;
}

.flow-google-button {
  position: relative;
  display: block;
  width: 100%;
  height: 48px;
  margin: 0 auto;
}

.flow-google-native {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
}

.flow-google-native > div,
.flow-google-native iframe {
  width: 100% !important;
  height: 100% !important;
}

.flow-google-native iframe {
  width: 100% !important;
  height: 48px !important;
}

.is-safari .flow-google-button {
  overflow: hidden;
  border-radius: var(--flow-button-radius);
}

.is-safari .flow-google-native {
  display: block !important;
  pointer-events: auto;
}

.is-safari .flow-google-native > div,
.is-safari .flow-google-native iframe {
  display: block !important;
  min-width: 100% !important;
  min-height: 100% !important;
  width: 400px !important;
  max-width: 100% !important;
}

.is-safari .flow-google-native iframe {
  min-height: 48px !important;
  border: 0 !important;
}

.flow-google-block {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: not-allowed;
  border-radius: var(--flow-button-radius);
}

.flow-google-button.is-blocked .flow-google-block {
  display: block;
}

.flow-google-custom {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 48px;
  border: 1px solid var(--flow-secondary-border);
  border-radius: var(--flow-button-radius);
  background: var(--flow-secondary-bg);
  color: var(--flow-button-color);
  font-family: var(--flow-font-family);
  font-size: var(--flow-button-font-size);
  font-weight: var(--flow-button-font-weight);
  letter-spacing: var(--flow-button-letter-spacing);
  padding: 0 20px;
  pointer-events: none;
  transition: var(--flow-button-transition);
}

.flow-google-button:hover .flow-google-custom,
.flow-google-button:focus-within .flow-google-custom {
  background: var(--flow-secondary-bg-hover);
  border-color: var(--flow-secondary-border-hover);
}

.flow-google-logo {
  width: 20px;
  height: 20px;
}

.flow-google-custom span {
  text-align: center;
}

.flow-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  color: rgba(232, 238, 255, 0.6);
  font-size: 0.86rem;
  line-height: 1;
}

.flow-divider::before,
.flow-divider::after {
  content: "";
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
}

.flow-consent-notice {
  margin: 12px 0 0;
  color: rgba(229, 236, 255, 0.74);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.flow-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.flow-link-button:hover,
.flow-link-button:focus-visible {
  color: inherit;
  outline: none;
}

.flow-legal-links {
  margin-top: 14px;
}

.flow-checkbox {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 14px;
  color: rgba(229, 236, 255, 0.88);
  font-size: 0.92rem;
  line-height: 1.5;
}

.flow-checkbox input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #57b8ff;
}

.flow-checkbox span {
  color: inherit;
}

.flow-checkbox.is-error span {
  color: #ffb4c4;
}

.flow-legal-frame {
  margin-top: 24px;
  max-height: min(540px, calc(100vh - 240px));
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(7, 12, 34, 0.62);
  overflow: hidden;
}

.flow-legal-panel-copy {
  display: grid;
  gap: 22px;
  max-height: inherit;
  min-height: 0;
  overflow: auto;
  padding: 22px 34px 22px 24px;
}

.flow-legal-section {
  min-width: 0;
}

.flow-legal-section h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.flow-legal-section p {
  margin: 0 0 14px;
  color: rgba(229, 236, 255, 0.8);
  line-height: 1.6;
}

.flow-legal-section p:last-child {
  margin-bottom: 0;
}

.flow-legal-list {
  margin: 0 0 14px 1.2rem;
  padding: 0;
  color: rgba(229, 236, 255, 0.8);
  line-height: 1.6;
}

.flow-legal-list li + li {
  margin-top: 4px;
}

.flow-legal-link {
  color: #d8e8ff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.flow-legal-link:hover,
.flow-legal-link:focus-visible {
  color: #ffffff;
  outline: none;
}

#verification-code-input {
  width: 100%;
  min-height: 80px;
  margin: 0 auto;
  padding: 18px 20px;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.28em;
  text-align: center;
}

.flow-status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: rgba(229, 236, 255, 0.86);
}

.flow-status.is-error {
  color: #ffb4c4;
}

.flow-status.is-success {
  color: var(--flow-success-color);
}

.flow-status-static {
  min-height: 0;
  margin-top: 0;
}

.flow-progress {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.flow-progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flow-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--magenta), var(--cyan-strong));
  box-shadow: 0 0 18px rgba(181, 52, 255, 0.24), 0 0 24px rgba(36, 185, 255, 0.18);
  transition: width 0.2s ease;
}

.flow-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  color: rgba(229, 236, 255, 0.78);
}

#signup-complete-panel[hidden],
#auth-preparing-panel[hidden],
#avatar-limit-panel[hidden],
#discard-draft-panel[hidden],
#verification-workflow[hidden],
#verification-progress[hidden],
.flow-actions[hidden] {
  display: none;
}

.flow-loading-panel {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  min-height: 32px;
}

.flow-loading-spinner {
  width: 24px;
  height: 24px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(180, 208, 255, 0.28);
  animation: flow-loading-spin 0.85s linear infinite;
}

@keyframes flow-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.flow-step-label {
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(143, 255, 216, 0.84);
}

.flow-step-note {
  margin: 0 0 14px;
  color: rgba(229, 236, 255, 0.78);
}

.flow-complete-copy {
  display: none;
  gap: 10px;
  margin-top: 20px;
}

.flow-complete-copy .flow-step-label,
.flow-complete-copy .flow-step-note {
  margin: 0;
}

#verification-step-email[hidden],
#verification-step-code[hidden],
#verification-resend-row[hidden] {
  display: none;
}

.avatar-limit-copy {
  margin-top: 8px;
}

.avatar-limit-body {
  margin: 0;
  color: rgba(229, 236, 255, 0.8);
}

#avatar-limit-sections {
  display: grid;
  gap: 18px;
  margin-top: 20px;
  max-height: min(48vh, 420px);
  min-height: 0;
  overflow: hidden;
}

.avatar-limit-section {
  box-sizing: border-box;
  display: grid;
  gap: 20px;
  max-height: inherit;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 26px 18px 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 12, 34, 0.62);
}

.avatar-limit-group {
  display: grid;
}

.avatar-limit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar-limit-section h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.96);
}

.avatar-limit-grid {
  display: grid;
  grid-template-columns: repeat(4, 72px);
  justify-content: space-between;
  gap: 12px;
}

.avatar-limit-card {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.avatar-limit-card:hover,
.avatar-limit-card:focus-visible {
  transform: translateY(-1px) scale(1.01);
  border-color: rgba(255, 214, 10, 0.52);
  outline: none;
}

.avatar-limit-card.is-selected {
  border-width: 3px;
  border-color: rgba(255, 214, 10, 0.92);
  background: rgba(255, 214, 10, 0.16);
  box-shadow: 0 0 0 5px rgba(255, 214, 10, 0.12), 0 16px 28px rgba(4, 9, 24, 0.34);
}

.avatar-limit-card img,
.avatar-limit-fallback {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.avatar-limit-card img {
  display: block;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(93, 127, 255, 0.38), rgba(27, 218, 207, 0.28));
}

.avatar-limit-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.96);
  background: radial-gradient(circle at 30% 20%, rgba(132, 232, 255, 0.4), transparent 44%), linear-gradient(135deg, rgba(66, 88, 255, 0.9), rgba(15, 179, 169, 0.82));
}

.avatar-limit-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(229, 236, 255, 0.72);
  text-align: center;
  font-size: 0.9rem;
}

#avatar-limit-feedback {
  margin-top: 14px;
}

#avatar-limit-loading {
  margin-top: 18px;
}

#verification-resend-row {
  margin-top: 10px;
}

.flow-inline-action {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  margin-right: auto;
  margin-left: auto;
}

.flow-button-wide {
  width: 100%;
  min-width: 0;
}

.flow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 22px;
  margin-right: auto;
  margin-left: auto;
}

.flow-actions-stacked {
  flex-direction: column;
}

.flow-primary,
.flow-secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--flow-button-min-height);
  padding: var(--flow-button-padding);
  border-radius: var(--flow-button-radius);
  color: var(--flow-button-color);
  font-family: var(--flow-font-family);
  font-size: var(--flow-button-font-size);
  font-weight: var(--flow-button-font-weight);
  letter-spacing: var(--flow-button-letter-spacing);
  text-align: center;
  cursor: pointer;
  border: 0;
  transition: var(--flow-button-transition);
}

.flow-primary {
  color: #fff;
  background: var(--flow-primary-bg);
  box-shadow: var(--flow-primary-shadow);
  text-decoration: none;
}

.flow-primary:hover {
  filter: brightness(1.06);
}

.flow-primary:focus-visible {
  outline: var(--flow-primary-focus);
  outline-offset: 4px;
}

.flow-secondary {
  border: 1px solid var(--flow-secondary-border);
  background: var(--flow-secondary-bg);
  box-shadow: none;
  text-decoration: none;
}

.flow-secondary:hover,
.flow-secondary:focus-visible {
  background: var(--flow-secondary-bg-hover);
  border-color: var(--flow-secondary-border-hover);
  transform: translateY(-1px);
  outline: none;
}

.flow-primary:disabled,
.flow-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  filter: grayscale(1);
  box-shadow: none;
  transform: none;
}

.flow-primary:disabled::before,
.flow-secondary:disabled::before {
  opacity: 0.16;
}

@media (max-width: 960px) {
  .flow-legal-frame {
    max-height: calc(100vh - 220px);
  }

  .flow-legal-panel-copy {
    padding: 18px 26px 18px 18px;
  }
}
