:root {
  color-scheme: light dark;
  --canvas: #f3f0ea;
  --card: #fffdfb;
  --ink: #161c2a;
  --muted: #6b717d;
  --chip: #e8e3d9;
  --accent: #3d5c80;
  --gold: #dbba6b;
  --danger: #c23b2e;
  --danger-soft: rgba(194, 59, 46, 0.12);
  --lock-top: #121a2e;
  --lock-bottom: #1f3847;
  --accent-top: #3b6b94;
  --accent-bottom: #24516b;
  --unlock-field: rgba(255, 255, 255, 0.08);
  --unlock-muted: rgba(255, 255, 255, 0.7);
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #10141c;
    --card: #1c222d;
    --ink: #f4f1ea;
    --muted: #9ea7b5;
    --chip: #2a323f;
    --accent: #e2c37a;
    --danger-soft: rgba(255, 107, 97, 0.16);
    --shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--lock-top);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
}

body.phase-unlocked {
  background: var(--canvas);
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

input,
textarea {
  font-size: 16px;
  border: 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 0;
}

input:focus,
textarea:focus,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: none;
  border: 0;
}

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

#app {
  min-height: 100dvh;
  min-height: 100svh;
  background: inherit;
}

.shell {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.screen-scroll {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 18px 32px;
}

.launch,
.unlock,
.setup {
  min-height: 100dvh;
  min-height: 100svh;
}

.launch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: linear-gradient(180deg, var(--lock-top), var(--lock-bottom));
  color: var(--gold);
}

.lock-mark {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(219, 186, 107, 0.35);
  color: var(--gold);
}

.lock-hero {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}

.lock-hero-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(219, 186, 107, 0.32);
  box-shadow: 0 0 0 10px rgba(219, 186, 107, 0.05);
}

.lock-hero-glow {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 215, 140, 0.22), transparent 70%);
}

.lock-hero-core {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(160deg, rgba(31, 56, 71, 0.95), rgba(12, 18, 34, 0.98));
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.unlock-waiting .lock-hero-ring {
  animation: lockPulse 1.8s ease-in-out infinite;
}

@keyframes lockPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(219, 186, 107, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.unlock {
  background: linear-gradient(180deg, var(--lock-top), var(--lock-bottom));
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 28px calc(48px + env(safe-area-inset-bottom));
}

.unlock-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
}

.unlock h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.4px;
}

.unlock p {
  margin: 8px 0 0;
  color: var(--unlock-muted);
  font-size: 17px;
}

.unlock-actions {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.unlock-password-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.unlock-wait-row {
  display: flex;
  justify-content: center;
  min-height: 28px;
}

.unlock-spinner {
  width: 24px;
  height: 24px;
}

.unlock-field {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px;
  background: var(--unlock-field);
  color: #fff;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.unlock-field:focus,
.unlock-field:focus-visible {
  outline: none;
  box-shadow: none;
  border: 0;
}

.unlock-field::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.unlock-error {
  color: #ffb8ad;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.btn-secondary.unlock-alt {
  color: rgba(255, 255, 255, 0.85);
}

.setup {
  background: var(--canvas);
}

.setup-inner {
  padding: 24px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.setup-mark {
  color: var(--gold);
  margin-top: 12px;
}

.setup-mark svg {
  width: 42px;
  height: 42px;
}

.setup h1 {
  margin: 14px 0 0;
  font-size: 34px;
}

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 0;
  gap: 8px;
}

.toolbar-cluster {
  display: flex;
  gap: 8px;
}

.title {
  margin: 4px 18px 12px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-title {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.unlock .brand-title {
  font-size: 28px;
  letter-spacing: 0.16em;
}

.setup .brand-title {
  font-size: 28px;
  letter-spacing: 0.08em;
}

.title.brand-title {
  font-size: 28px;
  letter-spacing: 0.14em;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--chip);
  color: var(--muted);
}

.search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 18px 28px;
}

.row,
.card {
  background: var(--card);
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
}

.account-row {
  border-radius: 18px;
}

.row-copy {
  min-width: 0;
  flex: 1;
}

.row-copy h2,
.row-copy h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.row-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--chip);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.chevron {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  flex-shrink: 0;
}

.avatar {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-user {
  border-radius: 50%;
}

.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 32px 64px;
  gap: 10px;
}

.empty-icon {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.empty h2 {
  margin: 0;
  font-size: 22px;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.4;
}

.service-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px 18px;
}

.service-head h1 {
  margin: 0;
  font-size: 22px;
}

.service-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.detail-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 12px 0 8px;
}

.detail-hero h1 {
  margin: 0;
  font-size: 22px;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  border-radius: 22px;
  padding: 18px;
}

.card-button {
  width: 100%;
  border: 0;
  text-align: left;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.field-value {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 500;
  word-break: break-word;
}

.field-value.mono,
input.mono {
  font-family: var(--mono);
}

.sheet .card input.mono,
.sheet .card input,
.sheet .card textarea,
.sheet .password-card input {
  width: 100%;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--ink);
  margin-top: 8px;
  padding: 0;
}

.sheet .card input.mono:focus,
.sheet .card input:focus,
.sheet .card textarea:focus,
.sheet .password-card input:focus {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.sheet .password-card input[type="password"] {
  letter-spacing: 0.18em;
}

.sheet .password-card input[type="text"].mono {
  letter-spacing: normal;
}

.icon-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.linkish {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  padding: 0;
}

.copy-wide {
  width: 100%;
  border: 0;
  margin-top: 12px;
  padding: 10px 0;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.danger-btn {
  width: 100%;
  border: 0;
  margin-top: 8px;
  padding: 14px 0;
  border-radius: 16px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 17px;
  font-weight: 600;
}

.circle-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--chip);
  color: var(--ink);
}

.circle-btn.filled {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-top), var(--accent-bottom));
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-top), var(--accent-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:disabled {
  opacity: 0.55;
}

.btn-secondary {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-capsule {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-top), var(--accent-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.nav-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 0;
  min-height: 44px;
}

.nav-inline h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.nav-back {
  flex-shrink: 0;
}

.nav-spacer {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.text-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 17px;
  padding: 8px 10px;
}

.text-btn.strong {
  font-weight: 600;
}

.text-btn:disabled {
  opacity: 0.45;
}

.form-avatar {
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field input,
.field textarea {
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  resize: vertical;
  width: 100%;
}

.divider {
  height: 1px;
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  margin: 16px 0;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px;
  -webkit-overflow-scrolling: touch;
}

.chip {
  border: 0;
  background: var(--chip);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}

.error {
  color: #c23b2e;
  font-size: 15px;
  font-weight: 500;
}

.hint {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.install-banner,
.warn-card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.warn-card strong {
  color: var(--ink);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-row {
  width: 100%;
  border: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  color: inherit;
}

.settings-row h2 {
  margin: 0;
  font-size: 16px;
}

.settings-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-toggle-row {
  cursor: default;
}

.settings-toggle-row > div {
  min-width: 0;
  flex: 1;
}

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: color-mix(in srgb, var(--muted) 38%, var(--chip));
  transition: background 0.2s ease;
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

.toggle.on {
  background: #34c759;
}

.toggle.on .toggle-knob {
  transform: translateX(20px);
}

@media (prefers-color-scheme: dark) {
  .toggle {
    background: color-mix(in srgb, var(--muted) 45%, #000);
  }

  .toggle.on {
    background: #30d158;
  }
}

.sheet-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 30;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 8%;
  background: var(--canvas);
  border-radius: 16px 16px 0 0;
  z-index: 31;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 430px;
  margin: 0 auto;
}

.sheet-body {
  flex: 1;
  overflow: auto;
  padding: 8px 18px 28px;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100% - 48px));
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  z-index: 41;
  padding: 20px 18px 16px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.modal h2 {
  margin: 0;
  font-size: 18px;
}

.modal p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
}

.modal-actions button {
  border: 0;
  background: none;
  padding: 12px;
  font-size: 17px;
  border-top: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
}

.modal-actions .danger {
  color: var(--danger);
  font-weight: 600;
}

.modal-actions .strong {
  color: var(--accent);
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hidden {
  display: none !important;
}

@media (min-width: 700px) {
  .sheet {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: 430px;
    max-height: 86vh;
    transform: translate(-50%, -50%);
    border-radius: 22px;
    margin: 0;
  }
}
