:root {
  --canvas: #f0f2f5;
  --surface: #ffffff;
  --ink: #110e08;
  --secondary: #65676b;
  --blue: #ccff00;
  --blue-press: #b6e600;
  --blue-wash: #f4ffb0;
  --hover: #f2f2f2;
  --chip: #e4e6eb;
  --line: #ced0d4;
  --green: #31a24c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --header: 56px;
  --font: "Segoe UI Historic", "Segoe UI", Helvetica, Arial, sans-serif;
  --feed: 680px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.3333;
}

button, input, a { font: inherit; color: inherit; }

a { text-decoration: none; }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 20;
}

.skip:focus { top: 8px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-end { justify-content: flex-end; }

.brand {
  display: flex;
  flex: none;
  border-radius: 50%;
}

.brand .pet { width: 40px; height: 40px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  width: min(240px, 36vw);
  padding: 0 12px;
  background: var(--canvas);
  border-radius: 20px;
  color: var(--secondary);
}

.search svg { width: 16px; height: 16px; flex: none; }

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}

.search input::placeholder { color: var(--secondary); }

.top-nav {
  display: flex;
  align-items: stretch;
  height: var(--header);
  gap: 4px;
}

.top-nav a {
  width: 112px;
  display: grid;
  place-items: center;
  color: var(--secondary);
  border-radius: 8px;
  position: relative;
}

.top-nav a svg { width: 28px; height: 28px; }

.top-nav a:hover { background: var(--hover); }

.top-nav a[aria-current="page"] { color: var(--ink); }

.top-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}

.icon-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 20px;
  background: var(--chip);
  font-weight: 600;
  cursor: pointer;
}

.icon-btn svg { width: 20px; height: 20px; }

.icon-btn:hover { background: #d8dadf; }

.you { display: flex; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: var(--ink);
  font-weight: 700;
}

.avatar-sm { width: 36px; height: 36px; background: #e4e6eb; color: var(--ink); font-size: 15px; }

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 16px auto 32px;
  display: grid;
  grid-template-columns: 280px minmax(0, var(--feed)) 300px;
  gap: 16px;
  align-items: start;
  justify-content: center;
}

.side, .rail { position: sticky; top: 72px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
}

.side-link:hover { background: var(--chip); }

.side-link[aria-current="page"] { background: var(--blue-wash); }

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

.side-icon svg { width: 20px; height: 20px; }

.side-icon-blue { background: var(--blue); color: var(--ink); }

.side-note, .legal {
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
  margin: 12px 8px 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rail-card { padding: 16px; margin-bottom: 16px; }

.rail-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.rail-card p, .rail-card li { color: var(--secondary); margin: 0; }

.rail-card ol { margin: 12px 0 0; padding-left: 18px; }

.rail-card li + li { margin-top: 6px; }

.ready { list-style: none; margin: 8px 0 0; padding: 0; }

.ready a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 8px;
  margin: 0 -8px;
  border-radius: 8px;
  font-weight: 600;
}

.ready a:hover { background: var(--hover); }

.pet {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--canvas);
  box-shadow: 0 0 0 2px var(--ring, #fff);
  flex: none;
}

.pet-lg {
  width: 112px;
  height: 112px;
  box-shadow: 0 0 0 4px #fff, 0 8px 20px rgba(8, 102, 255, 0.18);
}

.companion {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 20px;
}

.bubble {
  margin-top: 12px;
  background: var(--blue-wash);
  color: var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  font-weight: 600;
}

.x-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 700;
}

.x-link:hover { text-decoration: underline; }

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

.composer, .post, .detail, .empty { padding: 12px 16px 8px; }

.composer-row, .post-head, .detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-go, .name-btn {
  flex: 1;
  text-align: left;
  height: 40px;
  border: 0;
  border-radius: 20px;
  background: var(--canvas);
  color: var(--secondary);
  padding: 0 12px;
  cursor: pointer;
}

.composer-go:hover, .name-btn:hover { background: #e4e6eb; }

.chips { display: flex; gap: 8px; padding: 8px 0 4px; flex-wrap: wrap; }

.chip {
  border: 0;
  background: var(--chip);
  border-radius: 18px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-pressed="true"] { background: var(--blue-wash); color: var(--ink); }

.post-head { align-items: flex-start; padding-bottom: 8px; }

.who { flex: 1; min-width: 0; }

.who strong { display: block; font-size: 15px; }

.who span, .meta-line { color: var(--secondary); font-size: 13px; }

.post h2, .detail h1 {
  font-size: 15px;
  font-weight: 400;
  margin: 4px 0 12px;
  line-height: 1.4;
}

.detail h1 { font-size: 20px; font-weight: 700; }

.hero { padding: 0; overflow: hidden; }

.hero-cover {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center 42%;
  background: var(--canvas);
}

.hero-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.hero-body .pet { width: 64px; height: 64px; }

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

.hero h1 { margin: 0 0 4px; font-size: 24px; line-height: 1.15; }

.hero .lede, .page-intro p, .post-copy { margin: 0 0 10px; color: var(--secondary); line-height: 1.4; }

.kicker {
  margin: 10px 0 0;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-badges, .hero-links, .plans { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.mini-bot, .plan {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 20px;
  background: var(--canvas);
  font-weight: 600;
}

.plan { padding: 8px 12px; }

.plan-plus { background: var(--blue); color: var(--ink); }

.page-intro { padding: 16px; }

.page-intro h1 { margin: 0 0 4px; font-size: 22px; }

.preview {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}

.preview:hover { background: var(--hover); }

.preview-kicker {
  background: var(--canvas);
  color: var(--secondary);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 10px 12px 0;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.share-row .tok-face {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.share-meta { min-width: 0; }

.share-meta strong,
.share-meta span { display: block; }

.share-meta strong { font-size: 16px; }

.share-meta span { color: var(--secondary); font-size: 13px; }

.preview strong, .preview p { display: block; padding: 0 12px; }

.preview strong { padding-top: 4px; font-size: 17px; }

.preview p { color: var(--secondary); font-size: 13px; margin: 4px 0 12px; }

.badge {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--secondary);
}

.badge-plus { background: var(--blue); color: var(--ink); }

.lock {
  margin: 0 0 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--canvas);
  color: var(--secondary);
}

.tok-face { object-fit: cover; background: #fff; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 12px;
}

.stat {
  background: var(--canvas);
  border-radius: 8px;
  padding: 10px 12px;
}

.stat dt {
  margin: 0;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.stat dd {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.stat dd span {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
}

.contract {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--canvas);
  border-radius: 8px;
}

.contract span {
  display: block;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.contract code {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: 13px;
  word-break: break-all;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  background: var(--chip);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.pill:hover { background: #d8dadf; }

.plus-note {
  position: relative;
  margin-top: 16px;
  padding-top: 8px;
}

.plus-note h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.plus-note p { margin: 0 0 10px; line-height: 1.45; }

.plus-note.is-locked p {
  filter: blur(6px);
  user-select: none;
}

.note-gate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
}

.chart {
  width: 100%;
  height: 420px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.address {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--secondary);
  word-break: break-all;
}

.text-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  font-weight: 600;
  color: var(--secondary);
  border-radius: 6px;
}

.text-link:hover { background: var(--hover); }

.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.actions {
  display: flex;
  border-top: 1px solid var(--chip);
  margin-top: 8px;
}

.actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.actions button:hover { background: var(--hover); }

.actions button[aria-pressed="true"] { color: var(--ink); }

.actions svg { width: 18px; height: 18px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.back:hover { text-decoration: underline; }

.rules { margin: 0 0 12px; padding-left: 18px; }

.rules li + li { margin-top: 6px; }

.briefing {
  margin: 0;
  padding: 12px;
  background: var(--canvas);
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

.copy-row { display: flex; justify-content: flex-end; padding: 12px 0 8px; }

.btn {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: var(--blue-press); }

.btn-ghost {
  background: var(--chip);
  color: var(--ink);
}

.btn-ghost:hover { background: #d8dadf; }

.empty { padding: 28px 16px; text-align: center; }

.empty .pet { display: block; margin: 0 auto 12px; }
.empty h2 { margin: 0 0 6px; font-size: 17px; }

.empty p { margin: 0 0 14px; color: var(--secondary); }

.tabbar { display: none; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: #242526;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1160px) {
  .shell { grid-template-columns: 280px minmax(0, var(--feed)); }
  .rail { display: none; }
}

@media (max-width: 860px) {
  .search { width: auto; flex: 1; min-width: 0; }
  .top-nav { display: none; }
  .icon-btn { display: inline-flex; }
  .you { display: flex; }
  .shell {
    width: min(680px, calc(100% - 16px));
    grid-template-columns: 1fr;
    margin-top: 8px;
    margin-bottom: 72px;
  }
  .side {
    display: none;
    position: fixed;
    z-index: 12;
    top: var(--header);
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    background: var(--surface);
    padding: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    overflow: auto;
  }
  .side.open { display: block; }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: 56px;
    display: flex;
    background: var(--surface);
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary);
  }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  #toast { bottom: 72px; }
}

.you {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  background: var(--chip);
  font-weight: 600;
  font-size: 15px;
}

.you:hover { background: #d8dadf; }

.you .avatar,
.you .pet { width: 36px; height: 36px; }

.you.has-photo { padding: 0; background: transparent; }

.auth { padding: 20px 16px 16px; }

.auth h1 { margin: 12px 0 4px; font-size: 24px; line-height: 1.2; }

.auth .lede { margin: 0 0 16px; color: var(--secondary); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.field span { font-size: 13px; font-weight: 600; }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
}

.form-error { min-height: 18px; margin: 0 0 8px; color: #e41e3f; font-size: 13px; }

.auth .btn,
.stack-btn { width: 100%; }

.stack-btn { margin-top: 8px; }

.text-btn {
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.switch-auth { margin: 14px 0 0; color: var(--secondary); text-align: center; }

.faces { display: flex; gap: 10px; margin: 4px 0 14px; }

.faces button {
  border: 2px solid transparent;
  padding: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  line-height: 0;
}

.faces button[aria-pressed="true"] { border-color: var(--blue); }

.photo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.file-btn { position: relative; overflow: hidden; }

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #toast { transition: none; }
}
