/*
 * @file public/portal.css
 * @description Implements the responsive AMZ Account 3.3.0 authentication, portal, and administrator visual system.
 * @editCount 1
 */

:root {
  color-scheme: dark;
  --page: #07131f;
  --page-deep: #050d16;
  --surface: #0b1b2b;
  --surface-raised: #0e2235;
  --surface-input: #091827;
  --text: #f4f8fb;
  --muted: #9fb1c1;
  --subtle: #70869a;
  --line: #20364a;
  --line-strong: #345069;
  --accent: #38cfdf;
  --accent-strong: #76e7f0;
  --accent-ink: #03242a;
  --success: #6bd799;
  --danger: #ff8f89;
  --danger-line: #8f4547;
  --focus: #8cf3fa;
  --shadow: 0 20px 60px rgb(0 0 0 / 24%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --content-width: 1280px;
  --header-height: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 42% -12%, rgb(26 70 102 / 20%), transparent 36rem),
    linear-gradient(180deg, var(--page-deep), var(--page) 22rem);
  font-size: 16px;
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.18em;
}

a:hover {
  color: #b0f7fb;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 0.91rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

button:hover,
.button:hover {
  border-color: var(--accent-strong);
  color: var(--accent-ink);
  background: var(--accent-strong);
}

button:active,
.button:active {
  transform: translateY(1px);
}

.button--quiet {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}

.button--quiet:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: rgb(56 207 223 / 8%);
}

.button--danger {
  border-color: var(--danger-line);
  color: var(--danger);
}

.button--danger:hover {
  border-color: var(--danger);
  color: #ffd3d0;
  background: rgb(255 143 137 / 8%);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
  line-height: 1.35;
}

p {
  margin-bottom: 1rem;
  color: var(--muted);
}

code {
  color: #d9e7f2;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

form {
  margin: 0;
}

label {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-input);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 2%);
}

input,
select {
  padding: 0.65rem 0.8rem;
}

textarea {
  min-height: 7rem;
  padding: 0.75rem 0.8rem;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--subtle);
}

select {
  max-width: 15rem;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--accent-ink);
  background: var(--focus);
  font-weight: 750;
  transform: translateY(-180%);
  transition: transform 120ms ease;
}

.skip-link:focus {
  color: var(--accent-ink);
  transform: translateY(0);
}

.portal-header {
  min-height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: rgb(5 13 22 / 92%);
  backdrop-filter: blur(18px);
}

.portal-header__inner {
  width: min(calc(100% - 2rem), var(--content-width));
  min-height: var(--header-height);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto minmax(10rem, 1fr);
  align-items: stretch;
  gap: 1rem;
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  transform: rotate(45deg);
}

.brand__mark > span {
  transform: rotate(-45deg);
}

.portal-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.6rem, 2.5vw, 2.4rem);
}

.portal-nav a {
  position: relative;
  min-height: var(--header-height);
  display: inline-flex;
  align-items: center;
  padding: 0 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.portal-nav a:hover,
.portal-nav a[aria-current="page"] {
  color: var(--text);
}

.portal-nav a[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  content: "";
}

.portal-user {
  min-width: 0;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.portal-user > span:last-child {
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-sign-in {
  align-self: center;
  justify-self: end;
}

.portal-frame {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.75rem) 0 5rem;
}

.portal-content {
  min-width: 0;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
}

.identity-rail {
  position: sticky;
  top: 2rem;
  align-self: start;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 1rem 0;
  text-align: center;
}

.identity-rail h2 {
  margin: 0;
  font-size: 1.55rem;
}

.identity-rail p {
  margin: 0;
}

.identity-rail__username {
  color: var(--muted);
}

.identity-id {
  width: 100%;
  display: grid;
  gap: 0.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  text-align: left;
}

.identity-id span {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  background: var(--surface);
  font-weight: 720;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--small {
  width: 2rem;
  height: 2rem;
  font-size: 0.75rem;
}

.avatar--medium {
  width: 3rem;
  height: 3rem;
  font-size: 0.95rem;
}

.avatar--large {
  width: 8rem;
  height: 8rem;
  border-width: 2px;
  font-size: 2.75rem;
  box-shadow: 0 0 0 7px rgb(56 207 223 / 4%);
}

.page-heading {
  padding-bottom: clamp(1.75rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}

.page-heading p {
  max-width: 44rem;
  margin-bottom: 0;
  font-size: 1.02rem;
}

.page-heading--with-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.page-count {
  flex: 0 0 auto;
  margin: 0;
}

.page-count strong {
  color: var(--text);
  font-size: 1.35rem;
}

.notice {
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgb(56 207 223 / 7%);
}

.notice--error {
  border-color: var(--danger-line);
  background: rgb(255 143 137 / 6%);
}

.notice p {
  margin: 0;
  color: var(--text);
}

.portal-section {
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.section-heading p {
  margin-top: 0.35rem;
}

.text-link {
  min-height: 44px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 650;
}

.form-grid,
.subform {
  display: grid;
  gap: 1.3rem;
}

.subform {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.subform button {
  justify-self: start;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field p,
.helper-text {
  margin: 0;
  color: var(--subtle);
  font-size: 0.84rem;
}

.form-actions {
  display: flex;
  justify-content: end;
  margin-top: 1.25rem;
}

.settings-list {
  border-top: 1px solid var(--line);
}

.settings-row {
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.settings-row__copy {
  min-width: 0;
}

.settings-row__copy p,
.settings-row__copy h3 {
  margin-bottom: 0;
}

.settings-row__copy p {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.settings-row--security {
  align-items: start;
}

.settings-row--security .settings-row__copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.9rem;
}

.settings-row--security h3,
.settings-row--security p {
  width: 100%;
}

.data-list,
.achievement-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.provider-row,
.person-row {
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.provider-row:first-child,
.person-row:first-child {
  border-top: 1px solid var(--line);
}

.provider-row__mark {
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 800;
  background: var(--surface);
}

.provider-row__copy,
.person-row__copy {
  min-width: 0;
  display: grid;
  flex: 1 1 auto;
}

.provider-row__copy span,
.person-row__copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

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

.status-text--success::before {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 2rem;
}

.danger-zone h2,
.danger-zone p {
  margin-bottom: 0;
}

.achievements-page,
.public-profile-page {
  max-width: 1180px;
}

.friends-account-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 13rem) minmax(0, 1fr);
  align-items: start;
  gap: clamp(2rem, 4vw, 3.5rem);
}

.friends-account-content {
  min-width: 0;
}

.identity-rail--compact .avatar--large {
  width: 7rem;
  height: 7rem;
  font-size: 2.35rem;
}

.identity-rail--compact .text-link {
  min-height: auto;
}

.social-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  align-items: start;
  gap: 2rem;
  margin-top: 2rem;
}

.social-layout > .portal-content,
.social-tools {
  display: grid;
  gap: 1.5rem;
}

.social-tools {
  position: sticky;
  top: 1.5rem;
}

.portal-panel,
.invite-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(11 27 43 / 68%);
  box-shadow: var(--shadow);
}

.portal-panel {
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
}

.portal-panel > .section-heading {
  margin-bottom: 1rem;
}

.portal-panel > h2 {
  margin-bottom: 0.4rem;
}

.portal-panel > p {
  font-size: 0.9rem;
}

.portal-panel form {
  display: grid;
  gap: 1rem;
}

.portal-panel form > button {
  justify-self: start;
}

.person-row__identity {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.8rem;
}

.person-row__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: end;
  gap: 0.55rem;
}

.person-row__actions form {
  display: block;
}

.person-row__actions button,
.person-row__actions .button {
  min-height: 40px;
  padding: 0.55rem 0.75rem;
}

.empty-row,
.empty-state {
  padding: 1.75rem 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.empty-state h3,
.empty-state p {
  margin-bottom: 0;
}

.empty-state p {
  margin-top: 0.35rem;
}

.empty-state--compact {
  padding: 1rem 0;
}

.empty-state--large {
  min-height: 16rem;
  display: grid;
  place-content: center;
}

.count-badge {
  min-width: 1.8rem;
  min-height: 1.8rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.invite-panel {
  display: grid;
  gap: 1rem;
  padding: 1.35rem;
}

.invite-panel h2,
.invite-panel p {
  margin-bottom: 0;
}

.invite-panel__content {
  min-width: 0;
  display: grid;
  gap: 0.8rem;
}

.copy-value {
  min-width: 0;
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
}

.copy-value .text-link {
  min-height: auto;
  justify-self: start;
}

.disclosure {
  padding: 0;
}

.disclosure summary {
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
}

.disclosure summary > span:first-child {
  display: grid;
}

.disclosure summary small {
  color: var(--muted);
}

.disclosure > .data-list {
  padding: 0 1.5rem 1.1rem;
}

.achievement-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.75rem 0 0;
  border-block: 1px solid var(--line);
}

.achievement-summary > div {
  display: grid;
  gap: 0.25rem;
  padding: 1.25rem clamp(0.75rem, 2vw, 1.5rem);
  border-right: 1px solid var(--line);
}

.achievement-summary > div:first-child {
  padding-left: 0;
}

.achievement-summary > div:last-child {
  border-right: 0;
}

.achievement-summary dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.achievement-summary dd {
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 750;
  line-height: 1.2;
}

.achievement-summary dd span {
  color: var(--subtle);
  font-size: 0.95rem;
  font-weight: 550;
}

.achievement-products {
  display: grid;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.achievement-product {
  min-width: 0;
}

.achievement-product__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-strong);
}

.achievement-product__header h2,
.achievement-product__header p {
  margin-bottom: 0;
}

.achievement-product__header > p {
  flex: 0 0 auto;
  color: var(--muted);
}

.achievement-product__header > p strong {
  color: var(--text);
}

.achievement-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.achievement-row--unlocked .achievement-icon {
  border-color: var(--accent);
  color: var(--accent);
}

.achievement-row--secret {
  opacity: 0.78;
}

.achievement-icon {
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
}

.achievement-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.achievement-row__content {
  min-width: 0;
  display: grid;
  gap: 0.75rem;
}

.achievement-row__heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.achievement-row__heading h3,
.achievement-row__heading p {
  margin-bottom: 0;
}

.achievement-row__heading p {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.points {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.achievement-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
}

.achievement-progress progress {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface-raised);
}

.achievement-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-raised);
}

.achievement-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.achievement-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.achievement-progress span {
  color: var(--muted);
  font-size: 0.78rem;
}

.achievement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  color: var(--subtle);
  font-size: 0.78rem;
}

.achievement-row--compact {
  grid-template-columns: 3rem minmax(0, 1fr);
  padding: 1rem 0;
}

.achievement-row--compact .achievement-icon {
  width: 3rem;
  height: 3rem;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.75rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.profile-hero h1 {
  margin-bottom: 0.25rem;
}

.profile-hero__username {
  margin-bottom: 0.8rem;
  color: var(--accent-strong);
}

.profile-hero__bio {
  max-width: 42rem;
  margin-bottom: 0;
  white-space: pre-wrap;
}

.profile-hero__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.public-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(17rem, 0.75fr);
  align-items: start;
  gap: 2rem;
  margin-top: 2rem;
}

.public-profile-layout .achievement-products {
  gap: 2rem;
  margin-top: 0;
}

.achievement-products--compact .achievement-product__header {
  align-items: start;
}

.private-state {
  min-height: 9rem;
  display: grid;
  place-content: center;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.private-state h3,
.private-state p {
  margin-bottom: 0;
}

.private-state p {
  margin-top: 0.3rem;
}

.private-profile {
  min-height: 28rem;
  display: grid;
  place-items: center;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
}

.private-profile__mark {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  margin-bottom: 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 800;
}

.private-profile h1,
.private-profile p {
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .friends-account-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .friends-account-layout .identity-rail {
    position: static;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-items: start;
    column-gap: 1.25rem;
    padding: 0 0 1.25rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .friends-account-layout .identity-rail .avatar {
    grid-row: 1 / span 2;
  }

  .friends-account-layout .identity-rail .text-link {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .friends-account-layout .identity-rail .avatar--large {
    width: 4.25rem;
    height: 4.25rem;
    font-size: 1.5rem;
  }
}

@media (max-width: 920px) {
  .portal-header__inner {
    grid-template-columns: auto 1fr auto;
  }

  .portal-user > span:last-child {
    display: none;
  }

  .account-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .identity-rail {
    position: static;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
    column-gap: 1.25rem;
    text-align: left;
  }

  .identity-rail .avatar {
    grid-row: 1 / span 3;
  }

  .identity-id {
    max-width: 28rem;
    padding-top: 0.5rem;
    border-top: 0;
  }

  .social-layout,
  .public-profile-layout {
    grid-template-columns: 1fr;
  }

  .social-tools {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-friends {
    max-width: none;
  }
}

@media (max-width: 680px) {
  :root {
    --header-height: 60px;
  }

  .portal-header__inner {
    width: min(calc(100% - 1.25rem), var(--content-width));
    grid-template-columns: 1fr auto;
    grid-template-rows: var(--header-height) 50px;
    gap: 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .portal-user,
  .portal-sign-in {
    grid-column: 2;
    grid-row: 1;
  }

  .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: start;
    gap: 1.4rem;
    overflow-x: auto;
  }

  .portal-nav a {
    min-height: 50px;
    white-space: nowrap;
  }

  .portal-frame {
    width: min(calc(100% - 1.25rem), var(--content-width));
    padding-top: 1.75rem;
  }

  .identity-rail {
    grid-template-columns: auto minmax(0, 1fr);
    padding-top: 0;
  }

  .identity-rail .avatar--large {
    width: 5rem;
    height: 5rem;
    font-size: 1.75rem;
  }

  .friends-account-layout .identity-rail {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .friends-account-layout .identity-rail .text-link {
    grid-column: 2;
    grid-row: 2;
  }

  .page-heading--with-meta,
  .section-heading,
  .settings-row,
  .danger-zone,
  .achievement-product__header,
  .profile-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading--with-meta,
  .section-heading,
  .danger-zone,
  .achievement-product__header {
    display: flex;
  }

  .settings-row {
    display: grid;
    gap: 0.8rem;
  }

  .settings-row select {
    max-width: none;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button,
  .danger-zone button {
    width: 100%;
  }

  .provider-row,
  .person-row {
    align-items: start;
    flex-wrap: wrap;
  }

  .provider-row__copy {
    width: calc(100% - 3.5rem);
  }

  .provider-row > .status-text,
  .provider-row > .button {
    margin-left: 3.4rem;
  }

  .person-row__actions {
    width: 100%;
    padding-left: 3.8rem;
    justify-content: start;
    flex-wrap: wrap;
  }

  .social-tools {
    grid-template-columns: 1fr;
  }

  .achievement-summary {
    grid-template-columns: 1fr 1fr;
  }

  .achievement-summary > div {
    border-bottom: 1px solid var(--line);
  }

  .achievement-summary > div:nth-child(2) {
    border-right: 0;
  }

  .achievement-summary > div:first-child {
    padding-left: 0.75rem;
  }

  .achievement-summary > div:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .achievement-row,
  .achievement-row--compact {
    grid-template-columns: 2.75rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .achievement-icon,
  .achievement-row--compact .achievement-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .achievement-row__heading {
    display: grid;
  }

  .points {
    justify-self: start;
  }

  .profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
  }

  .profile-hero .avatar--large {
    width: 5rem;
    height: 5rem;
    font-size: 1.8rem;
  }

  .profile-hero__actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .brand {
    font-size: 1rem;
  }

  .brand__mark {
    width: 1.75rem;
    height: 1.75rem;
  }

  .portal-nav {
    gap: 1rem;
  }

  .portal-nav a {
    font-size: 0.88rem;
  }

  .identity-rail {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .identity-rail .avatar {
    grid-row: auto;
  }

  .friends-account-layout .identity-rail {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .friends-account-layout .identity-rail .avatar,
  .friends-account-layout .identity-rail .text-link {
    grid-column: auto;
    grid-row: auto;
  }

  .identity-id {
    text-align: left;
  }

  .achievement-progress {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .brand__mark,
  .avatar,
  .achievement-icon {
    forced-color-adjust: auto;
  }

  .status-text--success::before,
  .portal-nav a[aria-current="page"]::after {
    background: CanvasText;
  }
}

/* AMZ Account 3.3 shared identity-vault shell. These overrides intentionally
   keep existing portal content semantics while unifying auth and portal chrome. */
.portal-header {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: 15rem;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: rgb(5 13 22 / 96%);
}

.portal-header__inner {
  width: 100%;
  min-height: 100%;
  padding: 2rem 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
}

.brand {
  min-height: 3rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.portal-nav {
  display: grid;
  align-content: start;
  justify-content: stretch;
  gap: 0.35rem;
}

.portal-nav a {
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border-left: 2px solid transparent;
}

.portal-nav a[aria-current="page"] {
  border-left-color: var(--accent);
  background: rgb(56 207 223 / 7%);
}

.portal-nav a[aria-current="page"]::after {
  display: none;
}

.portal-header__actions {
  min-width: 0;
  margin-top: auto;
  display: grid;
  gap: 0.8rem;
}

.portal-header__actions .pwa-install-button,
.portal-header__actions .portal-user,
.portal-header__actions .portal-sign-in {
  width: 100%;
  justify-self: stretch;
}

.portal-frame {
  width: min(calc(100% - 19rem), var(--content-width));
  margin: 0 auto 0 17rem;
  padding-top: clamp(2.5rem, 5vw, 5rem);
}

.portal-mobile-nav {
  display: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 0.75fr) minmax(22rem, 1.25fr);
  gap: clamp(3rem, 8vw, 7rem);
  align-items: start;
}

.auth-intro {
  position: sticky;
  top: 4rem;
  padding-top: 0.75rem;
}

.auth-brand-line {
  display: block;
  margin-bottom: 1.25rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-intro h1 {
  max-width: 10ch;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 650;
  line-height: 0.98;
}

.auth-intro p {
  max-width: 31rem;
  font-size: 1.05rem;
}

.auth-surface {
  min-width: 0;
  padding-left: clamp(1.5rem, 4vw, 3.5rem);
  border-left: 1px solid var(--line-strong);
}

.auth-surface .content {
  display: grid;
  gap: 1.25rem;
}

.auth-surface .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-surface .card {
  min-width: 0;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.auth-surface .grid > .card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  background: rgb(11 27 43 / 48%);
}

.auth-surface .center,
.auth-surface form,
.totp-setup-details {
  display: grid;
  gap: 0.85rem;
}

.auth-surface label {
  display: grid;
  gap: 0.45rem;
}

.auth-surface .stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.auth-surface .secondary {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}

.auth-surface .muted-link {
  color: var(--muted);
}

.auth-surface .mono,
.totp-secret {
  overflow-wrap: anywhere;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.auth-surface ul.clean {
  padding-left: 1.2rem;
}

.totp-setup-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}

.totp-qr-frame {
  margin: 0;
}

.totp-qr {
  width: min(100%, 17rem);
  border: 0.65rem solid #fff;
  border-radius: var(--radius);
  background: #fff;
  forced-color-adjust: none;
}

.totp-secret {
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface-input);
  user-select: all;
}

.admin-page .page-heading h1,
.admin-page .status-text {
  color: #e5b85b;
}

@media (max-width: 920px) {
  body {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
  }

  .portal-header {
    position: sticky;
    inset: 0 0 auto;
    width: 100%;
    min-height: 4.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portal-header__inner {
    min-height: 4.25rem;
    padding: 0.65rem 1rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .portal-header .portal-nav,
  .portal-header__actions .pwa-install-button {
    display: none;
  }

  .portal-header__actions {
    margin: 0 0 0 auto;
    display: block;
  }

  .portal-header__actions .portal-user,
  .portal-header__actions .portal-sign-in {
    width: auto;
  }

  .portal-frame {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
    padding-top: 2rem;
  }

  .portal-mobile-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(4.25rem + env(safe-area-inset-bottom));
    padding: 0.45rem 0.65rem env(safe-area-inset-bottom);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.2rem;
    border-top: 1px solid var(--line);
    background: rgb(5 13 22 / 97%);
    backdrop-filter: blur(18px);
  }

  .portal-mobile-nav a {
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    place-items: center;
    padding: 0.55rem 0.25rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }

  .portal-mobile-nav a[aria-current="page"] {
    color: var(--accent-strong);
  }

  .auth-page {
    min-height: auto;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .auth-intro {
    position: static;
  }

  .auth-intro h1 {
    max-width: none;
    font-size: clamp(2.5rem, 12vw, 4.5rem);
  }

  .auth-surface {
    padding: 0;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
  }
}

@media (max-width: 680px) {
  .auth-surface .grid,
  .totp-setup-grid {
    grid-template-columns: 1fr;
  }

  .auth-surface .grid > .card {
    padding: 1rem 0;
    border-right: 0;
    border-left: 0;
    background: transparent;
  }

  .brand > span:last-child {
    display: none;
  }
}
