/* Layout rules like .profile-gate { display: flex } override the HTML hidden attribute unless forced. */
.profile-gate[hidden],
.saved-page-gate[hidden] {
  display: none !important;
}

#profile-main[hidden],
#saved-main[hidden],
#report-issue-main[hidden] {
  display: none !important;
}

#profile-main:not([hidden]),
#saved-main:not([hidden]),
#report-issue-main:not([hidden]) {
  display: block;
}

.profile-page,
.saved-avatars-page {
  padding: clamp(1.25rem, 4vw, 2.5rem) 0 4rem;
}

.profile-page-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-page-head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
}

.profile-lead {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  max-width: 52ch;
  line-height: 1.55;
}

.profile-account-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  letter-spacing: -0.02em;
}

.profile-account-section .hint {
  margin: 0 0 0.75rem;
}

.profile-account-section.bensen-panel {
  border-left: 4px solid var(--accent);
}

.profile-account-email-card {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.profile-account-email-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.profile-account-email {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.45;
}

.profile-email-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.profile-block {
  margin: 0;
}

.profile-block--logout {
  border-style: dashed;
}

.report-issue-page .form-field textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
}

.report-issue-page .form-field textarea:focus {
  outline: 2px solid rgba(93, 134, 216, 0.45);
  outline-offset: 1px;
}

.report-issue-page .form-field input[readonly] {
  opacity: 0.85;
  cursor: default;
}

.report-issue-status {
  margin: 0;
  font-size: 0.875rem;
}

.report-issue-status--error {
  color: #f472b6;
}

.report-issue-status--success {
  color: #86efac;
  font-weight: 600;
}

.profile-auth-loading {
  margin: 0;
  padding: clamp(2rem, 8vh, 4rem) 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.profile-auth-loading[hidden] {
  display: none !important;
}

.profile-gate,
.saved-page-gate {
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.profile-gate-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.profile-gate-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.profile-gate-card p {
  margin: 0 0 1.25rem;
  color: var(--text-soft);
  line-height: 1.55;
}

.profile-gate-card .btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-toast {
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  border: 1px solid var(--line-strong);
  background: rgba(93, 134, 216, 0.12);
  color: var(--text);
}

.profile-toast.is-error {
  background: rgba(232, 120, 120, 0.12);
  border-color: rgba(232, 120, 120, 0.35);
  color: #ffd4d4;
}

.profile-danger-row {
  margin-top: 1rem;
}

.saved-avatars-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 1rem;
}

.saved-avatars-grid .profile-download-card {
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  height: 100%;
}

.saved-avatars-grid .profile-download-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  max-height: none;
}

.saved-avatars-grid .profile-download-card .body {
  text-align: left;
}

.saved-avatars-grid .profile-download-card .actions {
  margin-top: auto;
  padding-top: 0.35rem;
}

.profile-download-card .actions-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.profile-download-card .actions-stack .btn-copy-bensen-link {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(93, 134, 216, 0.15);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.profile-download-card .actions-stack .btn-copy-bensen-link:hover {
  background: rgba(93, 134, 216, 0.28);
}

.profile-download-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-download-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 16, 29, 0.45);
}

.profile-download-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
}

.profile-download-card .body {
  flex: 1;
  min-width: 0;
}

.profile-download-card .title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.profile-download-card .sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.profile-download-card .actions {
  flex-shrink: 0;
}

.profile-download-card .actions a {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.profile-download-card .actions a:hover {
  color: var(--accent);
}

.profile-empty {
  margin: 0;
  padding: 1.1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 16, 29, 0.45);
  font-size: 0.9rem;
}

.profile-list .name {
  font-weight: 600;
  color: var(--text);
}

.profile-list .meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.profile-list a {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
