:root {
  --bg: #FFFFFF;
  --ink: #000000;
  --muted: #4B5563;
  --line: 1.5px;
  --border: var(--line) solid var(--ink);
  --border-strong: 2px solid var(--ink);
  --shadow: 3px 3px 0 var(--ink);
  --shadow-pressed: 1.5px 1.5px 0 var(--ink);
  --radius: 12px;
  --tint-0: #FFE8F3;
  --tint-1: #E3F6FF;
  --tint-2: #E6FBEF;
  --tint-3: #FFF6CC;
  --tint-4: #F0E9FF;
  --ice: linear-gradient(115deg, #FFFFFF 0%, #B8F1FF 20%, #FFFFFF 38%, #FFC8F0 55%, #FFFFFF 72%, #FFF3A6 88%, #FFFFFF 100%);
  --fill-highlight: #FFD21E;
  --text-blue: #1D4ED8;
  --text-green: #15803D;
  --text-red: #B91C1C;
  --text-purple: #7E22CE;
  --text-orange: #C2410C;
  --font-ui: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-luxe: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --gutter: 16px;
  --indent: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a { color: var(--text-blue); font-weight: 700; }
h1, h2, h3 { line-height: 1.1; font-weight: 900; margin: 0 0 12px; }
h1 { font-size: 30px; }
h2 { font-size: 20px; margin-top: 20px; }
p { margin: 0 0 10px; }
img { max-width: 100%; display: block; }

.mono { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.page { max-width: 640px; margin: 0 auto; padding: 16px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }

.card {
  background: var(--bg);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
  min-width: 0;
}
.card--strong { border: var(--border-strong); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font: 700 16px/1 var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
  min-height: 40px;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: var(--shadow-pressed); }
.btn:focus-visible, .media__track:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--fill-highlight);
  outline-offset: 2px;
}
.btn--blue { color: var(--text-blue); }
.btn--green { color: var(--text-green); }
.btn--red { color: var(--text-red); }
.btn--purple { color: var(--text-purple); }
.btn--orange { color: var(--text-orange); }
.btn--small { padding: 6px 12px; font-size: 14px; min-height: 36px; box-shadow: var(--shadow-pressed); }
.btn--block { width: 100%; }
.btn--link { border: none; box-shadow: none; background: none; color: var(--text-blue); padding: 6px 4px; }
.btn--link:hover, .btn--link:active { transform: none; box-shadow: none; text-decoration: underline; }
.button_to { display: inline; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: var(--border);
  border-radius: 999px;
  background: var(--fill-highlight);
  font-weight: 700;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--text-red); border: 1px solid var(--ink); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: 0.6; } }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border: var(--border);
  border-radius: 4px;
  font: 500 12px/1.4 var(--font-mono);
  background: var(--bg);
}
.badge--op { background: var(--fill-highlight); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgb(255 255 255 / 0.88);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: var(--border);
}
.topbar > * { min-width: 0; }
.topbar .wordmark, .topbar__actions { flex: none; }
.topbar .chip { white-space: nowrap; font-size: 13px; padding: 3px 8px; }
.wordmark {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font: italic 900 30px/1.1 var(--font-luxe);
  letter-spacing: -0.01em;
}
.wordmark__ice {
  position: relative;
  color: transparent;
  background: linear-gradient(115deg, #FFFFFF 0%, #B8F1FF 14%, #FFFFFF 26%, #FFC8F0 38%, #FFFFFF 50%, #FFF3A6 62%, #FFFFFF 74%, #B8F1FF 86%, #FFFFFF 100%) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1px var(--ink);
  letter-spacing: 0.02em;
  filter: drop-shadow(2px 2px 0 var(--fill-highlight)) drop-shadow(1px 1px 0 var(--ink));
  animation: ice 4s linear infinite;
  padding-right: 2px;
}
.wordmark__dot { -webkit-text-stroke: 0; color: var(--text-purple); }
.wordmark__ice::before, .wordmark__ice::after {
  content: "✦";
  position: absolute;
  font: normal 900 12px/1 var(--font-ui);
  color: #FFFFFF;
  -webkit-text-stroke: 1px var(--ink);
  animation: twinkle 1.8s ease-in-out infinite;
}
.wordmark__ice::before { top: -6px; left: 30%; }
.wordmark__ice::after { bottom: -4px; right: 4px; font-size: 9px; animation-delay: 0.9s; }
.wordmark__gem { font-size: 0.7em; display: inline-block; transform: rotate(-14deg); animation: bling 3s ease-in-out infinite; }
@keyframes ice { to { background-position: -300% 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); } 50% { opacity: 1; transform: scale(1.2) rotate(45deg); } }
@keyframes bling { 0%, 80%, 100% { transform: rotate(-14deg) scale(1); } 88% { transform: rotate(8deg) scale(1.25); } }
@media (max-width: 420px) {
  .wordmark { font-size: 22px; }
  .topbar { gap: 6px; padding-inline: 10px; }
  .chip__suffix { display: none; }
}
.icon-button { text-decoration: none; font-size: 22px; }

.reconnecting {
  display: none;
  margin: 0;
  padding: 4px var(--gutter);
  text-align: center;
  font: 500 14px var(--font-mono);
  background: var(--fill-highlight);
  border-bottom: var(--border);
}
body:has(turbo-cable-stream-source:not([connected])) .reconnecting { display: block; animation: delayed-show 5s steps(1, end) both; }
@keyframes delayed-show { from { visibility: hidden; } to { visibility: visible; } }

.flash-stack { max-width: 640px; margin: 12px auto 0; padding: 0 var(--gutter); }
.flash { border: var(--border); border-radius: var(--radius); padding: 10px 14px; font-weight: 700; box-shadow: var(--shadow-pressed); }
.flash--notice { background: var(--fill-highlight); }
.flash--alert { color: var(--text-red); }

.footer { text-align: center; padding: 24px var(--gutter); font-size: 14px; }

.mascot { font-size: 56px; line-height: 1; margin-bottom: 8px; }

.form-card { max-width: 440px; margin: 24px auto; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 700; margin-top: 8px; }
.form .btn { margin-top: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"], textarea, select {
  width: 100%;
  font: 17px var(--font-ui);
  padding: 10px 12px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"] { height: 46px; }
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="date"]::-webkit-datetime-edit { padding: 0; }
textarea { resize: vertical; }
input.code-input { font-size: 28px; letter-spacing: 8px; text-align: center; height: auto; }
.hint { color: var(--muted); font-size: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.form-errors { color: var(--text-red); border: var(--border); border-radius: var(--radius); padding: 10px 10px 10px 28px; font-weight: 700; }
.switch { margin-top: 16px; text-align: center; }
.resend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.notice-inline { background: var(--fill-highlight); border: var(--border); border-radius: var(--radius); padding: 8px 12px; }
.verification-status__failed { color: var(--text-red); font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.stack--row { flex-direction: row; flex-wrap: wrap; }

.composer textarea, .reply-form textarea { border: none; padding: 0; font-size: 19px; resize: none; background: transparent; }
.composer textarea:focus-visible { outline: none; }
.composer__bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer__bar .counter { margin-left: auto; }
.composer__preview { position: relative; margin: 10px 0 0; }
.composer__preview img { width: 100%; max-height: 360px; object-fit: contain; border: var(--border); border-radius: var(--radius); background: var(--bg); }
.composer__preview[hidden], .form-errors[hidden] { display: none; }
.counter.is-low { color: var(--text-red); font-weight: 700; }

.notice { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice:empty, .notice:not(:has(*)) { display: none; }
.notice p { margin: 0; flex-basis: 100%; }

.feed-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; }
.feed-bar__title { margin: 0; font-size: 24px; }
.radius { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.radius select { width: auto; padding: 6px 10px; }

.pill {
  position: sticky;
  top: 72px;
  z-index: 5;
  display: block;
  margin: 0 auto 12px;
  padding: 9px 20px;
  font: 800 15px var(--font-ui);
  background: var(--ice) 0 0 / 300% 100%;
  animation: ice 4s linear infinite, nudge 1.2s ease-in-out infinite;
  border: var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.pill[hidden] { display: none; }

.post {
  position: relative;
  margin-bottom: 22px;
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 160ms ease;
}
.post::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 72px;
  height: 18px;
  background: rgb(255 210 30 / 0.65);
  border-left: 1px dashed rgb(0 0 0 / 0.25);
  border-right: 1px dashed rgb(0 0 0 / 0.25);
  transform: translateX(-50%) rotate(var(--tape, -2deg));
}
.post:nth-child(odd) { --tilt: -0.35deg; --tape: 3deg; }
.post:nth-child(even) { --tilt: 0.35deg; }
.post:active { transform: rotate(0deg) scale(0.995); }
.tint-0 { background: var(--tint-0); }
.tint-1 { background: var(--tint-1); }
.tint-2 { background: var(--tint-2); }
.tint-3 { background: var(--tint-3); }
.tint-4 { background: var(--tint-4); }
@keyframes nudge { 50% { transform: translateY(-2px); } }

.post .meta, .comment .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.username { font-weight: 700; overflow-wrap: anywhere; }
.post__body { margin: 10px 0; font-size: 18px; overflow-wrap: anywhere; }
.post__footer { display: flex; gap: 10px; }
.is-new { animation: arrive 1.8s ease-out; }
@keyframes arrive { from { background: var(--fill-highlight); transform: translateY(-6px); } 15% { transform: none; } }

.menu { position: relative; margin-left: auto; }
.menu summary { list-style: none; cursor: pointer; font-weight: 900; padding: 0 8px; border: var(--border); border-radius: var(--radius); }
.menu summary::-webkit-details-marker { display: none; }
.menu__items { position: absolute; right: 0; top: 32px; z-index: 4; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--bg); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.owner-only { display: none; }
.owner-only.is-viewer { display: inline-flex; }
.not-owner.is-viewer { display: none; }
.mention.is-viewer { background: var(--fill-highlight); color: var(--ink); }

.back { display: inline-block; margin-bottom: 12px; }
.thread-meta { margin: -6px 0 14px; }
.thread { margin-top: 8px; }
.reply-form textarea { border: none; padding: 0; }

.comment { display: flex; gap: 6px; margin-top: 12px; min-width: 0; }
.comment__line { flex: none; width: 10px; padding: 0; border: none; background: none; cursor: pointer; position: relative; }
.comment__line::after { content: ""; position: absolute; top: 4px; bottom: 0; left: 4px; border-left: 2px solid var(--thread-color, var(--ink)); border-radius: 2px; }
.comment__line:hover::after { border-left-width: 4px; }
.comment { --thread-color: #EC4899; }
.comment .comment { --thread-color: #0EA5E9; }
.comment .comment .comment { --thread-color: #22C55E; }
.comment .comment .comment .comment { --thread-color: #A855F7; }
.comment .comment .comment .comment .comment { --thread-color: #F97316; }
.comment .comment .comment .comment .comment .comment { --thread-color: #EAB308; }
.comment__main { flex: 1; min-width: 0; }
.comment__body { overflow-wrap: anywhere; margin: 4px 0; }
.comment__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.comment .toggle { border: none; background: none; padding: 0; cursor: pointer; color: var(--muted); }
.replies { margin-left: calc(var(--indent) - 6px); }
.comment__collapsed { display: none; }
.comment.is-collapsed > .comment__main > :not(.comment__content),
.comment.is-collapsed > .comment__main > .comment__content > :not(.meta) { display: none; }
.comment.is-collapsed > .comment__main > .comment__content > .comment__collapsed { display: block; }
.continue { display: none; margin-top: 8px; font-size: 15px; }
.comment .comment .comment .comment .comment .comment > .comment__main > .replies { display: none; }
.comment .comment .comment .comment .comment .comment:not(.is-collapsed) > .comment__main > :is(.continue--replied, .replies:has(> .comment) + .continue) { display: inline-block; }
@media (max-width: 639px) {
  .comment .comment .comment > .comment__main > .replies { display: none; }
  .comment .comment .comment:not(.is-collapsed) > .comment__main > :is(.continue--replied, .replies:has(> .comment) + .continue) { display: inline-block; }
}

.reactions { display: inline-flex; gap: 6px; }
.reaction {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 4px 12px;
  font: 700 14px var(--font-ui);
  background: var(--bg);
  border: var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-pressed);
  cursor: pointer;
  transition: transform 80ms ease;
}
.reaction:hover { transform: translate(-1px, -1px); }
.reaction:active { transform: scale(0.92); }
.reaction--love .reaction__count { color: var(--text-red); }
.reaction--trash .reaction__count { color: var(--muted); }
.reaction.is-pressed { transform: translate(2px, 2px); box-shadow: none; }
.reaction--love.is-pressed { background: #FFE4E6; }
.reaction--trash.is-pressed { background: #E5E7EB; }
.reaction.is-pressed span[aria-hidden] { animation: pop 300ms ease-out; }
.reaction--love.is-pressed::after, .reaction--trash.is-pressed::after {
  content: "+1";
  position: absolute;
  left: 50%;
  top: -4px;
  font: 800 12px var(--font-mono);
  color: var(--text-red);
  pointer-events: none;
  animation: float-up 700ms ease-out forwards;
}
.reaction--trash.is-pressed::after { content: "🗑️"; }
@keyframes pop { 50% { transform: scale(1.5) rotate(-8deg); } }
@keyframes float-up { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -26px); } }
.post__footer { flex-wrap: wrap; align-items: center; }
.comment.is-buried > .comment__main > .comment__content > .comment__collapsed { color: var(--muted); }

.mention { font-weight: 700; color: var(--text-purple); border-radius: 4px; padding: 0 2px; }
.mention-menu {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg);
  max-width: 260px;
}
.mention-menu[hidden] { display: none; }
.mention-menu li { padding: 6px 10px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.mention-menu li[aria-selected="true"], .mention-menu li:hover { background: var(--fill-highlight); }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.mentions-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font: 900 20px var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  border: var(--border);
  border-radius: 50%;
  background: var(--bg);
}
.mentions-badge.has-unread { background: var(--fill-highlight); }
.mentions-badge__count {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 20px;
  padding: 1px 5px;
  font-size: 11px;
  color: #FFFFFF;
  background: var(--text-red);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.mention-card { display: block; color: var(--ink); text-decoration: none; }
.mention-card.is-unread { border-color: var(--text-purple); box-shadow: 4px 4px 0 var(--text-purple); }
.mention-card__body { margin-top: 6px; overflow-wrap: anywhere; }

.trending { margin-bottom: 8px; }
.trending__title { margin: 0 0 8px; color: var(--text-orange); }
.trending__list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 46%); gap: 12px; overflow-x: auto; list-style: none; margin: 0; padding: 0 6px 10px 0; scroll-snap-type: x mandatory; }
.trending__list li { scroll-snap-align: start; min-width: 0; }
.trending__card { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; height: 100%; color: var(--ink); text-decoration: none; margin: 0; }
.trending__text { font-weight: 700; overflow-wrap: anywhere; }
.trending__thumb { border: var(--border); border-radius: 4px; max-height: 90px; object-fit: cover; }

.empty { text-align: center; padding: 28px; }
.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  font: 900 17px var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  background: var(--ice) 0 0 / 300% 100%;
  border: var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: ice 5s linear infinite;
  cursor: pointer;
}
.fab:active { transform: translate(2px, 2px); box-shadow: var(--shadow-pressed); }
@media (min-width: 900px) { .fab { display: none; } }
.join__title { font-size: 20px; font-weight: 900; }

.dialog { width: min(92vw, 440px); padding: 18px; }
.dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.reasons { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }

.prose { line-height: 1.6; }
.prose h2 { margin-top: 18px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.metric { margin: 0; }
.metric dd { margin: 4px 0 0; font-size: 26px; font-weight: 700; }
.moderation--urgent { border-color: var(--text-red); box-shadow: 4px 4px 0 var(--text-red); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.table + p { margin-top: 12px; }
.table th, .table td { border: 1px solid var(--ink); padding: 6px; text-align: left; vertical-align: top; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.media { position: relative; margin: 10px 0; border: var(--border); border-radius: var(--radius); overflow: hidden; background: #F4F4F5; }
.media__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.media__track::-webkit-scrollbar { display: none; }
.media__image { flex: 0 0 100%; width: 100%; height: auto; max-height: 70vh; object-fit: contain; scroll-snap-align: center; }
.media__video { display: block; width: 100%; max-height: 75vh; background: var(--ink); }
.media__pending { margin: 0; padding: 32px 12px; text-align: center; }
.media__dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.media__dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / 0.7); border: 1px solid var(--ink); transition: transform 150ms ease; }
.media__dot.is-active { background: var(--fill-highlight); transform: scale(1.3); }
.composer__previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 10px; }
.composer__previews[hidden], .composer__progress[hidden] { display: none; }
.composer__thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border: var(--border); border-radius: 6px; background: #F4F4F5; }
.composer__progress { width: 100%; height: 8px; margin-top: 8px; accent-color: var(--text-purple); }
