@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/vendor/bricolage-grotesque/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Sans';
  src: url('/vendor/instrument-sans/instrument-sans-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/vendor/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #13241d;
  --deep: #0e1b16;
  --paper: #1c3128;
  --paper-2: #284137;
  --edge: rgba(241, 234, 217, 0.13);
  --text: #f1ead9;
  --muted: #a9b8a9;
  --cream: #f1ead9;
  --ink: #15251e;
  --accent: #f2b233;
  --accent-hover: #ffc655;
  --link: #f6c565;
  --tomato: #d9502e;
  --danger: #ff9a7a;
  --good: #9bd6a4;
  --line: 1px solid var(--edge);
  --radius: 6px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

/* Anything cream re-points the tokens, so whatever sits on it stays readable. */

.hero,
.banner-hero,
.card,
.stat-card {
  --text: #15251e;
  --muted: #566659;
  --paper: #e4dcc7;
  --paper-2: #d7cdb5;
  --deep: #fbf6ea;
  --edge: rgba(21, 37, 30, 0.18);
  --link: #9c3a1e;
  background-color: var(--cream);
  color: var(--text);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scrollbar-color: #4b6557 var(--deep);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

svg {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

main {
  flex: 1;
  width: 100%;
}

.muted {
  color: var(--muted);
}

.page {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 0 24px 72px;
}

.narrow {
  width: min(860px, 100%);
}

.spaced {
  margin-top: 26px;
}

.count {
  opacity: 0.65;
}

.text-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The picket fence: page colour cut to shape, along the bottom of cream bands
   and the top of the footer. */

.hero::after,
.banner-hero::after,
.footer::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  -webkit-mask: url('/fence.svg') 0 100% / auto 100% repeat-x;
  mask: url('/fence.svg') 0 100% / auto 100% repeat-x;
}

.hero::after {
  bottom: -1px;
  height: 88px;
  background: #13241d;
}

.banner-hero::after {
  bottom: -1px;
  height: 60px;
  background: #13241d;
}

.footer::before {
  bottom: calc(100% - 1px);
  height: 60px;
  background: var(--deep);
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 34px;
  padding: 10px 24px;
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 800 1.3rem/1 var(--display);
  letter-spacing: -0.02em;
}

.brand span {
  margin-left: -9px;
  color: var(--accent);
}

.brand img {
  width: 32px;
  height: 32px;
}

.navpill {
  display: flex;
  gap: 24px;
}

.navpill a {
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
}

.navpill a:hover {
  color: var(--text);
}

.navpill a.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Buttons */

.button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.button:hover,
.chip:hover {
  background: var(--paper-2);
}

.button:active,
.chip:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.chip.active:hover {
  background: var(--accent);
}

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

.button.light {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.button.ghost {
  background: none;
  border-color: transparent;
  color: var(--text);
}

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

.button.danger {
  background: none;
  border-color: var(--danger);
  color: var(--danger);
}

.button.danger:hover {
  background: rgba(255, 154, 122, 0.14);
}

.button.large {
  width: 100%;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 600;
}

.button.small {
  padding: 5px 13px;
  font-size: 0.8rem;
}

.button.more {
  display: flex;
  margin: 36px auto 0;
  padding: 11px 30px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: var(--line);
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--paper-2);
}

.icon-button.small {
  flex: none;
  width: 32px;
  height: 32px;
  background: var(--paper-2);
  font-size: 0.875rem;
}

.icon-button.small:hover {
  background: var(--paper);
}

.bell .dot {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--tomato);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* Avatars */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 8px;
  background: hsl(var(--hue, 150) 32% 34%);
  color: #fff;
  font: 700 1rem/1 var(--display);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.large {
  width: 46px;
  height: 46px;
  font-size: 1.2rem;
}

.avatar.huge {
  width: 92px;
  height: 92px;
  font-size: 2.4rem;
}

/* Account menu */

.account {
  position: relative;
}

.account summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 3px;
  border: var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.account summary::-webkit-details-marker {
  display: none;
}

.account summary .avatar {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}

.account-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  padding: 6px;
  background: var(--paper);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
}

.account-menu a,
.account-menu button {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: 4px;
  background: none;
  text-align: left;
  font-weight: 500;
  cursor: pointer;
}

.account-menu a:hover,
.account-menu button:hover {
  background: var(--paper-2);
}

/* Home */

.hero {
  position: relative;
  margin: 0 calc(50% - 50vw);
  padding: 54px max(24px, calc(50vw - 596px)) 124px;
}

.hero h1 {
  font-size: clamp(2.9rem, 7.4vw, 6rem);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.hero h1 em {
  display: block;
  color: var(--tomato);
  font-style: normal;
}

.hero p {
  max-width: 34em;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero .button {
  margin-top: 14px;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 6px 6px 6px 16px;
  background: var(--deep);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}

.searchbar:focus-within {
  border-color: var(--text);
}

.searchbar > svg {
  font-size: 1.2rem;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 0.95rem;
}

.searchbar input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.searchbar .button {
  margin: 0;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.searchbar.small {
  flex: 1;
  max-width: 340px;
  margin: 0;
  padding: 8px 16px;
}

.searchbar.small input {
  font-size: 0.95rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 34px;
  min-height: 46px;
  margin-top: 22px;
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.stats dd {
  font: 700 1.5rem/1 var(--display);
}

.stats dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-art {
  position: absolute;
  top: 54px;
  right: max(24px, calc(50vw - 596px));
  width: min(36vw, 440px);
  aspect-ratio: 16 / 9;
  transform: rotate(2deg);
}

.hero-art:empty {
  display: none;
}

.hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 6px solid var(--deep);
  border-radius: var(--radius);
  box-shadow: 0 16px 34px rgba(21, 37, 30, 0.3);
}

.hot-games {
  margin-top: 26px;
}

.hero + .hot-games[hidden] + section,
.hot-games + section {
  margin-top: 34px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 1.6rem;
}

.section-head a {
  color: var(--muted);
  font-size: 0.9rem;
}

.game-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 14px;
}

.game-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px;
  background: var(--paper);
  border-radius: var(--radius);
  transition: background 0.12s;
}

.game-chip:hover {
  background: var(--paper-2);
}

.game-chip img,
.game-chip-blank {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 4px;
  background: var(--paper-2);
  object-fit: cover;
}

.game-chip span:last-child {
  min-width: 0;
}

.game-chip strong,
.game-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-chip strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.game-chip small {
  color: var(--muted);
  font-size: 0.78rem;
}

.feed-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.feed-head h1 {
  margin-right: auto;
  font-size: 2.1rem;
}

.feed-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0 24px;
}

.feed-controls h2 {
  font-size: 1.3rem;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sort {
  display: flex;
  align-items: center;
  gap: 10px;
}

select,
.field input:not([type='radio'], [type='file']),
.field textarea,
.comment-form textarea,
.dialog textarea {
  background: var(--deep);
  border: var(--line);
  border-radius: var(--radius);
  color: var(--text);
}

select {
  padding: 8px 12px;
  font-weight: 600;
}

/* Script cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 22px 18px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  transition: transform 0.14s;
}

a.card:hover {
  transform: translateY(-3px);
}

.card h3 {
  font: 700 1.02rem/1.2 var(--display);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card > .card-text {
  padding: 10px 2px 0;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #d7cdb5;
  border-radius: var(--radius);
}

.card .thumb {
  border-radius: 0;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s;
}

.thumb.cover {
  background: hsl(var(--hue) 28% 26%);
}

.thumb.cover pre {
  position: absolute;
  inset: 22% 0 -10% 7%;
  margin: 0;
  padding: 12px 14px;
  overflow: hidden;
  background: #0e1b16;
  border-radius: 4px 0 0 0;
  color: #f1ead9;
  font: 500 9.5px/1.5 var(--mono);
  tab-size: 2;
}

.overlay {
  position: absolute;
  display: flex;
  gap: 5px;
}

.overlay.top {
  top: 8px;
  left: 8px;
}

.overlay.right {
  top: 8px;
  right: 8px;
}

.overlay.bottom {
  top: 8px;
  left: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 3px;
  background: #0e1b16;
  color: #f1ead9;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.overlay.bottom .badge {
  background: var(--accent);
  color: var(--ink);
}

.card-body {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 13px 10px;
  border-top: 2px dashed rgba(21, 37, 30, 0.28);
}

.card-text {
  flex: 1;
  min-width: 0;
}

.meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skeleton {
  aspect-ratio: 16 / 12;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--paper) 30%, var(--paper-2) 50%, var(--paper) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

.empty {
  padding: 56px 16px;
  text-align: center;
  font-size: 1.1rem;
}

a.card:hover .thumb img {
  transform: scale(1.04);
}

a.card:hover .thumb {
  transform: none;
}

/* Page banners */

.banner-hero {
  position: relative;
  margin: 0 calc(50% - 50vw) 34px;
  padding: 40px max(24px, calc(50vw - 596px)) 92px;
}

.banner-hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.banner-hero p {
  max-width: 560px;
  margin-top: 8px;
  color: var(--muted);
}

.banner-hero .chips {
  margin-top: 18px;
}

.trend-section {
  margin-top: 38px;
}

.trend-section h2 {
  font-size: 1.4rem;
}

.trend-section .grid {
  margin-top: 16px;
}

/* Panels and forms */

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--paper);
  border-radius: var(--radius);
}

.panel h1 {
  font-size: 1.7rem;
}

.panel h2 {
  font-size: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span,
.field > legend {
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.field > legend {
  margin-bottom: 6px;
}

.field small {
  color: var(--muted);
  font-weight: 400;
}

.field input:not([type='radio'], [type='file']),
.field textarea,
.comment-form textarea,
.dialog textarea {
  width: 100%;
  padding: 10px 13px;
}

.field input:focus,
.field textarea:focus,
.comment-form textarea:focus,
.dialog textarea:focus {
  outline: 0;
  border-color: var(--link);
}

.field input::placeholder,
.field textarea::placeholder,
.comment-form textarea::placeholder,
.dialog textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field textarea {
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.code-input {
  font: 13px/1.6 var(--mono) !important;
  tab-size: 4;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--deep);
  border-radius: var(--radius);
}

.segmented label {
  position: relative;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 7px;
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.segmented input:checked + span {
  background: var(--accent);
  color: var(--ink);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.game-status {
  font-size: 0.9rem;
  color: var(--muted);
}

.game-status.found {
  color: var(--good);
  font-weight: 700;
}

.game-status.found::before {
  content: '✓ ';
}

.game-status.failed {
  color: var(--danger);
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px;
  border: 1px dashed var(--muted);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragging,
.dropzone:focus-within {
  border-color: var(--link);
  background: rgba(242, 178, 51, 0.07);
}

.dropzone svg {
  font-size: 1.7rem;
}

.dropzone strong {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.error {
  padding: 10px 13px;
  background: rgba(255, 154, 122, 0.12);
  border-radius: var(--radius);
  color: var(--danger);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button.file-button {
  position: relative;
  align-self: flex-start;
}

.publish {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 28px;
  padding-top: 30px;
}

.preview {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview h2 {
  font-size: 1.1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth {
  display: grid;
  place-items: start center;
  padding-top: 64px;
}

.auth .panel {
  width: min(430px, 100%);
}

.auth .panel p.muted {
  margin-top: -10px;
}

.auth .switch {
  margin-top: 0 !important;
  text-align: center;
}

.switch a {
  color: var(--link);
  font-weight: 700;
}

/* Stats */

.stat-row {
  display: flex;
  gap: 10px;
}

.stat {
  flex: 1;
  min-width: 78px;
  padding: 11px 14px;
  background: var(--paper);
  border-radius: var(--radius);
}

.stat strong {
  display: block;
  font: 700 1.45rem/1.2 var(--display);
  letter-spacing: -0.02em;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

/* Game page */

.game-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 26px 0;
  padding: 22px;
  background: var(--paper);
  border-radius: var(--radius);
}

.game-art {
  width: 250px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.game-info {
  flex: 1;
  min-width: 240px;
}

.game-info h1 {
  font-size: 2rem;
  overflow-wrap: anywhere;
}

.game-info .stat-row {
  margin-top: 12px;
}

.game-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Leaderboards */

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.leader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--paper);
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.12s;
}

.leader:hover {
  background: var(--paper-2);
}

.rank {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--paper-2);
  font: 700 0.95rem/1 var(--display);
}

.rank-1 {
  background: var(--accent);
  color: var(--ink);
}

.rank-2 {
  background: var(--cream);
  color: var(--ink);
}

.rank-3 {
  background: #c77b4a;
  color: var(--ink);
}

.leader-value {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
}

/* Script page */

.script-page {
  width: min(1040px, 100%);
}

.script-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 30px;
  padding-top: 32px;
}

.script-hero > .thumb {
  border-radius: var(--radius);
}

.script-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.script-title h1 {
  font-size: 2.5rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.creator {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.creator div > * {
  display: block;
}

.creator strong {
  font-weight: 700;
}

.creator div > span {
  color: var(--muted);
  font-size: 0.875rem;
}

.script-bar {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 9px 14px;
  background: var(--paper);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.votes {
  display: flex;
  overflow: hidden;
  background: var(--deep);
  border-radius: var(--radius);
}

.votes button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  background: none;
  font-weight: 700;
  cursor: pointer;
}

.votes button + button {
  border-left: var(--line);
}

.votes button:hover {
  background: var(--paper-2);
}

.votes button.active:first-child {
  background: var(--accent);
  color: var(--ink);
}

.votes button.active:last-child {
  background: rgba(255, 154, 122, 0.25);
  color: var(--danger);
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

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

.link-button.active svg {
  fill: var(--accent);
}

.link-button.danger {
  color: var(--danger);
}

.link-button:disabled {
  cursor: default;
  opacity: 0.7;
}

.owner-actions {
  display: inline-flex;
  gap: 14px;
  margin-left: auto;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 20px 0 20px;
  border-bottom: var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.script-page .panel,
.script-page .code-panel {
  margin-top: 20px;
  scroll-margin-top: 92px;
}

.script-page .panel h3 {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.post-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  list-style: none;
}

.feature-list li::before {
  content: '✓ ';
  color: var(--good);
  font-weight: 900;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 2px 9px;
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
}

a.pill:hover {
  background: var(--accent);
  color: var(--ink);
}

.code-panel {
  overflow: hidden;
  background: var(--deep);
  border: var(--line);
  border-radius: var(--radius);
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px 10px 18px;
  border-bottom: var(--line);
}

.code-head strong {
  display: block;
  font: 600 1rem/1.3 var(--sans);
}

.code-head div > span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.code-actions {
  display: flex;
  gap: 8px;
}

.code-body {
  display: flex;
  max-height: 70vh;
  overflow: auto;
}

.code-body pre {
  margin: 0;
  padding: 14px 0;
  color: var(--text);
  font: 500 13px/1.65 var(--mono);
  tab-size: 4;
}

.gutter {
  position: sticky;
  left: 0;
  flex: none;
  padding-inline: 16px 13px !important;
  background: var(--deep);
  color: #5f7568 !important;
  text-align: right;
  user-select: none;
}

.code-text {
  flex: 1;
  padding-right: 16px !important;
}

.hljs-keyword,
.hljs-built_in {
  color: #ff9a7a;
}

.hljs-string {
  color: var(--accent);
}

.hljs-number,
.hljs-literal {
  color: #9bd6a4;
}

.hljs-comment {
  color: #76897c;
  font-style: italic;
}

.hljs-title {
  color: #f1ead9;
}

/* Comments */

.comment-form {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.comment-form textarea,
.dialog textarea {
  resize: vertical;
}

.comment-form .error {
  align-self: stretch;
}

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

.comment {
  display: flex;
  gap: 11px;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-body p {
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.comment-meta a {
  font-weight: 700;
}

.comment-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.more-section {
  margin-top: 40px;
}

.more-section h2 {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.dialog {
  width: min(440px, calc(100% - 32px));
  padding: 22px;
  background: var(--paper);
  border: var(--line);
  border-radius: var(--radius);
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(9, 16, 13, 0.72);
}

.dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog h2 {
  font-size: 1.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Profile */

.profile-page {
  width: min(1120px, 100%);
}

.profile-banner {
  height: 210px;
  margin-top: 24px;
  overflow: hidden;
  background: var(--paper-2);
  border-radius: var(--radius);
}

.profile-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: -44px 0 12px 22px;
}

.profile-name {
  font-size: 1.9rem;
  overflow-wrap: anywhere;
}

.profile-bio {
  max-width: 680px;
  margin-top: 8px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-stats {
  max-width: 500px;
  margin-top: 16px;
}

.tab-panel h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 900;
}

.activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  background: var(--paper);
  border-radius: var(--radius);
}

.activity-row > svg {
  margin-top: 4px;
}

.activity-row > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-row > span {
  flex: none;
  font-size: 0.85rem;
}

/* Dashboard */

.dashboard {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 34px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 30px 24px 72px;
}

.dash-side {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-side a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
}

.dash-side a:hover {
  background: var(--paper);
  color: var(--text);
}

.dash-side a.active {
  background: var(--cream);
  color: var(--ink);
  font-weight: 600;
}

.dash-side a.dash-public {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dash-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.dash-head h1 {
  font-size: 2.5rem;
  font-weight: 800;
}

.dash-head p {
  margin-top: 6px;
}

.dash-welcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0 12px;
}

.dash-welcome h1 {
  font-size: 2rem;
  font-weight: 800;
}

.dash-panel > h2 {
  font-size: 1.15rem;
}

.dash-panel .panel {
  gap: 10px;
  padding: 20px;
}

.dash-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--paper);
  border-radius: var(--radius);
}

.dash-row.unread {
  background: rgba(242, 178, 51, 0.13);
}

.dash-row-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dash-row-main strong {
  font-weight: 700;
}

.dash-numbers {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.image-preview {
  overflow: hidden;
  background: var(--deep);
}

.image-preview.banner {
  height: 140px;
  border-radius: var(--radius);
}

.image-preview.avatar {
  width: 88px;
  height: 88px;
  border-radius: 8px;
}

.image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.danger-zone {
  background: rgba(217, 80, 46, 0.14);
}

.dash-head {
  padding: 6px 0 8px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font: 500 0.75rem/1.4 var(--mono);
}

.dash-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
}









.stat-card {
  padding: 14px 16px;
  background: var(--cream);
}

.stat-card .stat-icon {
  color: var(--accent);
}

.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--accent);
}

/* Admin */

.admin-page .stat-row {
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.admin-page .tab-panel > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-page .searchbar.small {
  flex: none;
  max-width: none;
}

.admin-actions {
  flex: none;
  display: flex;
  gap: 8px;
}

.report-reason {
  margin-top: 4px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-tag {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--muted);
  font: 500 0.72rem/1.4 var(--mono);
}

.status-tag.banned {
  background: rgba(255, 154, 122, 0.18);
  color: var(--danger);
}

.status-tag.featured {
  background: var(--accent);
  color: var(--ink);
}

.announce-form {
  display: flex;
  gap: 10px;
}

.announce-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--deep);
  border: var(--line);
  border-radius: var(--radius);
}

.announcement {
  padding: 8px 24px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Views chart */

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-head p {
  font-size: 0.85rem;
}

.chart-plot {
  position: relative;
  height: 240px;
  border-radius: 8px;
  touch-action: pan-y;
}

.chart-plot svg {
  display: block;
  width: 100%;
  height: 240px;
}

.chart-grid {
  stroke: rgba(241, 234, 217, 0.1);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted);
  stroke: none;
  font: 400 11px var(--sans);
}

.chart-line {
  fill: none;
  stroke: var(--accent-hover);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-area {
  fill: rgba(242, 178, 51, 0.16);
  stroke: none;
}

.chart-crosshair {
  stroke: rgba(241, 234, 217, 0.4);
  stroke-width: 1;
}

.chart-dot {
  fill: var(--accent-hover);
  stroke: var(--paper);
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  top: 10px;
  padding: 6px 11px;
  background: var(--deep);
  border: var(--line);
  border-radius: var(--radius);
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
}

.chart-tooltip span {
  color: var(--muted);
  font-size: 0.75rem;
}

.chart-table {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.chart-table summary {
  cursor: pointer;
}

.chart-table table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}

.chart-table th,
.chart-table td {
  padding: 3px 0;
  border-bottom: var(--line);
  text-align: left;
}

/* Help */

.faq {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq details {
  padding: 13px 16px;
  background: var(--paper);
  border-radius: var(--radius);
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
}

.faq p {
  margin-top: 8px;
}

/* Footer */

.footer {
  position: relative;
  margin-top: 76px;
  padding: 26px 24px 30px;
  background: var(--deep);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer nav {
  display: flex;
  gap: 18px;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.footer a:hover {
  color: var(--accent);
}

.footer p {
  color: var(--muted);
}

/* Small screens */

@media (max-width: 900px) {
  .publish,
  .script-hero,
  .dashboard {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview {
    position: static;
    order: -1;
  }

  .hero-art {
    display: none;
  }

  .dash-side {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }

  .dash-side a {
    flex: none;
  }

  .dash-numbers {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-inline: 16px;
  }

  .navpill {
    order: 3;
    width: 100%;
    gap: 18px;
    overflow-x: auto;
  }

  .navpill a {
    white-space: nowrap;
  }

  .hero {
    padding: 36px 16px 92px;
  }

  .page,
  .dashboard {
    padding-inline: 16px;
  }

  .searchbar .button {
    display: none;
  }

  .panel {
    padding: 18px;
  }

  .sort {
    width: 100%;
  }

  .sort select {
    flex: 1;
  }

  .field-row,
  .feature-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-name {
    display: none;
  }

  .banner-hero {
    padding: 28px 16px 72px;
  }

  .profile-banner {
    height: 130px;
  }

  .owner-actions {
    margin-left: 0;
  }

  .admin-page .dash-row {
    flex-wrap: wrap;
  }

  .stat-row {
    flex-wrap: wrap;
  }
}

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

::selection {
  background: var(--accent);
  color: var(--ink);
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding: 0 13px 11px;
  color: var(--muted);
  font: 500 0.74rem/1.4 var(--mono);
}

.card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-stats span:last-child {
  margin-left: auto;
}
