/* Rateclimbs design system.
 *
 * Direction: a phone held in one hand at the gym. Photo-first, neutral
 * greys so the hold colours in photos and chips carry the colour, one
 * accent (#ff7a45) for primary actions. Light and dark follow the system.
 * Every tap target is at least 44px; primary actions sit low on the
 * screen, within thumb reach, above a bottom tab bar.
 *
 * Sections: tokens, base, layout shell, tab bar, controls, climb pieces
 * (chip, grade, tri-bar, stars), sheet, toast, empty state, static pages.
 */

/* ── Tokens ── */

:root {
  color-scheme: light dark;

  /* Surfaces and ink (light). */
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #e8eaed;
  --ink: #15181b;
  --ink-2: #4c5560;
  --ink-3: #5c6570; /* 5.3:1 on --bg, 5.9:1 on --surface */
  --line: #d7dbe0;
  --scrim: rgba(12, 14, 16, 0.5);

  /* Accent: fill for primary actions; --accent-text passes 4.5:1 as text. */
  --accent: #ff7a45;
  --accent-ink: #1d0d05;
  --accent-text: #b8481a;
  --accent-soft: rgba(255, 122, 69, 0.14);
  /* Focus ring: 3:1 against the page in both themes. */
  --focus: var(--accent-text);
  /* Accent text on an --ink background (toast actions). */
  --accent-on-ink: #ff9466;

  /* Grade verdicts. */
  --soft: #2bb3a3;
  --correct: #8a94a0;
  --hard: #f2a33a;
  --danger: #c0352e;
  --soft-text: #0f7a6e;
  --hard-text: #9a5a00;

  /* Hold tape colours (chips match the tape gyms actually use). */
  --hold-red: #e53935;
  --hold-orange: #fb8c00;
  --hold-yellow: #fdd835;
  --hold-green: #43a047;
  --hold-blue: #1e88e5;
  --hold-purple: #8e24aa;
  --hold-pink: #f06292;
  --hold-black: #1b1b1b;
  --hold-white: #fafafa;
  --hold-grey: #9e9e9e;

  /* Type: the system face, a 1.2 scale. Tabular figures for grades. */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.125rem;

  /* Space (4px base), radius, size. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --tap: 44px;
  --tabbar-h: 60px;
  --topbar-h: 52px;
  --max-w: 640px;

  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.18);
  --shadow-toast: 0 6px 24px rgba(0, 0, 0, 0.22);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1215;
    --surface: #181c20;
    --surface-2: #22272c;
    --ink: #eef1f4;
    --ink-2: #b4bcc4;
    --ink-3: #8d969f;
    --line: #2c3238;
    --scrim: rgba(0, 0, 0, 0.62);
    --accent-text: #ff9466;
    --accent-soft: rgba(255, 122, 69, 0.18);
    --accent-on-ink: #b8481a;
    --focus: var(--accent);
    --hold-black: #0a0a0a;
    --danger: #ff6b62;
    --soft-text: #4fd1c1;
    --hard-text: #f5b860;
    --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.5);
    --shadow-toast: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

/* ── Base ── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-md) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
  display: block;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

#app:focus {
  outline: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ── Layout shell ── */

#app {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s5));
}

.screen {
  max-width: var(--max-w);
  margin: 0 auto;
}

.screen-body {
  padding: var(--s4) max(var(--s4), env(safe-area-inset-left)) 0 max(var(--s4), env(safe-area-inset-right));
  display: grid;
  gap: var(--s4);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--s1);
  min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--s2) 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  padding: 0 var(--s2);
  font-size: var(--fs-lg);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.icon-btn:active {
  background: var(--surface-2);
}

/* Home: the one screen with a hero, set low and left like a title card. */
.home-hero {
  padding: calc(env(safe-area-inset-top) + 56px) var(--s4) var(--s5);
  display: grid;
  gap: var(--s3);
  justify-items: start;
}

.home-mark {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.home-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.home-lede {
  font-size: var(--fs-lg);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 30ch;
}

.legal-links {
  display: flex;
  gap: var(--s2);
  font-size: var(--fs-sm);
}

.legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s2);
  color: var(--ink-3);
}

.noscript {
  padding: var(--s5) var(--s4);
}

/* ── Tab bar ── */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  /* On wide screens the four tabs stay within the content column. */
  padding: 0 max(var(--s2), env(safe-area-inset-right), calc((100% - var(--max-w)) / 2)) env(safe-area-inset-bottom) max(var(--s2), env(safe-area-inset-left), calc((100% - var(--max-w)) / 2));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}

.tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  color: var(--ink-3);
  text-decoration: none;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.tab[aria-current='page'] {
  color: var(--ink);
}

.tab[aria-current='page'] .tab-icon {
  background: var(--surface-2);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 30px;
  border-radius: 15px;
  transition: background-color 160ms var(--ease);
}

/* Add is the one action people come for: it gets the accent. */
.tab-add .tab-icon,
.tab-add[aria-current='page'] .tab-icon {
  background: var(--accent);
  color: var(--accent-ink);
}

.tab-add .icon {
  stroke-width: 2.6;
}

.tab-add {
  color: var(--ink);
}

/* ── Controls ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s5);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  min-height: 52px;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.0625rem;
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.btn-block {
  width: 100%;
}

/* ── Climb pieces ── */

/* Hold colour: a torn strip of setting tape. */
.chip {
  display: inline-block;
  width: 30px;
  height: 14px;
  flex: none;
  background: var(--chip-color, var(--hold-grey));
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 100% 0, 94% 50%, 100% 100%, 8% 92%, 0 100%, 5% 50%);
  transform: rotate(-4deg);
}

.chip[data-color='red'] { --chip-color: var(--hold-red); }
.chip[data-color='orange'] { --chip-color: var(--hold-orange); }
.chip[data-color='yellow'] { --chip-color: var(--hold-yellow); }
.chip[data-color='green'] { --chip-color: var(--hold-green); }
.chip[data-color='blue'] { --chip-color: var(--hold-blue); }
.chip[data-color='purple'] { --chip-color: var(--hold-purple); }
.chip[data-color='pink'] { --chip-color: var(--hold-pink); }
.chip[data-color='grey'] { --chip-color: var(--hold-grey); }

/* Black and white tape vanish on one of the two themes. They get a grey
 * outline that follows the torn shape: the chip is the outline and an inset
 * pseudo-element with the same clip is the tape. */
.chip[data-color='black'],
.chip[data-color='white'] {
  position: relative;
  --chip-color: #8a9098;
}

.chip[data-color='black']::after,
.chip[data-color='white']::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  clip-path: inherit;
  background: var(--hold-black);
}

.chip[data-color='white']::after {
  background: var(--hold-white);
}

.grade {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.grade-main {
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.grade-orig {
  font-size: var(--fs-xs);
  font-weight: 600;
  opacity: 0.7;
}

.tri-wrap {
  display: inline-flex;
  min-width: 48px;
}

.tri {
  flex: 1;
  display: flex;
  gap: 2px;
  height: 6px;
  min-width: 48px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}

.tri-seg {
  flex-basis: 0;
  min-width: 4px;
}

.tri-soft { background: var(--soft); }
.tri-correct { background: var(--correct); }
.tri-hard { background: var(--hard); }

.stars {
  position: relative;
  display: inline-block;
  font-size: var(--fs-sm);
  line-height: 1;
  letter-spacing: 1px;
  white-space: nowrap;
}

.stars-track {
  color: var(--line);
}

.stars-fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: var(--accent);
}

.stars-none {
  color: var(--ink-3);
  letter-spacing: 0;
}

/* ── Sheet ── */

.sheet {
  width: 100%;
  max-width: var(--max-w);
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
  animation: sheet-in 280ms var(--ease);
}

.sheet::backdrop {
  background: var(--scrim);
  animation: fade-in 280ms var(--ease);
}

.sheet.is-closing {
  animation: sheet-out 220ms ease-in forwards;
}

.sheet.is-closing::backdrop {
  animation: fade-out 220ms ease-in forwards;
}

.sheet-body {
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s4) calc(var(--s5) + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
}

.sheet-grip {
  display: grid;
  place-items: center;
  height: 28px;
  margin: 0 calc(-1 * var(--s4));
  cursor: grab;
  touch-action: none;
}

.sheet-grip::before {
  content: '';
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}

.sheet-title {
  font-size: var(--fs-xl);
  font-weight: 750;
  margin-bottom: var(--s2);
}

.sheet-actions {
  display: grid;
  gap: var(--s2);
  margin-top: var(--s5);
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
}

@keyframes sheet-out {
  to { transform: translateY(100%); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes fade-out {
  to { opacity: 0; }
}

/* Install hint. */
.install {
  display: grid;
  gap: var(--s3);
  padding-top: var(--s2);
}

.install-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.install-steps {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: var(--s2);
  font-size: 1.0625rem;
}

.install-share {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 650;
  vertical-align: bottom;
}

.install-share .icon {
  width: 20px;
  height: 20px;
  color: #0a84ff;
}

/* ── Toast ── */

.toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s3));
  z-index: 30;
  display: grid;
  justify-items: center;
  padding: 0 var(--s4);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  max-width: 480px;
  min-height: 48px;
  padding: var(--s1) var(--s1) var(--s1) var(--s4);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-toast);
  font-weight: 550;
  pointer-events: auto;
  animation: toast-in 220ms var(--ease);
}

.toast.is-leaving {
  animation: fade-out 200ms ease-in forwards;
}

.toast-text {
  flex: 1;
  padding: var(--s2) 0;
}

.toast-action {
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent-on-ink);
  font-weight: 750;
  cursor: pointer;
}

@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
}

/* ── Empty state ── */

.empty {
  display: grid;
  gap: var(--s2);
  justify-items: start;
  padding: var(--s5) var(--s4);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
}

.empty-title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.empty-body {
  color: var(--ink-2);
  max-width: 40ch;
}

.empty .btn {
  margin-top: var(--s2);
}

/* ── Static pages (about, privacy, offline) ── */

.doc {
  max-width: 68ch;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + var(--s5)) var(--s4) calc(env(safe-area-inset-bottom) + var(--s6));
}

.doc h1 {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: var(--s4) 0 var(--s3);
}

.doc h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: var(--s6) 0 var(--s2);
}

.doc p,
.doc li {
  color: var(--ink-2);
  line-height: 1.6;
}

.doc p + p {
  margin-top: var(--s3);
}

.doc ul {
  padding-left: 1.2em;
  display: grid;
  gap: var(--s3);
}

.doc strong {
  color: var(--ink);
}

.doc-lede {
  font-size: var(--fs-lg);
  line-height: 1.45;
}

.doc-back {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 600;
}

.doc-foot {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}

/* ── Settings groups and form fields (Me, admin) ── */

.group {
  display: grid;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}

.group-title {
  font-size: var(--fs-md);
  font-weight: 750;
}

.group-text {
  color: var(--ink-2);
  max-width: 60ch;
}

.group-actions {
  display: flex;
  justify-content: flex-end;
}

.field {
  display: grid;
  gap: var(--s1);
}

.field-label {
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--ink-2);
}

.field-row {
  display: flex;
  gap: var(--s2);
}

.field-input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: var(--fs-md);
}

.field-error {
  color: var(--danger);
  font-size: var(--fs-sm);
}

.field-error:empty {
  display: none;
}

/* Segmented choice: radio inputs drawn as a row of pills. */
.seg {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: grid;
  gap: var(--s1);
}

.seg-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.seg-option {
  position: relative;
  cursor: pointer;
}

.seg-input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.seg-label {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap);
  padding: var(--s1) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-weight: 650;
  line-height: 1.2;
}

.seg-hint {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.seg-input:checked + .seg-label {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.seg-input:checked + .seg-label .seg-hint {
  color: inherit;
  opacity: 0.75;
}

.seg-input:focus-visible + .seg-label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.seg-compact .seg-label {
  padding: 0 var(--s3);
}

.btn-danger {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.btn-small {
  min-height: var(--tap);
  padding: 0 var(--s4);
  font-size: var(--fs-sm);
}

/* ── Notifications ── */

.push {
  display: grid;
  gap: var(--s3);
}

.notes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
}

.note + .note {
  border-top: 1px solid var(--line);
}

.note-link {
  display: grid;
  gap: 2px;
  padding: var(--s3) 0 var(--s3) var(--s4);
  color: var(--ink);
  text-decoration: none;
  position: relative;
}

.note.is-unread .note-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: calc(var(--s3) + 0.45em);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.note-title {
  font-weight: 650;
}

.note:not(.is-unread) .note-title {
  font-weight: 500;
  color: var(--ink-2);
}

.note-body {
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.note-time {
  color: var(--ink-3);
  font-size: var(--fs-xs);
}

/* ── Gym feedback ── */

.fb-intro {
  color: var(--ink-2);
}

.fb-filters {
  display: grid;
  gap: var(--s3);
}

.fb-results {
  display: grid;
  gap: var(--s5);
}

.fb-results[aria-busy='true'] {
  opacity: 0.55;
  transition: opacity 160ms var(--ease);
}

.fb-group {
  display: grid;
  gap: var(--s2);
}

/* Columns shared by the legend and every row: grade, bar, vote count. */
.fb-legend,
.fb-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 4.25rem;
  column-gap: var(--s3);
  align-items: center;
}

.fb-legend {
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--ink-3);
}

.fb-key {
  grid-column: 2;
  grid-row: 1;
}

.fb-key.is-soft { justify-self: start; color: var(--soft-text); }
.fb-key.is-correct { justify-self: center; }
.fb-key.is-hard { justify-self: end; color: var(--hard-text); }

.fb-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
}

.fb-row {
  row-gap: 2px;
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}

.fb-grade {
  justify-self: start;
}

.fb-count {
  justify-self: end;
  font-size: var(--fs-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fb-meta {
  grid-column: 2 / 4;
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  font-size: var(--fs-sm);
}

.fb-verdict {
  font-weight: 650;
}

.fb-verdict.is-soft { color: var(--soft-text); }
.fb-verdict.is-hard { color: var(--hard-text); }
.fb-verdict.is-pending { color: var(--ink-3); font-weight: 500; }

/* The diverging bar: two halves meeting at a centre axis. Soft grows out
 * to the left, hard to the right; "correct" straddles the axis. */
.dbar {
  display: flex;
  align-items: center;
  height: 14px;
}

.dbar-half {
  flex: 1;
  display: flex;
  height: 100%;
  background: var(--surface-2);
}

.dbar-left {
  justify-content: flex-end;
  border-radius: 7px 0 0 7px;
}

.dbar-right {
  border-radius: 0 7px 7px 0;
}

.dbar-axis {
  width: 2px;
  height: 22px;
  border-radius: 1px;
  background: var(--ink);
}

.dbar-seg {
  height: 100%;
  flex: none;
}

.dbar-soft { background: var(--soft); }
.dbar-correct { background: var(--correct); }
.dbar-hard { background: var(--hard); }
.dbar-left .dbar-seg:first-child { border-radius: 7px 0 0 7px; }
.dbar-right .dbar-seg:last-child { border-radius: 0 7px 7px 0; }

/* Under the minimum vote count the bar is shown but quiet. */
.fb-row.is-thin .dbar-seg {
  opacity: 0.4;
}

/* ── Admin ── */

.cards,
.edits {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
}

.card {
  display: grid;
  gap: var(--s2);
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}

.card:first-child,
.edit:first-child {
  border-top: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-lg);
  font-weight: 750;
}

.card-tag {
  padding: 1px var(--s2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  white-space: nowrap;
}

.facts {
  margin: 0;
  padding-left: 1.1em;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.card-actions {
  display: flex;
  gap: var(--s2);
}

.edit {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}

.edit-main {
  flex: 1;
  min-width: 0;
}

.edit-what {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.edit.is-reverted .edit-what {
  color: var(--ink-3);
  text-decoration: line-through;
}

.edit-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--s3);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.confirm {
  display: grid;
  gap: var(--s2);
}

/* ── Motion preference ── */

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