/* 账户页只定义资料区和编辑浮层；站点标题栏、字体、指标卡、页尾直接由
   bouquet.chat 的根样式表提供，保证独立地址与主站使用同一套视觉源码。 */

[hidden] {
  display: none !important;
}

.account-app {
  display: flex;
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  flex-direction: column;
  background: var(--white);
}

.account-page {
  flex: 1 0 auto;
  padding: 24px 0 66px;
}

.account-content {
  min-height: 420px;
}

.access-state {
  display: grid;
  min-height: min(58vh, 540px);
  place-items: center;
}

.state-card {
  display: grid;
  justify-items: center;
  width: min(100%, 520px);
  padding: 42px 32px;
  border: 1px solid #e4eaf3;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 18px 46px rgba(39, 82, 145, 0.07);
  text-align: center;
}

.state-card--loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: 11px;
}

.state-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 18px;
  color: var(--accent);
  border: 1px solid #cfe0fa;
  border-radius: 14px;
  background: var(--accent-soft);
}

.state-icon svg {
  width: 21px;
  height: 21px;
}

.state-card--loading .state-icon {
  width: 24px;
  height: 24px;
  margin: 0;
  color: var(--ink);
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.state-card--loading .state-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.6;
  animation: account-spin 1000ms linear infinite;
}

.state-card--loading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.state-card h1 {
  max-width: none;
  margin: 0;
  font-family: var(--font-site);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.045em;
}

.state-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.state-action svg {
  width: 16px;
  height: 16px;
}

.profile-content {
  padding-top: 0;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.site-header .profile-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.quiet-button,
.privacy-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 0;
  color: inherit;
  background: transparent;
  white-space: nowrap;
}

.quiet-button {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: color 180ms ease;
}

.quiet-button:hover,
.quiet-button:focus-visible {
  color: var(--ink);
}

.quiet-button svg,
.privacy-label svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.quiet-button:focus-visible,
.state-action:focus-visible,
.icon-button:focus-visible,
.secondary-button:focus-visible,
.primary-button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(23, 105, 245, 0.22);
  outline-offset: 4px;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 0 32px;
  text-align: center;
}

.avatar-frame {
  width: 112px;
  height: 112px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  background: #f3f3f4;
  box-shadow: 0 12px 34px rgba(17, 17, 20, 0.1);
}

.avatar-frame img,
.avatar-editor img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero h2 {
  max-width: none;
  margin: 14px 0 2px;
  font-family: var(--font-site);
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.055em;
}

.profile-handle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* metric-grid / metric-card are intentionally not redefined here. They come
   from the live main-site stylesheet, including its final white-site visual
   pass and responsive rules. */
.account-stats-section {
  padding-top: 36px;
  padding-bottom: 0;
}

.account-stats-section .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.activity-section {
  padding: 48px 0 8px;
}

.activity-heading {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 22px;
  margin-bottom: 18px;
}

.activity-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #85858d;
  font-size: 11px;
  white-space: nowrap;
}

.legend-cell,
.heat-cell {
  display: block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  box-sizing: border-box;
  aspect-ratio: 1;
  border-radius: 3px;
  background: #e5e5e7;
}

.legend-cell.is-level-1,
.heat-cell.is-level-1 {
  background: #d0d0d3;
}

.legend-cell.is-level-2,
.heat-cell.is-level-2 {
  background: #9b9ba2;
}

.legend-cell.is-level-3,
.heat-cell.is-level-3 {
  background: #55555d;
}

.heatmap {
  --heatmap-gap: clamp(4px, 0.4vw, 7px);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  padding: 24px 28px 22px;
  border-radius: var(--radius-lg);
  background: #f3f3f4;
}

.heatmap-months {
  display: grid;
  grid-template-columns: repeat(var(--month-count, 12), minmax(0, 1fr));
  min-width: 0;
  margin-left: 37px;
  margin-bottom: 10px;
  color: #85858d;
  font-size: 10px;
  line-height: 1;
}

.heatmap-months span {
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
  text-align: center;
}

.heatmap-body {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 11px;
  min-width: 0;
}

.heatmap-week-labels {
  display: grid;
  grid-template-rows: repeat(7, minmax(12px, 1fr));
  gap: var(--heatmap-gap);
  align-items: center;
  color: #85858d;
  font-size: 9px;
  line-height: 1;
  text-align: right;
}

.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(12px, 1fr);
  grid-template-rows: repeat(7, minmax(12px, auto));
  gap: var(--heatmap-gap);
  min-width: 0;
}

.heat-cell {
  width: 100%;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid rgba(16, 24, 40, 0.025);
}

.edit-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.edit-overlay[hidden] {
  display: none !important;
}

.edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.edit-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 700px);
  max-height: min(760px, calc(100dvh - 48px));
  overflow: auto;
  padding: 30px;
  border: 1px solid #e4eaf3;
  border-radius: 25px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(17, 17, 20, 0.24);
}

.edit-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.edit-panel-head h3 {
  max-width: none;
  font-family: var(--font-site);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.045em;
}

.edit-panel-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
  background: #f3f3f4;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.profile-form-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.profile-avatar-row {
  min-height: 72px;
}

.profile-field {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.profile-field input {
  width: 100%;
  height: 46px;
  margin-top: 0;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid #d0d5dd;
  border-radius: 11px;
  background: #fff;
  outline: none;
}

.profile-field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 20, 0.08);
}

.profile-field input::placeholder {
  color: #98a2b3;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 9px;
}

.avatar-editor img {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 1px solid #e4eaf3;
  border-radius: 50%;
  background: #f3f3f4;
}

.profile-user-id { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.profile-name-row { padding-top: 18px; border-top: 1px solid #e7ebf1; }
.profile-name-row > span { flex: 0 0 auto; }
.profile-name-row input { width: min(320px, 72%); margin-top: 0; }

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.secondary-button {
  color: var(--ink-soft);
  border: 0;
  background: #f1f2f4;
  box-shadow: 0 5px 14px rgba(17, 17, 20, 0.08);
}

.secondary-button:hover {
  color: var(--ink);
  background: #e7e9ec;
  box-shadow: 0 7px 18px rgba(17, 17, 20, 0.12);
}

.primary-button {
  color: #fff;
  border: 1px solid #111114;
  background: #111114;
  box-shadow: 0 11px 24px rgba(17, 17, 20, 0.16);
}

.primary-button:hover {
  background: #000;
  box-shadow: 0 16px 32px rgba(17, 17, 20, 0.22);
  transform: translateY(-1px);
}

.secondary-button svg,
.primary-button svg {
  width: 16px;
  height: 16px;
}

.form-message {
  min-height: 22px;
  margin: 16px 0 0;
  color: #b42318;
  font-size: 13px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

body.editor-open {
  overflow: hidden;
}

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

@media (max-width: 680px) {
  .site-header .header-inner {
    gap: 12px;
  }

  .site-header .brand-copy {
    min-width: 0;
  }

  .site-header .brand-tagline {
    display: none;
  }

  .account-page {
    padding: 18px 0 52px;
  }

  .site-header .profile-actions {
    flex-wrap: wrap;
    width: auto;
    justify-content: space-between;
    gap: 12px;
  }

  .profile-hero {
    padding-top: 36px;
    padding-bottom: 24px;
  }

  .account-stats-section {
    padding-top: 32px;
  }

  .account-stats-section .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .activity-section {
    padding-top: 36px;
  }

  .activity-heading {
    align-items: flex-end;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 14px;
  }

  .activity-legend {
    align-self: auto;
  }

  .heatmap {
    --heatmap-gap: 5px;
    padding: 20px 16px 18px;
  }

  .heatmap-months {
    grid-template-columns: repeat(var(--month-count, 12), minmax(0, 1fr));
    min-width: 879px;
  }

  .heatmap-body {
    min-width: 897px;
  }

  .heatmap-week-labels {
    grid-template-rows: repeat(7, 12px);
  }

  .heatmap-grid {
    grid-auto-columns: 12px;
    grid-template-rows: repeat(7, 12px);
    min-width: 879px;
  }

  .heat-cell {
    width: 12px;
    height: 12px;
    min-width: 12px;
  }

  .edit-overlay {
    align-items: end;
    padding: 0;
  }

  .edit-panel {
    width: 100%;
    max-height: calc(100dvh - 18px);
    padding: 24px 20px max(24px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    padding-top: 12px;
    background: #fff;
  }
}

@media (max-width: 430px) {
  .site-header .profile-actions {
    gap: 8px;
  }

  .site-header .quiet-button {
    font-size: 12px;
  }

  .account-stats-section .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .state-card--loading .state-icon svg {
    animation: none;
  }
}
