/* ===== Account Auth Popup ===== */
body.is-account-popup-open {
	overflow: hidden;
}

.account-auth-popup {
	position: fixed;
	inset: 0;
	z-index: 5000;
	display: grid;
	place-items: center;
	padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 180ms var(--ease-smooth), visibility 0s linear 180ms;
}

.account-auth-popup.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 180ms var(--ease-smooth), visibility 0s;
}

.account-auth-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 17, 17, 0.36);
}

.account-auth-card {
	position: relative;
	z-index: 1;
	width: min(100%, 420px);
	max-height: min(720px, calc(100dvh - 36px));
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 34px 28px 28px;
	border: 1px solid rgba(17, 17, 17, 0.1);
	border-radius: 28px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.99), rgba(248, 248, 246, 0.99)), #ffffff;
	box-shadow: 0 24px 70px rgba(17, 17, 17, 0.14);
	transition: none;
	min-width: 0;
}

.account-auth-popup.is-active .account-auth-card {
}

.account-auth-close {
	position: absolute;
	top: 16px;
	right: 16px;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border: 1px solid rgba(17, 17, 17, 0.1);
	border-radius: var(--radius-pill);
	background: #ffffff;
	color: var(--color-ink);
	box-shadow: none;
	transition: border-color var(--duration-base) var(--ease-smooth), background-color var(--duration-base) var(--ease-smooth);
}

.account-auth-close:focus-visible,
.account-auth-close:hover {
	border-color: rgba(17, 17, 17, 0.22);
	background: #f6f6f4;
}

.account-auth-identity {
	display: grid;
	justify-items: center;
	gap: 5px;
	padding: 14px 38px 0;
	text-align: center;
}

.account-auth-logo {
	width: 58px;
	height: 58px;
	object-fit: contain;
}

.account-auth-wordmark {
	width: min(206px, 72%);
}

.account-auth-heading {
	display: grid;
	gap: 6px;
	margin-top: 18px;
	text-align: center;
}

.account-auth-heading h2 {
	margin: 0;
	font-size: 1.04rem;
	letter-spacing: -0.03em;
	line-height: 1.2;
}

.account-auth-heading p {
	margin: 0 auto;
	max-width: 320px;
	color: var(--color-muted);
	font-size: 0.78rem;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.account-auth-close-icon,
.account-google-icon {
	display: block;
	flex: 0 0 auto;
	pointer-events: none;
	user-select: none;
}

.account-auth-form {
	display: grid;
	gap: 10px;
	margin-top: 20px;
	min-width: 0;
}

.account-auth-input {
	width: 100%;
	min-width: 0;
	height: 46px;
	padding-inline: 14px;
	border: 1px solid var(--color-border-strong);
	border-radius: 12px;
	background: #ffffff;
	color: var(--color-ink);
	outline: none;
	font-size: 0.95rem;
	font-weight: var(--font-weight-medium);
	transition: border-color var(--duration-base) var(--ease-smooth), box-shadow var(--duration-base) var(--ease-smooth);
}

.account-auth-input::placeholder {
	color: #9a9a9a;
	font-weight: var(--font-weight-regular);
}

.account-auth-input:focus {
	border-color: #111111;
	box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.account-auth-submit,
.account-google-fallback {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 46px;
	padding: 11px 16px;
	border-radius: 12px;
	font-size: 0.9rem;
	font-weight: var(--font-weight-semibold);
	line-height: 1;
	text-align: center;
	transition: border-color var(--duration-base) var(--ease-smooth), background-color var(--duration-base) var(--ease-smooth), color var(--duration-base) var(--ease-smooth);
}

.account-auth-submit {
	background: #111111;
	color: #ffffff;
}

.account-auth-submit:focus-visible,
.account-auth-submit:hover {
	background: #242424;
}

.account-auth-divider {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 18px 0;
	color: var(--color-muted);
	font-size: 0.78rem;
}

.account-auth-divider::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 1px;
	background: var(--color-border);
}

.account-auth-divider span {
	position: relative;
	z-index: 1;
	padding-inline: 12px;
	background: #ffffff;
}

.account-google-area {
	display: grid;
	gap: 10px;
	min-width: 0;
}

.account-google-fallback {
	border: 1px solid var(--color-border-strong);
	background: #ffffff;
	color: var(--color-ink);
}

.account-google-fallback:focus-visible,
.account-google-fallback:hover {
	border-color: #111111;
	background: #f7f7f5;
}

.account-google-fallback.is-disabled {
	cursor: default;
	opacity: 0.72;
}

.account-google-render:empty {
	display: none;
}

.account-google-render > div {
	width: 100% !important;
}

.account-auth-note {
	margin-top: 14px;
	color: var(--color-muted);
	font-size: 0.78rem;
	line-height: 1.55;
	text-align: center;
	overflow-wrap: anywhere;
}

.account-auth-note:empty {
	display: none;
}

.account-auth-note.is-success {
	color: var(--color-success);
}

.account-auth-note.is-error {
	color: var(--color-danger);
}

.account-auth-session {
	align-items: center;
	grid-template-columns: auto minmax(0, 1fr) auto;
	gap: 10px;
	margin-top: 18px;
	padding: 12px;
	border: 1px solid rgba(17, 17, 17, 0.08);
	border-radius: 16px;
	background: #f7f7f5;
	min-width: 0;
}

.account-auth-session:not([hidden]) {
	display: grid;
}

.account-auth-avatar {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: var(--radius-pill);
	background: #111111;
	color: #ffffff;
	font-size: 0.92rem;
	font-weight: var(--font-weight-bold);
	text-transform: uppercase;
}

.account-auth-session strong,
.account-auth-session small {
	display: block;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.account-auth-session strong {
	font-size: 0.88rem;
}

.account-auth-session small {
	color: var(--color-muted);
	font-size: 0.76rem;
}

.account-auth-session button {
	min-height: 34px;
	padding: 8px 11px;
	border: 1px solid rgba(17, 17, 17, 0.12);
	border-radius: var(--radius-pill);
	background: #ffffff;
	color: var(--color-ink);
	font-size: 0.76rem;
	font-weight: var(--font-weight-semibold);
}

@media (max-width: 480px) {
	.account-auth-popup {
		padding: 12px;
	}

	.account-auth-card {
		width: min(100%, 420px);
		max-height: min(680px, calc(100dvh - 24px));
		padding: 24px 18px 18px;
		border-radius: 22px;
	}

	.account-auth-close {
		top: 12px;
		right: 12px;
	}

	.account-auth-identity {
		gap: 4px;
		padding: 12px 30px 2px;
	}

	.account-auth-logo {
		width: 50px;
		height: 50px;
	}

	.account-auth-wordmark {
		width: min(180px, 74%);
	}

	.account-auth-input,
	.account-auth-submit,
	.account-google-fallback {
		min-height: 44px;
	}

	.account-auth-session {
		grid-template-columns: auto minmax(0, 1fr);
	}

	.account-auth-session button {
		grid-column: 1 / -1;
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.account-auth-popup,
	.account-auth-card,
	.account-auth-close,
	.account-auth-input,
	.account-auth-submit,
	.account-google-fallback {
		transition: none;
	}
}

/* ===== Account Auth Final Polish ===== */
.account-auth-title.sr-only {
  position: absolute;
}

.account-auth-card {
  box-shadow: 0 18px 54px rgba(17, 17, 17, 0.12);
}

.account-auth-heading {
  margin-top: 14px;
}

.account-auth-heading h2.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;
}

.account-auth-heading p {
  max-width: 330px;
  font-size: 0.8rem;
  text-align: center;
}

.account-google-area {
  justify-items: stretch;
}

.account-google-render {
  display: grid;
  justify-items: center;
  min-width: 0;
}

.account-google-render.is-ready {
  min-height: 44px;
}

.account-google-render iframe,
.account-google-render > div,
.account-google-render [role="button"] {
  max-width: 100% !important;
  border-radius: var(--radius-pill) !important;
}

.account-google-fallback {
  border-radius: var(--radius-pill);
}


/* Google sign-in button polish. The actual button is an iframe, so the wrapper must control width/rounding. */
.account-google-area {
  width: 100%;
}

.account-google-render {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  display: grid;
  justify-items: center;
  align-items: center;
  overflow: hidden;
  border-radius: var(--radius-pill);
}

.account-google-render > div {
  width: min(100%, var(--google-button-width, 360px)) !important;
  max-width: 100% !important;
}

.account-google-render iframe {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
}

.account-google-fallback {
  min-height: 44px;
  border-color: rgba(17, 17, 17, 0.14);
  border-radius: var(--radius-pill);
  background: #ffffff;
}

.account-google-fallback .account-google-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .account-google-render {
    min-height: 42px;
  }

  .account-google-fallback {
    min-height: 42px;
    font-size: 0.82rem;
  }
}

/* ===== Google Auth Bar Stabilizer =====
   GSI iframe buttons are intentionally hard to style and can render with
   inconsistent narrow widths on small cards. The project now uses the
   first-party fallback button as the visual/auth trigger and keeps the
   iframe render mount hidden to avoid the broken mini bar. */
.account-google-area {
  width: 100%;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.account-google-render {
  display: none !important;
}

.account-google-fallback[hidden] {
  display: none !important;
}

.account-google-fallback {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 14px;
  background: #ffffff;
  color: #171717;
  box-shadow: none;
  font-size: 0.84rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.account-google-fallback .account-google-icon {
  width: 18px;
  height: 18px;
  justify-self: start;
}

.account-google-fallback span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.account-google-fallback::after {
  content: "";
  width: 18px;
  height: 18px;
  justify-self: end;
}

.account-google-fallback:focus-visible {
  outline: 0;
  border-color: rgba(17, 17, 17, 0.45);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.account-google-fallback:hover {
  border-color: rgba(17, 17, 17, 0.28);
  background: #fafafa;
}

.account-google-fallback.is-loading {
  cursor: wait;
  color: #444444;
}

.account-google-fallback.is-disabled {
  cursor: default;
  opacity: 0.68;
}

@media (max-width: 480px) {
  .account-google-area {
    gap: 8px;
  }

  .account-google-fallback {
    min-height: 44px;
    border-radius: 13px;
    padding-inline: 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  .account-google-fallback {
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    min-height: 42px;
    padding-inline: 12px;
    font-size: 0.76rem;
  }

  .account-google-fallback .account-google-icon,
  .account-google-fallback::after {
    width: 17px;
    height: 17px;
  }
}

/* Account auth mode switch */
.account-auth-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  color: var(--color-muted);
  font-size: 0.76rem;
  line-height: 1.2;
  text-align: center;
}

.account-auth-mode button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: #111111;
  font-size: 0.76rem;
  font-weight: var(--font-weight-semibold);
}

.account-auth-mode button:focus-visible,
.account-auth-mode button:hover {
  border-color: rgba(17, 17, 17, 0.24);
  background: #f7f7f5;
}

@media (max-width: 360px) {
  .account-auth-mode {
    display: grid;
    gap: 6px;
  }
}

/* Account session avatar image support */
.account-auth-avatar.has-image {
	overflow: hidden;
	background: #eeeeec;
	color: transparent;
}

.account-auth-avatar.has-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ===== Manual Gmail Auth Polish ===== */
.account-auth-card {
  width: min(100%, 424px);
  padding: 28px 24px 22px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 18px 54px rgba(17, 17, 17, 0.13);
}

.account-auth-close {
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
}

.account-auth-identity {
  gap: 4px;
  padding: 10px 42px 0;
}

.account-auth-logo {
  width: 48px;
  height: 48px;
}

.account-auth-wordmark {
  display: block;
  width: auto;
  color: #111111;
  font-size: 1.22rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.34em;
  line-height: 1.1;
  text-indent: 0.34em;
}

.account-auth-heading {
  margin-top: 14px;
}

.account-auth-heading p {
  max-width: 340px;
  font-size: 0.8rem;
  line-height: 1.48;
}

.account-auth-mode {
  margin-top: 12px;
  padding: 0;
  gap: 8px;
  font-size: 0.76rem;
}

.account-auth-mode button {
  min-height: 28px;
  padding-inline: 11px;
  border-color: rgba(17, 17, 17, 0.12);
}

.account-auth-form {
  margin-top: 14px;
  gap: 8px;
}

.account-auth-email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.account-auth-input {
  height: 44px;
  border-radius: 14px;
  border-color: rgba(17, 17, 17, 0.13);
  font-size: 0.86rem;
}

.account-auth-submit {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: #111111;
  font-size: 0.8rem;
}

.account-auth-submit[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.account-auth-divider {
  margin: 14px 0;
  font-size: 0.72rem;
}

.account-auth-divider span {
  padding-inline: 10px;
}

.account-google-fallback {
  min-height: 45px;
  border-radius: 14px;
  font-size: 0.82rem;
}

.account-auth-note {
  margin-top: 12px;
  font-size: 0.76rem;
}

@media (max-width: 480px) {
  .account-auth-card {
    width: min(100%, 420px);
    padding: 24px 18px 18px;
    border-radius: 22px;
  }

  .account-auth-wordmark {
    font-size: 1.08rem;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }

  .account-auth-email-row {
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 7px;
  }

  .account-auth-input,
  .account-auth-submit,
  .account-google-fallback {
    min-height: 42px;
    height: 42px;
    border-radius: 13px;
  }
}

@media (max-width: 360px) {
  .account-auth-email-row {
    grid-template-columns: 1fr;
  }

  .account-auth-submit {
    width: 100%;
  }
}


/* ===== Account Auth Production Polish ===== */
.account-auth-heading p {
  max-width: 350px;
  font-size: 0.79rem;
  line-height: 1.5;
}

.account-auth-mode {
  margin-top: 13px;
}

.account-auth-email-row {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
}

.account-auth-submit--silent,
.account-auth-submit[hidden] {
  display: none !important;
}

.account-auth-input {
  height: 44px;
  padding-inline: 15px;
}

.account-auth-divider {
  margin: 13px 0;
}

.account-auth-note {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 480px) {
  .account-auth-heading p {
    max-width: 310px;
    font-size: 0.77rem;
  }

  .account-auth-input {
    height: 42px;
  }
}
