:root {
  --bg: #10151c;
  --card: #18222d;
  --text: #e7eef6;
  --muted: #93a4b8;
  --accent: #3ec6ff;
  --accent-2: #1f8fbf;
  --accent-text: #04202b;
  --line: rgba(255, 255, 255, 0.08);
  --danger: #ff6d7a;
  --ok: #3dd68c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(900px 320px at 50% -120px, rgba(62, 198, 255, 0.18), transparent 60%),
    var(--bg);
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }

.hidden { display: none !important; }

.loader {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.fatal {
  width: min(480px, calc(100% - 32px));
  margin: 24px auto;
  padding: 18px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  line-height: 1.45;
}

.screen {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(108px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

h2, h3 { margin: 0; }

h2 { font-size: 18px; }

h3 { margin-bottom: 10px; font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(62, 198, 255, 0.15);
  color: var(--accent);
  font-weight: 700;
}

.profile-text p,
.meta {
  margin: 4px 0 0;
  font-size: 13px;
}

.muted { color: var(--muted); }

.pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(61, 214, 140, 0.15);
  color: var(--ok);
  white-space: nowrap;
}

.pill.bad {
  background: rgba(255, 109, 122, 0.15);
  color: var(--danger);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.row h3 { margin: 0; }

.meter {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.meter-fill.warn {
  background: linear-gradient(90deg, #c9842a, var(--danger));
}

.meter-fill.unlimited { opacity: 0.35; }

.split, .hint {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.hint { margin: 0 0 10px; }

.spaced { margin-top: 16px; }

.keybox {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-text);
}

.btn:active { transform: scale(0.99); }

.btn:disabled { opacity: 0.6; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 109, 122, 0.45);
}

.btn-small {
  padding: 10px 8px;
  font-size: 13px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.who { min-width: 0; }

.who strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

input:focus { border-color: var(--accent); }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 20px;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.nav-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 12px;
  border-radius: 14px;
}

.nav-btn.active {
  background: var(--card);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  margin: 0 auto;
  width: min(448px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  background: #123044;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.error {
  background: #3a1d24;
  color: #ffb4b4;
}
