@font-face {
  font-family: 'Paper Mono';
  src: url('/assets/fonts/PaperMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --border: #e2e2e2;
  --text: #1b1b1b;
  --muted: #6f6f6f;
  --accent: #111111;
  --accent-muted: #d5d5d5;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

@media (display-mode: standalone) {
  header {
    padding-top: env(safe-area-inset-top);
  }
}

button {
  touch-action: manipulation;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 36px;
}

.header-top {
  display: flex;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: space-between !important;
  gap: 24px;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.header-title h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.share-link {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  align-self: center;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
}

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

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: currentColor;
}

.connection-dot.connecting {
  background: transparent;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end !important;
  gap: 10px;
  row-gap: 8px;
  align-items: center;
  max-width: 320px;
  position: relative;
}

.meta-name {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
  padding: 0;
  margin: 0;
}

.meta-name-label {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  padding-top: 0.56rem;
  font-weight: 200;
}

.nickname-input {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  min-width: 160px;
  text-align: right;
  font-size: 0.95rem;
}

.meta-chip {
  border: 1px solid var(--border);
  background: transparent;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.presence-chip {
  cursor: pointer;
  border-style: solid;
}

.presence-chip[aria-expanded='true'] {
  background: var(--accent-muted);
  color: var(--text);
}

.meta-more {
  border: none;
  background: none;
  padding: 0 6px;
  font-size: 1.2rem;
  line-height: 1;
  color: rgba(27, 27, 27, 0.26);
  cursor: pointer;
  transition: color 120ms ease;
}

.meta-more:hover,
.meta-more:focus-visible {
  color: rgba(27, 27, 27, 0.6);
  outline: none;
}

.header-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 6px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  padding: 8px;
  display: grid;
  gap: 2px;
  z-index: 20;
}

.header-menu button {
  border: none;
  background: none;
  text-align: left;
  padding: 6px 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 27, 27, 0.6);
  cursor: pointer;
  border-radius: 4px;
  transition: background 120ms ease, color 120ms ease;
}

.header-menu button:hover,
.header-menu button:focus-visible {
  background: rgba(17, 24, 39, 0.08);
  color: rgba(17, 24, 39, 0.9);
  outline: none;
}

.header-menu button.danger {
  color: rgba(148, 54, 54, 0.8);
}

.header-menu button.danger:hover,
.header-menu button.danger:focus-visible {
  background: rgba(148, 54, 54, 0.08);
  color: rgba(148, 54, 54, 0.95);
}

.header-title .board-nickname {
  margin: 4px 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 27, 27, 0.45);
}

.header-menu-section {
  display: grid;
  gap: 4px;
  padding: 4px 2px;
}

.header-menu .menu-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(27, 27, 27, 0.45);
}

.header-menu .menu-select select {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: rgba(27, 27, 27, 0.75);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 4px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.header-menu .menu-select select:focus-visible {
  outline: 2px solid rgba(17, 24, 39, 0.28);
  outline-offset: 1px;
}

.header-menu .menu-select select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-menu .menu-item.menu-subtle {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 27, 27, 0.45);
}

.header-menu .menu-item.menu-subtle:hover,
.header-menu .menu-item.menu-subtle:focus-visible {
  color: rgba(17, 24, 39, 0.75);
}

.presence-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.presence-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.presence-list li {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

form.add-topic-form {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

form.add-topic-form input[type='text'] {
  flex: 1;
  padding: 12px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 1rem;
}

form.add-topic-form button {
  padding: 12px 20px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

form.add-topic-form button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topics {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.topic-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: stretch;
}

.topic-vote-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.topic-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.topic-card {
  position: relative;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 180ms ease, color 180ms ease;
  background-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

.topic-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(17, 24, 39, 0.08) 0%, rgba(17, 24, 39, 0.02) 100%);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
  z-index: 0;
}

.topic-card.highlight::before {
  opacity: 1;
  animation: topic-card-highlight-fill var(--highlight-duration, 1200ms) linear forwards;
  animation-delay: calc(-1 * var(--highlight-elapsed, 0ms));
}

.topic-card > * {
  position: relative;
  z-index: 1;
}

@keyframes topic-card-highlight-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.topic-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.topic-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
}

.topic-card.discussing {
  border-color: var(--accent);
  background-color: rgba(17, 24, 39, 0.06);
}

.topic-card.discussing .topic-title {
  font-weight: 600;
}

.topic-card.discussed {
  color: rgba(27, 27, 27, 0.6);
}

.topic-card.discussed .topic-title,
.topic-card.discussed .topic-header,
.topic-card.discussed .topic-controls,
.topic-card.discussed .topic-timer,
.topic-card.discussed .topic-timer-display,
.topic-card.discussed .status-action,
.topic-card.discussed .vote-unvote,
.topic-card.discussed .timer-extend,
.topic-card.discussed .vote-total-button {
  color: currentColor;
}

.topic-card.discussed .timer-extend {
  border-color: rgba(27, 27, 27, 0.16);
}

.topic-card.expired {
  color: var(--muted);
}

.topic-card.expired .topic-title {
  color: var(--muted);
}

.topic-card.archived {
  color: rgba(27, 27, 27, 0.28);
}

.topic-card.archived .topic-title,
.topic-card.archived .topic-header,
.topic-card.archived .topic-controls,
.topic-card.archived .topic-timer,
.topic-card.archived .topic-timer-display,
.topic-card.archived .status-action,
.topic-card.archived .vote-unvote,
.topic-card.archived .timer-extend {
  color: currentColor;
}

.topic-card.archived .vote-total-button {
  color: currentColor;
}

.topic-card.archived .status-action {
  display: none;
}

.topic-card.has-revert .status-revert {
  margin-left: auto;
  appearance: none;
  border: none;
  background: none;
  color: currentColor;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease;
}

.topic-card.has-revert .status-revert:focus-visible,
.topic-card.has-revert .status-revert:hover {
  opacity: 0.3;
  outline: none;
}

.topic-card.has-revert .status-revert:focus-visible {
  outline: 2px solid rgba(17, 24, 39, 0.35);
  outline-offset: 3px;
}

@media (pointer: coarse) {
  .topic-card.has-revert .status-revert {
    opacity: 0.2;
  }
}

.topic-card.archived .timer-extend {
  border-color: rgba(27, 27, 27, 0.1);
}

.topic-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
}

.topic-timer.expired {
  color: var(--muted);
}

.topic-timer-display {
  font-variant-numeric: tabular-nums;
}

.timer-extend {
  border: 1px solid var(--border);
  background: transparent;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.timer-extend:active {
  background: var(--accent-muted);
}

.status-action {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 0;
}

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

.status-action[data-status="1"],
.status-action[data-status="2"],
.status-action[data-status="3"] {
  color: var(--text);
}

.empty-state {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

body.render-paused::after {
  content: 'Render paused — Shift+R to resume, Shift+S to step';
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 9999;
}

@media (max-width: 640px) {
  .app {
    padding: 32px 18px 56px;
  }

  .header-top {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px;
  }

  .header-meta {
    display: flex;
    flex-direction: row;
    justify-content: space-between !important;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: none;
    gap: 4px;
    padding: 0;
    font-size: 0.6rem;
    line-height: 1;
  }

  .meta-name {
    align-items: center;
    gap: 2px;
    flex: 1 1 120px;
    min-width: 0;
    max-width: min(50%, 150px);
    font-size: inherit;
    padding: 0 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    line-height: 1;
  }

  .meta-name-label {
    font-size: inherit;
    padding-top: 0;
  }

  .nickname-input {
    text-align: left;
    font-size: 0.58rem;
    padding: 0 0 0 2px;
    min-width: 0;
    flex: 1 1 auto;
    border: none;
    line-height: 1;
    background: transparent;
  }

  .meta-chip {
    font-size: inherit;
    padding: 0 4px;
    line-height: 1;
    gap: 3px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .meta-more {
    margin-left: 0;
    flex: 0 0 auto;
  }

  .header-title .board-nickname {
    font-size: 0.7rem;
  }

  .topic-layout {
    grid-template-columns: auto 1fr;
  }

  .topic-vote-column {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
  }

  .vote-total-button {
    font-size: 3.2rem;
  }

  .topic-content {
    gap: 12px;
  }

  form.add-topic-form {
    flex-direction: column;
  }
}

  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .topic-layout {
    grid-template-columns: auto 1fr;
  }

  .topic-vote-column {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
  }

  .vote-total-button {
  font-family: 'Paper Mono', "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 4.6rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  border: none;
  background: none;
  appearance: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-align: left;
  display: block;
}

  .topic-content {
    gap: 12px;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .meta-name {
    align-items: flex-start;
  }

  .nickname-input {
    text-align: left;
  }

  form.add-topic-form {
    flex-direction: column;
  }
}

;
  .header-top {
    flex-direction: column;
    align-items: stretch;
  .topic-layout {
    grid-template-columns: auto 1fr;
  }

  .topic-vote-column {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: 100%
  }

.vote-total-button {
  font-family: 'Paper Mono', "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 4.6rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  border: none;
  background: none;
  appearance: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-align: left;
  display: block;
}

  .topic-content {
    gap: 12px;
  }

    gap: 18px;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .meta-name {
    align-items: flex-start;
  }

  .nickname-input {
    text-align: left;
  }

  form.add-topic-form {
    flex-direction: column;
  }
}
.vote-total-button {
  font-family: 'Paper Mono', "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 6rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  border: none;
  background: none;
  appearance: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-align: left;
  display: block;
}

.vote-total-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
}

.vote-total-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.vote-unvote {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.vote-unvote:hover:not(:disabled) {
  color: var(--text);
  border-bottom-color: var(--text);
}

.vote-unvote:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
