:root {
  --ink: #1B1F2A;
  --paper: #F7F5EF;
  --paper-dim: #EDEAE1;
  --sage: #8FA998;
  --sage-deep: #5F7B68;
  --text: #20232B;
  --text-muted: #6B6F76;
  --line: rgba(32, 35, 43, 0.12);
  --radius: 18px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(143,169,152,0.16), transparent 60%),
    var(--ink);
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

/* Edit toggle */
.edit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 24px;
  padding: 9px 16px 9px 12px;
  background: transparent;
  border: 1px solid rgba(247,245,239,0.25);
  border-radius: 999px;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.edit-toggle:hover { border-color: rgba(247,245,239,0.5); }
.edit-toggle__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--sage);
}
.edit-toggle[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--ink);
}
.edit-toggle[aria-pressed="true"] .edit-toggle__dot { background: var(--ink); }
.edit-toggle[aria-pressed="true"] .edit-toggle__label::after { content: " đang bật"; }

/* Card */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 44px 40px 32px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.45);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.avatar {
  position: relative;
  width: 84px;
  height: 84px;
  flex: none;
  border-radius: 50%;
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--paper-dim);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar__initial {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  color: var(--paper);
}
.avatar__edit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27,31,42,0.72);
  color: var(--paper);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}

.identity { min-width: 0; }

.name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 4px;
  color: var(--ink);
}

.tagline {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

.section {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.section__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section__label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--sage-deep);
  margin: 0 0 12px;
}

.bio {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  max-width: 62ch;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13.5px;
  color: var(--text);
}
.tag__remove, .link__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.link:last-child { border-bottom: none; }
.link__anchor {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  text-decoration: none;
  color: var(--text);
}
.link__anchor:hover .link__label { color: var(--sage-deep); }
.link__label {
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.link__url {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-btn {
  background: none;
  border: none;
  color: var(--sage-deep);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.card__footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 20px;
}

.save-state {
  font-size: 12.5px;
  color: var(--text-muted);
}

.save-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.save-btn:hover { background: var(--sage-deep); }

.hint {
  text-align: center;
  color: rgba(247,245,239,0.55);
  font-size: 12.5px;
  margin-top: 22px;
}

/* Editing state */
[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed var(--sage-deep);
  cursor: text;
}
[contenteditable="true"]:focus {
  background: rgba(143,169,152,0.12);
}

@media (max-width: 480px) {
  .card { padding: 32px 22px 26px; }
  .card__header { flex-direction: column; align-items: flex-start; }
  .name { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}