/* Profile screens for the new UI (picker, create, edit, delete, PIN).
   Hand-written in the new UI's design — frosted 30px panels, white pill
   actions, round avatars, theme-coloured toggles. Do not regenerate this
   file from the main app's styles (tools/extract-profile-css.mjs). */

body.modal-open { overflow: hidden; }
.hidden { display: none !important; }

.profile-overlay {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px;
  font-family: var(--font, Inter, system-ui, sans-serif); color: #fff;
}
.profile-scrim {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(24px) saturate(1.2); backdrop-filter: blur(24px) saturate(1.2);
  animation: profileFade 0.2s ease;
}
.profile-dialog {
  position: relative; z-index: 1; width: min(460px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: none;
  border-radius: 30px; background: rgba(16, 16, 18, 0.72); border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 100px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(40px) saturate(1.6); backdrop-filter: blur(40px) saturate(1.6);
  animation: profileIn 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-dialog::-webkit-scrollbar { display: none; }
.profile-dialog:has(.profile-grid) { width: min(640px, 100%); }
@keyframes profileFade { from { opacity: 0; } }
@keyframes profileIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

.icon-img { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.close-button {
  position: absolute; top: 20px; right: 20px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 999px; background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.7); transition: background-color 0.15s, color 0.15s;
}
.close-button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.profile-content { padding: 44px 36px 36px; }
.profile-head { display: grid; justify-items: center; gap: 6px; margin-bottom: 28px; text-align: center; }
.profile-head-icon {
  width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.85);
}
.profile-head-icon .icon-img { width: 24px; height: 24px; }
.profile-head h2 { font-size: 22px; line-height: 33px; font-weight: 600; letter-spacing: -0.01em; }
.profile-head p { font-size: 14px; line-height: 21px; color: rgba(255, 255, 255, 0.45); }

/* Picker */
.profile-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px 18px; }
.profile-tile {
  position: relative; width: 112px; display: grid; justify-items: center; gap: 10px; padding: 6px 4px; border-radius: 18px;
  color: rgba(255, 255, 255, 0.85); text-align: center; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-tile:hover { transform: translateY(-3px); color: #fff; }
.profile-tile strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 20px; font-weight: 500; }
.profile-tile small {
  position: absolute; top: 4px; right: 12px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.profile-tile-avatar, .profile-unlock-avatar {
  display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--profile-color, rgba(255, 255, 255, 0.16));
  color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.profile-tile-avatar { width: 88px; height: 88px; font-size: 32px; transition: box-shadow 0.25s, transform 0.25s; }
.profile-tile-avatar img, .profile-unlock-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-tile:hover .profile-tile-avatar, .profile-tile:focus-visible .profile-tile-avatar {
  box-shadow: 0 0 0 3px rgba(10, 10, 12, 0.9), 0 0 0 5px var(--accent, #95ff50), 0 14px 30px rgba(0, 0, 0, 0.45);
}
.active-profile-tile .profile-tile-avatar { box-shadow: 0 0 0 3px rgba(10, 10, 12, 0.9), 0 0 0 5px rgba(255, 255, 255, 0.85); }
.profile-tile-action .profile-tile-avatar { background: rgba(255, 255, 255, 0.04); border: 1.5px dashed rgba(255, 255, 255, 0.22); box-shadow: none; color: rgba(255, 255, 255, 0.75); font-size: 26px; }
.profile-tile-action .profile-tile-avatar .icon-img { width: 28px; height: 28px; }
.profile-tile:focus-visible { outline: none; }

/* Forms */
.profile-form { display: grid; gap: 14px; }
.profile-field { display: grid; gap: 8px; }
.profile-field > span { padding-left: 4px; font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.55); }
.profile-field input {
  width: 100%; height: 53px; padding: 14px 20px; border-radius: 16px; outline: none;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); color: #fff; font: inherit; font-size: 15px;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.profile-field input::placeholder { color: rgba(255, 255, 255, 0.35); }
.profile-field input:focus { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.22); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04); }

.profile-picture-field {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; cursor: pointer;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); transition: background-color 0.2s, border-color 0.2s;
}
.profile-picture-field:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.14); }
.profile-picture-field input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.profile-picture-preview {
  width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.7);
}
.profile-picture-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-picture-preview svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-picture-field > span:nth-child(2) { flex: 1; display: grid; gap: 2px; min-width: 0; }
.profile-picture-field strong { font-size: 14.5px; font-weight: 500; color: rgba(255, 255, 255, 0.9); }
.profile-picture-field small { font-size: 12.8px; color: rgba(255, 255, 255, 0.45); }
.profile-upload-chip { padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1); font-size: 12.5px; font-weight: 600; pointer-events: none; }

.profile-colors { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 6px 0 2px; }
.profile-colors label { position: relative; width: 30px; height: 30px; cursor: pointer; }
.profile-colors input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.profile-colors span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--profile-color); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); transition: transform 0.15s, box-shadow 0.15s; }
.profile-colors label:hover span { transform: scale(1.08); }
.profile-colors input:checked + span { box-shadow: 0 0 0 2px rgba(16, 16, 18, 0.95), 0 0 0 4px rgba(255, 255, 255, 0.9); }
.profile-colors input:focus-visible + span { box-shadow: 0 0 0 2px rgba(16, 16, 18, 0.95), 0 0 0 4px var(--accent, #95ff50); }

.profile-setting-row, .profile-danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
}
.profile-setting-copy, .profile-danger-copy { display: grid; gap: 3px; min-width: 0; }
.profile-setting-copy strong, .profile-danger-copy strong { font-size: 14.5px; line-height: 21px; font-weight: 500; color: rgba(255, 255, 255, 0.9); }
.profile-setting-copy small, .profile-danger-copy small { font-size: 12.8px; line-height: 17.9px; color: rgba(255, 255, 255, 0.55); }
.profile-pin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }

.profile-danger-zone { margin-top: 4px; background: rgba(239, 68, 68, 0.06); border-color: rgba(239, 68, 68, 0.18); }
.profile-danger-copy strong { color: #fca5a5; }

/* Buttons inside profile screens */
.profile-overlay .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px;
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
}
.profile-overlay .button:active { transform: scale(0.97); }
.profile-overlay .button:disabled { opacity: 0.45; cursor: default; transform: none; }
.profile-overlay .button-glass { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; }
.profile-overlay .button-glass:hover { background: rgba(255, 255, 255, 0.14); }
.profile-overlay .button-red { background: #fff; color: #000; }
.profile-overlay .button-red:hover { background: #e9e9e9; }
.profile-overlay .button-red:disabled { background: rgba(255, 255, 255, 0.45); }
.profile-pin-action.button { height: 36px; padding: 0 14px; font-size: 13px; }
.profile-pin-remove { color: #fca5a5 !important; }
.profile-delete-button.button { height: 36px; padding: 0 14px; font-size: 13px; background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.profile-delete-button.button:hover { background: rgba(239, 68, 68, 0.24); color: #fff; }

.profile-actions { display: flex; gap: 10px; margin-top: 10px; }
.profile-actions .button { height: 52px; font-size: 15px; }
.profile-actions .button-glass { flex: 0 0 auto; padding: 0 24px; }
.profile-actions .button-red { flex: 1 1 auto; }
.profile-delete-confirm .profile-actions .button-red { background: #ef4444; color: #fff; }
.profile-delete-confirm .profile-actions .button-red:hover { background: #dc2626; }

.profile-error {
  padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 19px; text-align: center;
  background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.25); color: #fecaca;
}

/* Unlock and delete confirmation */
.profile-unlock-avatar { justify-self: center; width: 84px; height: 84px; font-size: 30px; }
.profile-unlock-name { justify-self: center; margin-top: -4px; font-size: 16px; font-weight: 600; }
.profile-delete-message { text-align: center; font-size: 14px; line-height: 22px; color: rgba(255, 255, 255, 0.55); }
.profile-delete-confirm[aria-busy="true"] .button { pointer-events: none; opacity: 0.6; }

/* PIN entry dialog */
.profile-pin-overlay { position: absolute; inset: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.profile-pin-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.profile-pin-card {
  position: relative; z-index: 1; width: min(380px, 100%); padding: 36px 30px 28px; border-radius: 30px; text-align: center;
  background: rgba(20, 20, 22, 0.88); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6); backdrop-filter: blur(40px) saturate(1.6); animation: profileIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.profile-pin-card h2 { font-size: 20px; line-height: 30px; font-weight: 600; }
.profile-pin-card > p { margin-top: 4px; font-size: 14px; color: rgba(255, 255, 255, 0.45); }
.profile-pin-code { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.profile-pin-digit {
  min-width: 0;
  width: 56px; height: 64px; border-radius: 16px; outline: none; text-align: center; font: inherit; font-size: 26px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.profile-pin-digit:focus { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.3); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05); }
.profile-pin-card .profile-pin-error { min-height: 20px; margin-top: 12px; font-size: 13px; color: #fca5a5; }
.profile-pin-dialog-actions { display: flex; gap: 10px; margin-top: 8px; }
.profile-pin-dialog-actions .button { flex: 1; height: 48px; }
.profile-overlay.is-unlocking { grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.is-unlocking .profile-dialog { width: min(380px, 100%); min-width: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; animation: none; }
.is-unlocking .profile-content { padding: 0; }
.is-unlocking .profile-dialog > .close-button { display: none; }
.is-unlocking .profile-pin-card { width: 100%; }

@media (max-width: 520px) {
  .profile-overlay { padding: 12px; place-items: end center; }
  .profile-dialog { border-radius: 28px; }
  .profile-content { padding: 40px 20px 24px; }
  .profile-tile { width: 96px; }
  .profile-tile-avatar { width: 76px; height: 76px; font-size: 28px; }
  .profile-setting-row, .profile-danger-zone { flex-wrap: wrap; }
  .profile-pin-actions { justify-content: flex-start; }
  .profile-tile strong { white-space: normal; line-height: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .profile-pin-digit { width: 52px; height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-dialog, .profile-scrim, .profile-pin-card { animation: none; }
}
