:root {
  --bg: #f4efeb;
  --paper: #fffdfb;
  --text: #302a27;
  --muted: #8a7f78;
  --line: #e7ddd7;
  --accent: #8b645a;
  --accent-dark: #76544c;
  --accent-soft: #f2e7e2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 30%, #fff 0, #f6f1ed 48%, #eee6df 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

a { color: inherit; text-decoration: none; }

.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 251, .94);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.back-link { color: var(--accent); font-size: 14px; font-weight: 800; }

.profile-page { padding: 44px 20px 64px; }
.profile-card {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 253, 251, .97);
  box-shadow: 0 18px 50px rgba(79, 59, 48, .11);
}

.profile-heading { margin-bottom: 30px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .24em; }
.profile-heading h1 { margin: 0; font-size: 30px; }
.profile-heading > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 14px; }

.avatar-section {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding: 18px;
  border-radius: 18px;
  background: #faf6f3;
}
.avatar-preview {
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8d6ce;
  color: #684a43;
  font-size: 29px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(139, 100, 90, .1);
}
.avatar-section strong { display: block; margin-bottom: 5px; }
.avatar-section p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.field { margin-top: 20px; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dacdc6;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 100, 90, .11); }
.field input[readonly] { background: #f7f3f0; color: var(--muted); }
.field small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

.avatar-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 11px; }
.avatar-options button {
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.avatar-options button:hover, .avatar-options button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

.profile-status { min-height: 22px; margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.profile-status.success { color: #55745d; }
.profile-status.error { color: #a34f46; }
.save-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(110deg, #9a6d5f, #8b6258 52%, #a77b6e);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
}
.save-button:hover { filter: brightness(1.04); }
.save-button:disabled { cursor: wait; opacity: .65; }

@media (max-width: 600px) {
  .profile-topbar { padding: 13px 15px; }
  .brand small { display: none; }
  .back-link { font-size: 13px; }
  .profile-page { padding: 18px 12px 36px; }
  .profile-card { border-radius: 20px; }
  .avatar-section { align-items: flex-start; }
}
