.account-state-skeleton {
  display: block;
  width: 9rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgb(255 255 255 / 12%), rgb(255 255 255 / 30%), rgb(255 255 255 / 12%));
  background-size: 220% 100%;
  animation: account-pulse 1.2s ease-in-out infinite;
}

@keyframes account-pulse { to { background-position: -220% 0; } }

.site-header__actions--authenticated { display: flex; }
.account-menu { position: relative; list-style: none; }
.account-menu__trigger {
  min-height: 3rem;
  max-width: 16rem;
  padding: 0.35rem 0.8rem 0.35rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 8%);
  color: var(--color-white);
  cursor: pointer;
}
.account-menu__trigger:hover,
.account-menu__trigger[aria-expanded="true"] { background: rgb(255 255 255 / 16%); }
.account-avatar,
.profile-avatar {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
}
.account-avatar { width: 2.25rem; height: 2.25rem; font-size: 0.75rem; }
.account-avatar img,
.profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-menu__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu__chevron { width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.account-menu__dropdown {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: calc(var(--z-menu) + 2);
  width: min(15rem, calc(100vw - 2rem));
  padding: 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  color: var(--color-text);
}
.account-menu__dropdown[hidden] { display: none; }
.account-menu__dropdown a,
.account-menu__dropdown button {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  display: block;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account-menu__dropdown a:hover,
.account-menu__dropdown button:hover,
.account-menu__dropdown a:focus-visible,
.account-menu__dropdown button:focus-visible { background: var(--color-surface-subtle); }
.account-menu__dropdown button { border-top: 1px solid var(--color-border); color: var(--color-red-500); }

.account-page { background: var(--color-background); }
.account-main { padding: clamp(2rem, 5vw, 5rem) var(--page-gutter); }
.account-shell { width: min(100%, 72rem); margin: 0 auto; }
.account-shell--narrow { width: min(100%, 34rem); }
.account-breadcrumb { margin: 0 0 1.25rem; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.account-breadcrumb a { color: inherit; }
.account-card,
.settings-section,
.learning-section,
.profile-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}
.account-card { padding: clamp(1.35rem, 4vw, 2.5rem); }
.account-card__header { margin-bottom: 1.5rem; }
.account-card__header h1,
.account-page-title h1 { margin: 0 0 0.55rem; font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.2; }
.account-card__header p,
.account-page-title p { margin: 0; color: var(--color-text-soft); }
.account-form { display: grid; gap: 1rem; }
.form-field { min-width: 0; display: grid; gap: 0.4rem; }
.form-field > label,
.form-field > legend { color: var(--color-text); font-weight: var(--font-weight-semibold); }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text);
}
.form-field textarea { min-height: 7rem; resize: vertical; }
.form-field input[readonly] { background: var(--color-surface-subtle); color: var(--color-text-soft); }
.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] { border-color: var(--color-red-500); }
.field-help { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.field-error { margin: 0; color: var(--color-red-500); font-size: var(--font-size-sm); }
.password-field { position: relative; }
.password-field input { padding-right: 4.5rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  min-width: 3.5rem;
  min-height: 2.25rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-link);
  transform: translateY(-50%);
  cursor: pointer;
}
.account-status { margin: 0 0 1rem; padding: 0.85rem 1rem; border: 1px solid #2563eb; border-radius: var(--radius-small); background: #eff6ff; box-shadow: inset 0.25rem 0 #2563eb; color: #1e3a8a; font-weight: var(--font-weight-medium); }
.account-status[data-status-type="error"] { border-color: #dc2626; background: #fff1f2; box-shadow: inset 0.25rem 0 #dc2626; color: #7f1d1d; }
.account-status[data-status-type="success"] { border-color: #16a34a; background: #ecfdf5; box-shadow: inset 0.25rem 0 #16a34a; color: #14532d; }
.account-status[data-status-type="warning"] { border-color: #d97706; background: #fffbeb; box-shadow: inset 0.25rem 0 #d97706; color: #713f12; }
.account-status a { color: inherit; font-weight: var(--font-weight-bold); text-decoration: underline; }
html[data-theme="dark"] .account-status { border-color: #60a5fa; background: #0e2949; box-shadow: inset 0.25rem 0 #60a5fa; color: #dbeafe; }
html[data-theme="dark"] .account-status[data-status-type="error"] { border-color: #fb7185; background: #3f1018; box-shadow: inset 0.25rem 0 #fb7185; color: #fff1f2; }
html[data-theme="dark"] .account-status[data-status-type="success"] { border-color: #34d399; background: #0b3325; box-shadow: inset 0.25rem 0 #34d399; color: #d1fae5; }
html[data-theme="dark"] .account-status[data-status-type="warning"] { border-color: #fbbf24; background: #3b2a08; box-shadow: inset 0.25rem 0 #fbbf24; color: #fef3c7; }
.account-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.account-actions .button { min-height: 2.8rem; }
.auth-divider { margin: 1.15rem 0; display: flex; align-items: center; gap: 0.8rem; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.auth-divider::before,
.auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--color-border); }
.google-button {
  width: 100%;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid #747775;
  border-radius: var(--radius-small);
  background: #fff;
  color: #1f1f1f;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
.google-button:hover { background: #f8fafd; }
.google-button svg { width: 1.25rem; height: 1.25rem; }
.account-switch { margin: 1.25rem 0 0; text-align: center; }
.account-secondary-link { display: inline-block; margin-top: 0.25rem; }
.interest-list { margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.55rem; border: 0; }
.interest-option { position: relative; }
.interest-option input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.interest-option span { min-height: 2.7rem; padding: 0.55rem 0.8rem; display: inline-flex; align-items: center; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); cursor: pointer; }
.interest-option input:checked + span { border-color: var(--color-primary); background: var(--color-orange-100); color: var(--color-primary-dark); }
.interest-option input:focus-visible + span { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.settings-grid { margin-top: 1.5rem; display: grid; gap: 1.25rem; }
.settings-section { padding: clamp(1.25rem, 3vw, 2rem); }
.settings-section h2 { margin-top: 0; }
.settings-section--danger { border-color: color-mix(in srgb, var(--color-red-500) 45%, var(--color-border)); }
.button--danger { background: var(--color-red-500); color: #fff; }
.profile-card { padding: clamp(1.25rem, 4vw, 2.5rem); }
.profile-header { display: flex; align-items: center; gap: 1.25rem; }
.profile-avatar { width: 6rem; height: 6rem; font-size: 1.65rem; }
.profile-header h1 { margin: 0; }
.profile-header p { margin: 0.25rem 0 0; color: var(--color-text-muted); }
.profile-details { margin: 2rem 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.profile-detail { padding: 1rem; border-radius: var(--radius-medium); background: var(--color-surface-subtle); }
.profile-detail dt { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.profile-detail dd { margin: 0.25rem 0 0; overflow-wrap: anywhere; font-weight: var(--font-weight-medium); }
.profile-interest-list { margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; }
.profile-interest-list li { padding: 0.4rem 0.7rem; border-radius: var(--radius-pill); background: var(--color-violet-100); }
.learning-grid { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.learning-section { padding: 1.25rem; scroll-margin-top: 6rem; }
.learning-section h2 { margin-top: 0; }
.learning-items { display: grid; gap: 0.75rem; }
.learning-item { padding: 0.8rem; border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.learning-item a { font-weight: var(--font-weight-semibold); }
.learning-item p,
.learning-empty { margin: 0.3rem 0 0; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.tutorial-learning-actions { margin: 2rem 0; padding: 1.25rem; clear: both; border: 1px solid var(--color-border); border-radius: var(--radius-medium); background: var(--color-surface-subtle); }
.tutorial-learning-actions h2 { margin: 0 0 0.35rem; font-size: var(--font-size-xl); }
.tutorial-learning-actions p { margin: 0 0 0.85rem; }
.learning-completion-status { min-height: 2.8rem; padding: 0.55rem 0.85rem; display: inline-flex; align-items: center; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-text-soft); font-weight: var(--font-weight-semibold); }
.learning-completion-status[data-completed="true"] { border-color: var(--color-green-500); background: var(--color-green-100); color: #14532d; }
html[data-theme="dark"] .learning-completion-status[data-completed="true"] { border-color: #34d399; background: #0b3325; color: #d1fae5; }

@media (max-width: 64rem) {
  .site-header--mega .site-header__actions--authenticated { grid-template-columns: 1fr; }
  .account-menu__trigger { max-width: 100%; width: 100%; justify-content: flex-start; }
  .account-menu__dropdown { position: static; width: 100%; margin-top: 0.5rem; box-shadow: none; }
}
@media (max-width: 42rem) {
  .profile-details,
  .learning-grid { grid-template-columns: 1fr; }
  .profile-header { align-items: flex-start; flex-direction: column; }
  .account-actions { display: grid; }
  .account-actions .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .account-state-skeleton { animation: none; } }
