:root {
  --bg: #000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --separator: #2c2c2e;
  --text: #f5f5f7;
  --secondary: #8e8e93;
  --accent: #0a84ff;
  --done: #30d158;
  --new: #ff9f0a;
  --star: #ffd60a;
  --tabbar-h: 84px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.screen {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 24px) 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
}

h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 12px; color: #fff; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: #fff; }

.page-error { padding: 0 20px; }
.page-error p { color: var(--secondary); }

/* Tab bar */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: space-around;
  background: rgba(22, 22, 24, .92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: .5px solid var(--separator);
  z-index: 10;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
  min-height: 44px;
  font-size: 10px;
  font-weight: 500;
  color: var(--secondary);
  text-decoration: none;
}

.tab.on { color: #fff; }
.tab svg { width: 24px; height: 24px; }

/* Login */
.screen-bare { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 360px; padding: 0 20px; }
.login h1 { text-align: center; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; }
.login-form label { font-size: 13px; color: var(--secondary); margin: 14px 0 6px; }
.login-form input[type="text"],
.login-form input[type="password"] {
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 12px;
}
.login-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-error { margin: 0 0 4px; padding: 12px 14px; background: var(--surface); border-radius: 12px; color: #ff6961; }
.btn-primary {
  min-height: 50px;
  margin-top: 24px;
  padding: 0 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #000;
  background: #fff;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

/* Pages with a normal (non-bare) layout */
.page { padding: 0 20px; max-width: 560px; margin: 0 auto; }
.page .back { margin: 0 0 8px; }
.page h2.section { margin: 32px 0 10px; font-size: 19px; }
.muted, .hint { color: var(--secondary); font-size: 14px; margin: 4px 0 0; }
.login .muted { text-align: center; margin: -12px 0 8px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form-note { margin: 0 0 4px; padding: 12px 14px; background: var(--surface); border-radius: 12px; color: var(--done); }

.stack { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.stack label { font-size: 13px; color: var(--secondary); margin-top: 6px; }
.stack input[type="text"], .stack input[type="password"], .link-url {
  min-height: 48px; padding: 0 14px; font: inherit; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--separator); border-radius: 12px; width: 100%;
}
.stack input:focus, .link-url:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--text); background: var(--surface-2);
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
}
.btn-danger { color: #ff6961; }
.btn-danger-solid { background: #ff453a; color: #fff; }
.btn-wide { width: 100%; margin-top: 0; }
.section-link { margin: 32px 0 12px; }

.card { background: var(--surface); border-radius: 16px; padding: 16px; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 17px; }
.card .muted { margin: 0; }
.copied { margin: 0; color: var(--done); }

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 16px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px; border-top: .5px solid var(--separator); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .muted { margin: 0; }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: #000; font-weight: 700; }
.avatar-lg { width: 56px; height: 56px; font-size: 24px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.profile-head h1 { margin: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { position: relative; display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 2px solid transparent; }
.swatch input:checked + .swatch-dot { border-color: #fff; box-shadow: 0 0 0 2px var(--bg) inset; }
.swatch input:focus-visible + .swatch-dot { outline: 2px solid var(--accent); outline-offset: 2px; }

.attribution { margin: 40px 0 8px; color: var(--secondary); font-size: 12px; }
.attribution p { margin: 0 0 6px; }
