:root {
  --canvas: #f5f8fc;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --ink: #202733;
  --muted: #6e7887;
  --soft: #e8eef6;
  --line: #d8e0ea;
  --accent: #4d6f9f;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, #dfe9f8, transparent 38%),
    linear-gradient(180deg, #fbfdff, var(--canvas));
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button,
input,
textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-link:focus {
  transform: translateY(0);
}

.bio-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-rows: 1fr auto;
  padding: clamp(28px, 7vw, 72px) 18px 24px;
}

.bio-card {
  width: min(100%, 440px);
  margin: auto;
  text-align: center;
}

.avatar {
  display: block;
  width: 96px;
  height: 96px;
  margin-inline: auto;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 18px 44px rgba(45, 60, 80, 0.15),
    0 0 0 6px rgba(255, 255, 255, 0.72);
}

.site-title {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 18px 0 3px;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.022em;
}

.handle,
.bio-text {
  margin: 0;
  color: var(--muted);
}

.handle {
  font-size: 14px;
}

.bio-text {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.65;
  text-wrap: pretty;
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.social-item {
  position: relative;
  display: grid;
  place-items: center;
}

.social-trigger {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow:
    0 10px 28px rgba(45, 60, 80, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  color: var(--ink);
  transition:
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.social-trigger img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.social-qr {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  z-index: 4;
  display: grid;
  gap: 7px;
  width: 174px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(45, 60, 80, 0.16);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition:
    opacity 150ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.social-qr::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  transform: translateX(-50%) rotate(45deg);
}

.social-qr img {
  width: 148px;
  height: 148px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--soft);
}

.social-item:hover .social-qr,
.social-item:focus-within .social-qr {
  opacity: 1;
  transform: translate(-50%, 0);
}

.social-trigger:active,
.link-row:active,
.admin-actions button:active,
.add-row-button:active,
.remove-row-button:active {
  transform: scale(0.96);
}

.link-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.link-row {
  display: grid;
  min-height: 68px;
  grid-template-columns: 44px 1fr 22px;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow:
    0 16px 38px rgba(45, 60, 80, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.68);
  text-align: left;
  transition:
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.link-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
}

.link-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-body {
  min-width: 0;
}

.link-title,
.link-description {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-title {
  font-size: 15px;
  font-weight: 720;
}

.link-description {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.link-arrow {
  color: var(--muted);
  font-size: 18px;
}

.bio-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
}

.bio-footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 18px;
}

.admin-panel {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 38px);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 20px 50px rgba(45, 60, 80, 0.1);
}

.login-panel {
  max-width: 520px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.admin-panel h1 {
  margin: 18px 0 0;
}

.admin-panel p {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.back-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.admin-form {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(232, 238, 246, 0.62);
}

.admin-tab {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 780;
}

.admin-tab.is-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(45, 60, 80, 0.08);
}

.tab-panel[hidden] {
  display: none;
}

.admin-form label,
.edit-row label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.admin-form input,
.admin-form textarea,
.edit-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.admin-form input {
  min-height: 44px;
  padding: 10px 12px;
}

.admin-form input[type="file"],
.edit-row input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.admin-form textarea,
.small-textarea {
  min-height: 460px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.admin-form .small-textarea {
  min-height: 150px;
  padding-block: 9px;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.admin-form input:focus,
.admin-form textarea:focus,
.edit-row input:focus,
.file-picker:focus-within,
.social-trigger:focus-visible,
.link-row:focus-visible,
.admin-actions button:focus-visible,
.admin-tab:focus-visible,
.add-row-button:focus-visible,
.remove-row-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.admin-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 750;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.add-row-button,
.remove-row-button {
  width: fit-content;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.add-row-button {
  margin-top: 2px;
  color: var(--accent);
}

.remove-row-button {
  grid-column: 1 / -1;
  color: var(--muted);
}

.remove-row-button[hidden] {
  display: none;
}

.admin-actions span {
  color: var(--muted);
  font-size: 14px;
}

.form-section {
  display: grid;
  gap: 16px;
  padding-top: 0;
}

.form-section + .form-section {
  border-top: 0;
  padding-top: 0;
}

.form-section-head {
  display: grid;
  gap: 5px;
}

.form-section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.012em;
}

.form-section-head p {
  margin: 0;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-all {
  grid-column: 1 / -1;
}

.span-wide {
  grid-column: span 2;
}

.upload-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.file-picker {
  position: relative;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  max-width: 100%;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border-right: 1px solid var(--line);
  background: var(--soft);
  font-weight: 750;
  white-space: nowrap;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  padding: 0 13px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-current img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--soft);
}

.upload-placeholder {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.row-list {
  display: grid;
  gap: 12px;
}

.edit-row {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.edit-row legend {
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.social-edit-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 2fr);
}

.link-edit-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (hover: hover) {
  .social-trigger:hover,
  .link-row:hover {
    transform: translateY(-1px);
  }

  .link-row:hover {
    box-shadow:
      0 20px 44px rgba(45, 60, 80, 0.12),
      inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  }
}

@media (max-width: 460px) {
  .bio-page {
    padding-inline: 16px;
  }

  .link-row {
    border-radius: 16px;
  }

  .admin-panel {
    padding: 18px;
  }

  .form-grid,
  .social-edit-row,
  .link-edit-row {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
