/* Profile proportions and materials follow the supplied reference. */
.app-surface {
  --profile-blue: #2851ff;
  --profile-ink: #171820;
  --profile-muted: #646b7b;
  --profile-border: #dce2ef;
  --profile-card: #ffffff;
  --profile-field: #f2f4fa;
  --profile-selected: #e8edff;
  --profile-shadow: 0 12px 30px #42578b12;
  --bg: #eef3fb;
  --text: var(--profile-ink);
  --muted: var(--profile-muted);
  --accent: var(--profile-blue);
  --surface: var(--profile-card);
  --surface-2: var(--profile-field);
  --line: var(--profile-border);
  min-height: 100dvh;
  background: radial-gradient(ellipse at 54% 15%, #e8efff 0%, #f2f5fb 68%, #eef3fb 100%);
  color: var(--profile-ink);
}
.profile-screen #shell-header { display: none; }
html:has(body.app-surface) { scrollbar-width: none; }
html:has(body.app-surface)::-webkit-scrollbar { display: none; }
.profile-screen .krug-ui .profile-redesign {
  --profile-top: max(clamp(32px, 10vw, 52px), env(safe-area-inset-top));
  width: min(100%, 560px);
  min-height: 100dvh;
  padding: var(--profile-top) clamp(14px, 3.75vw, 23px) calc(96px + env(safe-area-inset-bottom));
  margin: 0 auto;
}
.profile-screen .profile-primary:has(.profile-identity) {
  min-height: calc(100svh - var(--profile-top));
}
.profile-screen .profile-primary > header {
  margin: 0 0 15px;
  padding-inline: 8px;
}
.profile-screen .krug-ui .profile-redesign h1 {
  margin: 0;
  font-size: clamp(30px, 6.95vw, 39px);
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 820;
}
.profile-screen .krug-ui .profile-primary > header > p {
  margin-top: 6px;
  font-size: clamp(13px, 3.35vw, 17px);
  line-height: 1.35;
  color: var(--profile-muted);
  letter-spacing: -.015em;
}
.profile-screen .profile-redesign .settings-card {
  margin: 0 0 14px;
  padding: clamp(14px, 4vw, 22px);
  border: 1px solid var(--profile-border);
  border-radius: clamp(22px, 4.7vw, 27px);
  background: var(--profile-card);
  box-shadow: var(--profile-shadow);
}
.profile-screen .profile-summary {
  display: flex;
  align-items: center;
  gap: clamp(13px, 2.7vw, 16px);
  padding: 0 1px 12px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--profile-border);
}
.profile-screen .profile-summary > div { min-width: 0; }
.profile-screen .profile-summary .avatar-hero {
  width: clamp(54px, 16.5vw, 76px);
  height: clamp(54px, 16.5vw, 76px);
  box-shadow: 0 5px 10px #263b7020;
}
.profile-screen #profile-preview-name {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 4.9vw, 28px);
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 780;
}
.profile-screen .profile-summary p {
  margin-top: 4px;
  color: var(--profile-muted);
  font-size: clamp(15px, 3.2vw, 18px);
  line-height: 1.3;
}
.profile-screen .profile-redesign .field-label {
  margin: 15px 0 7px;
  color: var(--profile-ink);
  font-size: clamp(16px, 3.2vw, 18px);
  line-height: 1.25;
  letter-spacing: -.025em;
  font-weight: 750;
}
.profile-screen .profile-identity form > .field-label:first-child { margin-top: 0; }
.profile-screen .profile-redesign .profile-identity { padding-block: 15px 17px; }
.profile-screen .profile-redesign .text-field {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--profile-border);
  border-radius: 14px;
  background: var(--profile-field);
  color: var(--profile-ink);
  font-size: clamp(16px, 3.4vw, 19px);
  caret-color: var(--profile-blue);
  box-shadow: inset 0 1px 2px #586c9b04;
}
.profile-screen .profile-redesign .text-field:focus {
  border-color: color-mix(in srgb, var(--profile-blue) 42%, var(--profile-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--profile-blue) 9%, transparent);
}
.profile-screen .profile-redesign .avatar-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: clamp(3px, 1.6vw, 10px);
  margin: 10px 0 22px;
}
.profile-screen .profile-redesign .avatar-choice {
  width: 100%;
  max-width: 66px;
  min-width: 44px;
  min-height: 44px;
  aspect-ratio: 1;
  justify-self: center;
  padding: 0;
  border: 0;
  box-shadow: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.profile-screen .profile-redesign .avatar-choice .avatar-lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  box-shadow: 0 5px 10px #374c6b0c;
}
.profile-screen .profile-redesign .avatar-choice.selected {
  box-shadow: 0 0 0 3px var(--profile-card), 0 0 0 5px var(--profile-blue);
}
.profile-screen .profile-redesign .avatar-choice:active { transform: scale(.96); }
.profile-screen .profile-redesign .avatar-check {
  width: clamp(22px, 4.5vw, 26px);
  height: clamp(22px, 4.5vw, 26px);
  right: -5px;
  bottom: -5px;
  border: 2px solid var(--profile-card);
  background: var(--profile-blue);
  color: white;
  box-shadow: 0 3px 7px #2851ff24;
}
.profile-screen .profile-redesign .avatar-check svg { width: 15px; height: 15px; }
.profile-screen .profile-identity .primary-button {
  min-height: 46px;
  padding: 8px 15px;
  border: 1px solid #304cff;
  border-radius: 16px;
  background: linear-gradient(135deg, #2457ff, #1046fc);
  color: white;
  font-size: clamp(16px, 3.9vw, 20px);
  font-weight: 750;
  letter-spacing: -.025em;
  box-shadow: 0 10px 20px #2851ff20;
}
.profile-screen .krug-ui .profile-note {
  margin: 11px 1px 0;
  font-size: clamp(12px, 3.15vw, 14.5px);
  line-height: 1.3;
  color: var(--profile-muted);
  letter-spacing: -.01em;
}
.profile-screen .profile-redesign .profile-appearance { padding-block: 14px 16px; }
.profile-screen .profile-appearance .field-label { margin: 0 0 10px; font-size: clamp(18px, 3.5vw, 20px); }
.profile-screen .profile-redesign .theme-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
  border-radius: 19px;
  background: linear-gradient(115deg, var(--profile-field), color-mix(in srgb, var(--profile-border) 60%, var(--profile-field)));
}
.profile-screen .profile-redesign .theme-options button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.5vw, 9px);
  min-height: 46px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 17px;
  color: var(--profile-muted);
  font-size: clamp(12px, 2.65vw, 15px);
  line-height: 1.15;
  font-weight: 650;
}
.profile-screen .theme-options svg { width: clamp(20px, 4vw, 24px); height: clamp(20px, 4vw, 24px); flex: none; }
.profile-screen .profile-redesign .theme-options button.active {
  background: var(--profile-card);
  color: var(--profile-blue);
  border-color: var(--profile-border);
  box-shadow: 0 4px 10px #2c47951a;
}
.app-surface .krug-ui .bottom-nav {
  display: grid;
  width: min(calc(100% - clamp(28px, 9vw, 50px)), 510px);
  border: 1px solid var(--profile-border);
  border-radius: 29px 29px 0 0;
  background: var(--profile-card);
  box-shadow: 0 12px 30px #354c8b20;
}
.app-surface .krug-ui .bottom-nav button {
  min-height: 57px;
  flex-direction: column;
  gap: 4px;
  border-radius: 23px;
  font-size: 15px;
  font-weight: 650;
  color: var(--profile-muted);
}
.app-surface .bottom-nav button > svg { width: 25px; height: 25px; }
.app-surface .krug-ui .bottom-nav button.active {
  background: var(--profile-selected);
  color: var(--profile-blue);
  box-shadow: none;
}
.profile-screen .krug-ui .bottom-nav {
  width: min(calc(100% - clamp(28px, 7.5vw, 46px)), 514px);
  padding: 5px 5px calc(5px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0;
}
.profile-screen .krug-ui .bottom-nav button {
  min-height: 50px;
  border-radius: 19px;
  font-size: clamp(13px, 3.4vw, 15px);
}
.profile-screen .bottom-nav button > svg { width: 21px; height: 21px; }
.app-surface:has(.bottom-nav) #notice {
  bottom: calc(81px + max(14px, env(safe-area-inset-bottom)));
}
#notice { pointer-events: none; }
.profile-screen .profile-redesign .install-help { margin: 17px 0 0; border-color: var(--profile-border); box-shadow: var(--profile-shadow); }
.profile-screen .profile-redesign .install-help summary { font-size: 12px; }

/* A single atlas keeps each personal sign identical on every device and screen. */
:is(.krug-ui, .ward-avatar) .avatar.avatar-art {
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  background-image: url('/profile-avatars.png');
  background-size: 333.3333% 222.2222%;
  background-repeat: no-repeat;
  border-radius: 50%;
}
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-sun { background-position: 2.38% 4.55%; }
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-wave { background-position: 50% 4.55%; }
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-leaf { background-position: 97.62% 4.55%; }
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-bolt { background-position: 2.38% 95.45%; }
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-moon { background-position: 50% 95.45%; }
:is(.krug-ui, .ward-avatar) .avatar-art.avatar-cherry { background-position: 97.62% 95.45%; }

:root[data-theme='dark'] .app-surface {
  --bg: #101725;
  --profile-blue: #94a7ff;
  --profile-ink: #f3f5ff;
  --profile-muted: #adb5ca;
  --profile-border: #353f58;
  --profile-card: #1c2436;
  --profile-field: #151d2e;
  --profile-selected: #303d64;
  --profile-shadow: 0 12px 30px #05091640;
  background: radial-gradient(ellipse at 54% 15%, #1a2540 0%, #101725 72%, #0e1421 100%);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme='system'] .app-surface {
    --bg: #101725;
    --profile-blue: #94a7ff;
    --profile-ink: #f3f5ff;
    --profile-muted: #adb5ca;
    --profile-border: #353f58;
    --profile-card: #1c2436;
    --profile-field: #151d2e;
    --profile-selected: #303d64;
    --profile-shadow: 0 12px 30px #05091640;
    background: radial-gradient(ellipse at 54% 15%, #1a2540 0%, #101725 72%, #0e1421 100%);
  }
}
@media (max-width: 360px) {
  .profile-screen .krug-ui .profile-redesign { padding-inline: 13px; }
  .profile-screen .profile-redesign .settings-card { padding-inline: 13px; }
  .profile-screen .profile-redesign .avatar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
  }
  .profile-screen .profile-redesign .theme-options button { gap: 4px; font-size: 11px; }
  .profile-screen .profile-redesign .theme-options svg { width: 18px; height: 18px; }
}
@media (hover: hover) and (pointer: fine) {
  .profile-screen .profile-redesign .avatar-choice:hover { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .profile-screen .profile-redesign .avatar-choice { transition: none; }
}
