:root {
  --sky: #e6e6e8;
  --header: #2a2a2a;
  --link: #8a1c1c;
  --text: #1c1c1c;
  --muted: #6b6b70;
  --line: #d4d4d8;
  --white: #ffffff;
  --warn: #8a1c1c;
  --accent: #8a1c1c;
  --hero: #f2f2f4;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--sky);
  color: var(--text);
  font: 14px/1.4 Helvetica, Arial, sans-serif;
}
body {
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.top {
  background: var(--header);
  color: #fff;
  border-bottom: 1px solid #1a1a1a;
}
.top-inner {
  max-width: 764px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.4px;
}
.brand:hover { text-decoration: none; color: #fff; }
.brand svg, .brand .logo {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 8px;
  object-fit: cover;
}
.auth .brand { color: var(--header); }
.nav { display: flex; gap: 16px; align-items: center; font-size: 13px; }
.nav a, .nav button { color: #d4d4d4; background: none; border: 0; padding: 8px 0; white-space: nowrap; }
.nav a.active { color: #fff; font-weight: 700; }

.wrap {
  max-width: 764px;
  margin: 16px auto 48px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  padding: 0 12px;
}

.card {
  background: var(--white);
  border: 1px solid #d0d0d4;
  border-radius: 8px;
  overflow: hidden;
}

.hero {
  background: var(--hero);
  padding: 16px 18px 8px;
  border-bottom: 1px solid var(--line);
}
.hero h1 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.lede {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.4;
  color: #444;
}
.first-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}
.first-actions .btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.first-actions .btn:hover { text-decoration: none; }

.composer { padding: 0 18px 14px; }
.composer textarea {
  width: 100%;
  border: 1px solid #c8c8cc;
  border-radius: 4px;
  padding: 10px;
  resize: none;
  min-height: 72px;
  outline: none;
  font-size: 18px;
  line-height: 1.35;
}
.composer textarea:focus { border-color: var(--accent); }
.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.composer-bar .count { margin-left: auto; }
.photo-btn { font-weight: 700; }
.photo-btn input { display: none; }
.shot-preview {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.shot-preview img {
  max-width: 160px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.shot {
  display: block;
  margin-top: 6px;
  width: fit-content;
  max-width: 220px;
}
.shot img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.count.over { color: var(--warn); font-weight: 700; }

.btn {
  background: linear-gradient(#a32222, #7a1515);
  border: 1px solid #5c1010;
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
  padding: 6px 12px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
  background: var(--white);
  color: var(--link);
  border: 1px solid #c8c8cc;
}
.btn-small { padding: 4px 10px; font-size: 12px; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
}
.tabs a {
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.tabs a.active {
  color: var(--text);
  border-bottom: 3px solid var(--accent);
}

.twonk {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.twonk:last-child { border-bottom: 0; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; border-radius: 10px; font-size: 22px; }
.handle { font-weight: 700; margin-right: 6px; }
.text { font-size: 18px; line-height: 1.35; word-break: break-word; }
.meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.side { display: flex; flex-direction: column; gap: 12px; }
.side h2 {
  margin: 0;
  padding: 10px 12px 6px;
  font-size: 14px;
}
.side .pad { padding: 0 12px 12px; font-size: 13px; color: #55555a; }
.stat { display: flex; gap: 12px; padding: 0 12px 12px; font-size: 12px; color: var(--muted); }
.stat b { color: var(--text); display: block; font-size: 16px; }

.auth {
  max-width: 420px;
  margin: 40px auto;
  background: var(--white);
  border: 1px solid #d0d0d4;
  border-radius: 8px;
  padding: 24px;
}
.auth h1 { margin: 0 0 6px; font-size: 22px; }
.auth p { color: #666; margin: 0 0 16px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 3px; }
.field input {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px 8px;
  font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.error { color: var(--warn); font-size: 13px; min-height: 1.2em; }
.switch { margin-top: 12px; font-size: 13px; }

.empty { padding: 28px 16px; color: var(--muted); text-align: center; }
.back { margin: 0 0 12px; font-size: 13px; }
.back a { font-weight: 700; }
.profile-head { padding: 16px; border-bottom: 1px solid var(--line); }
.profile-head h1 { margin: 0 0 4px; font-size: 20px; }
.profile-id { display: flex; gap: 12px; align-items: flex-start; }
.bio { margin: 6px 0 0; color: #444; font-size: 14px; }
.profile-edit { margin-top: 14px; }
.profile-edit label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
  margin: 8px 0 4px;
}
.profile-edit textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid #c8c8cc;
  border-radius: 4px;
  padding: 8px;
  font: inherit;
  resize: vertical;
}
.profile-edit textarea:focus { outline: none; border-color: var(--accent); }
.who-link { display: block; }
.who-link:hover { text-decoration: none; }
.bio.muted { color: var(--muted); }
.avatar-pick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.avatar-pick .pick {
  padding: 0;
  border: 2px solid #ddd;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  line-height: 1.2;
  color: var(--text);
}
.avatar-pick .pick img { width: 100%; height: auto; display: block; }
.avatar-pick .pick.on { border-color: var(--accent); }

.person {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person .who { min-width: 0; }
.person .who .name { font-weight: 700; display: block; }
.person .who .sub { color: var(--muted); font-size: 12px; }
.side-people { max-height: 280px; overflow: auto; }
.side-people a.row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  color: var(--text);
}
.side-people a.row:hover { background: var(--hero); text-decoration: none; }
.side-people .tiny {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  font-size: 12px;
}
.terms-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--hero);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.terms-agree {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
  font-weight: 600;
}
.auth-actions {
  margin-top: 8px;
}
.auth-actions .btn {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
}
.auth-actions .terms-agree { margin-top: 0; }
.safety {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 700px) {
  .wrap {
    grid-template-columns: 1fr;
    margin: 12px auto 28px;
    padding: 0 10px;
  }
  .side { order: 2; }
  .side-here { display: none; }
  .top-inner {
    flex-wrap: wrap;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .nav {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav a, .nav button { min-height: 40px; display: inline-flex; align-items: center; }
  .auth {
    margin: 12px 10px 20px;
    padding: 18px 16px 8px;
    max-width: none;
  }
  .auth-actions {
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  }
  .composer textarea { font-size: 16px; min-height: 64px; }
  .composer-bar { flex-wrap: wrap; }
  .composer-bar .btn { min-height: 40px; }
  .shot, .shot img, .shot-preview img { max-width: 100%; }
  .avatar-pick { grid-template-columns: repeat(3, 1fr); }
  .person { grid-template-columns: 42px 1fr; }
  .person > .btn, .person > .sub { grid-column: 2; justify-self: start; }
  .safety { flex-wrap: wrap; }
  .btn { min-height: 40px; }
}
