/* One hand-written stylesheet, no framework, system font stack (§11.1). */

:root {
  --ink: #16202b;
  --ink-soft: #5c6b7a;
  --line: #dfe5ec;
  --page: #f5f7fa;
  --card: #ffffff;
  --sea: #1f6feb;
  --sea-dark: #1a5cc4;
  --wait: #fff5d6;
  --wait-line: #e6c85a;
  --warn: #ffe9e3;
  --warn-line: #e0836a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.06), 0 8px 24px rgba(22, 32, 43, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 0.75rem;
}

/* ------------------------------------------------------------------ screens */

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen-centered {
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  width: 100%;
  max-width: 26rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.wordmark-mark {
  font-size: 1.15rem;
}

.blurb {
  color: var(--ink-soft);
}

.fineprint {
  color: var(--ink-soft);
  font-size: 0.83rem;
  margin: 0.9rem 0 0;
}

/* -------------------------------------------------------------------- forms */

.name-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.text-input {
  font: inherit;
  color: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.text-input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

.primary {
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--sea);
  color: #fff;
  cursor: pointer;
}

.primary:hover {
  background: var(--sea-dark);
}

.primary:disabled {
  background: #b7c4d3;
  cursor: not-allowed;
}

.ghost {
  font: inherit;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.ghost:hover {
  border-color: #c3ccd7;
}

.notice {
  margin: 0.9rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--warn);
  border: 1px solid var(--warn-line);
  font-size: 0.88rem;
}

/* ------------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.topbar-left .wordmark {
  margin: 0;
}

.phases {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.phase {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.phase-number {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.phase.is-current {
  background: #e8f0fe;
  color: var(--sea-dark);
}

.phase.is-done {
  opacity: 0.5;
}

.avatars {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  flex: none;
}

.avatar.is-away {
  opacity: 0.38;
  filter: saturate(0.5);
}

.avatar-crown {
  position: absolute;
  top: -6px;
  right: -3px;
  font-size: 0.62rem;
  color: #f0b429;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
}

/* Everyone's remaining votes, live on their avatar while Phase 3 is open (§9.4).
   Spent reads as a quiet, filled badge; still-holding reads as a bright one, so a
   glance at the roster says who the retro is waiting for. */

.avatar-votes {
  position: absolute;
  bottom: -5px;
  right: -5px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  border: 1.5px solid var(--card);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}

.avatar-votes.is-holding {
  background: #f0b429;
  color: #3a2a00;
}

.avatar-votes.is-spent {
  background: var(--ink-soft);
  color: #fff;
}

/* §9.1's avatar menu: on a host's roster every other live participant's circle is the
   trigger. It inherits .avatar's looks exactly; only focus and the open state say so. */

button.avatar {
  font: inherit;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button.avatar:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

button.avatar.is-open {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

/* The picker itself (§5.8): a small card under the roster's right edge, carrying the
   one deliberate action — handing the room to the person it names. */

.host-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 17rem;
  padding: 0.85rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}

.host-menu-name {
  font-weight: 650;
}

.host-menu-note {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.host-menu-make {
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
  border: 0;
  border-radius: 8px;
  background: var(--sea);
  color: #fff;
  cursor: pointer;
}

.host-menu-make:hover {
  background: var(--sea-dark);
}

.pill {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.pill-warn {
  background: var(--warn);
  border-color: var(--warn-line);
}

.pill-wait {
  background: var(--wait);
  border-color: var(--wait-line);
}

/* ------------------------------------------------------------------ banners */

.banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
}

.banner-wait {
  background: var(--wait);
  border-bottom-color: var(--wait-line);
}

.banner-warn {
  background: var(--warn);
  border-bottom-color: var(--warn-line);
}

.banner-space {
  background: #eef6ff;
  border-bottom-color: #b6d4f5;
  color: #1c3d63;
}

/* The deposed host tab's banner (§5.6): a message and one deliberate action. */
.banner-lock {
  background: #f3ecff;
  border-bottom-color: #c9b2ef;
  color: #3c2263;
}

.banner-action {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border: 1px solid #c9b2ef;
  border-radius: 999px;
  background: #fff;
  color: #3c2263;
  cursor: pointer;
  white-space: nowrap;
}

.banner-action:hover {
  border-color: #a784d9;
}

/* §9.6's toast: one brief line, floating free of the layout so nothing shifts when it
   arrives or leaves. Retired by the app's own tick, not by any interaction. */

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: reveal-in 0.35s ease-out both;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.topbar-control {
  white-space: nowrap;
}

/* -------------------------------------------------------------------- board */

.columns {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem;
}

.columns-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .columns-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .columns-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.column {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 10rem;
}

.column-head {
  margin: 0;
}

.column-blurb {
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin: 0;
}

/* -------------------------------------------------------------- compose box */

.compose {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.compose-input {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

textarea.compose-input {
  resize: vertical;
  min-height: 4.2rem;
  line-height: 1.4;
}

.compose-input:disabled {
  background: #f2f5f9;
  color: var(--ink-soft);
}

.compose-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1rem;
}

.compose-count {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.compose-hint {
  font-size: 0.72rem;
  color: var(--sea-dark);
}

/* ------------------------------------------------------------------- tickets */

.tickets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.95rem 0.55rem 0.65rem;
}

.ticket-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Somebody else's Phase-1 ticket: same card footprint, no text — it is not that the
   text is hidden here, it never arrived (§6.3). */
.ticket-body-redacted {
  min-height: 2.3em;
  cursor: help;
}

.ticket-body-redacted::before,
.ticket-body-redacted::after {
  content: "";
  display: block;
  height: 0.55em;
  border-radius: 3px;
  background: #e2e8ef;
  margin-bottom: 0.4em;
  animation: redacted-pulse 2.4s ease-in-out infinite;
}

.ticket-body-redacted::before {
  width: 92%;
}

.ticket-body-redacted::after {
  width: 58%;
}

@keyframes redacted-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.55;
  }
}

.ticket-tools {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  display: none;
  gap: 0.25rem;
}

.ticket:hover .ticket-tools,
.ticket:focus-within .ticket-tools {
  display: flex;
}

.tool {
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
}

.tool:hover {
  border-color: var(--sea);
  color: var(--sea-dark);
}

.tool-danger:hover {
  border-color: var(--warn-line);
  background: var(--warn);
  color: #a33d24;
}

.ticket-edit {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--sea);
  border-radius: 6px;
  background: #fff;
}

.ticket.is-editing .fineprint {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
}

/* The staggered flip-in as the texts land at the 1→2 reveal (§9.2). */
@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.ticket.is-revealed {
  animation: reveal-in 0.35s ease-out both;
}

.tickets > .ticket.is-revealed:nth-child(4n + 2) {
  animation-delay: 0.07s;
}

.tickets > .ticket.is-revealed:nth-child(4n + 3) {
  animation-delay: 0.14s;
}

.tickets > .ticket.is-revealed:nth-child(4n + 4) {
  animation-delay: 0.21s;
}

@media (prefers-reduced-motion: reduce) {
  .ticket.is-revealed,
  .ticket-body-redacted::before,
  .ticket-body-redacted::after {
    animation: none;
  }
}

/* ------------------------------------------------------------------ grouping */

/* Phase 2 (§9.3): ungrouped tickets on the left, groups on a canvas on the right.
   `--lock-color` carries the holder's colour onto whatever they hold (§11.6: a lock is
   also communicated by border and text, never colour alone). */

.grouping {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem;
  align-items: start;
  overflow: hidden;
}

.ungrouped,
.canvas {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  max-height: calc(100vh - 9rem);
  overflow-y: auto;
}

.pane-head {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.canvas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.canvas-head h2 {
  margin: 0;
}

.pane-empty {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

.groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  min-height: 5rem;
  position: relative;
}

.group.is-naming {
  border-color: var(--lock-color);
  box-shadow: 0 0 0 2px var(--lock-color);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.group-name {
  font-size: 1rem;
  font-weight: 650;
  margin: 0;
  cursor: text;
  overflow-wrap: anywhere;
}

.group-name-input {
  font: inherit;
  font-weight: 650;
  width: calc(100% - 2.4rem);
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--lock-color, var(--sea));
  border-radius: 6px;
  background: #fff;
}

.naming-note {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.group-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.group-tickets {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.group-ticket {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.88rem;
}

.group-ticket.is-grabbed {
  opacity: 0.5;
}

.group-ticket-text {
  overflow-wrap: anywhere;
}

.group-empty {
  color: var(--ink-soft);
  font-size: 0.82rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 0.7rem;
  text-align: center;
  margin: 0.55rem 0 0;
}

.chip {
  font-size: 0.68rem;
  font-weight: 650;
  color: #fff;
  padding: 0.06rem 0.42rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  flex: none;
}

.chip-small {
  font-size: 0.62rem;
}

/* Phase-2 ticket cards reuse the Phase-1 card, plus the grab state (§9.3). */

.ticket.is-grabbed {
  opacity: 0.55;
  border-width: 2px;
  border-color: var(--lock-color);
}

.ticket.is-picked {
  outline: 2px solid var(--sea);
  outline-offset: 1px;
}

.ticket.is-dragging {
  opacity: 0.4;
}

.grab-banner {
  margin-top: 0.35rem;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  display: inline-block;
}

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

/* ------------------------------------------------------------------- voting */

/* Phase 3 (§9.4): the Phase-2 layout with a vote control on every topic, and the
   budget line spanning both columns above it. No totals anywhere — they stay private
   until Phase 4 (§8.4) — so the only numbers on this screen are your own. */

.voting {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem;
  align-items: start;
  overflow: hidden;
}

.voting .ungrouped,
.voting .canvas {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}

.vote-budget {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.5rem 0.85rem;
  background: #fffaf0;
  border: 1px solid #f0d9a8;
  border-radius: var(--radius);
  color: #5b4409;
  font-size: 0.88rem;
}

.vote-budget-count {
  font-weight: 700;
  font-size: 1rem;
  margin-right: 0.15rem;
}

/* Phase 2's title is click-to-name; Phase 3's is just a name. */
.voting .group-name {
  cursor: default;
}

.topic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.topic-count {
  color: var(--ink-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.vote {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}

.vote-step {
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.vote-step:hover:not(:disabled) {
  border-color: var(--sea);
  color: var(--sea);
}

.vote-plus {
  background: var(--sea);
  border-color: var(--sea);
  color: #fff;
  font-weight: 700;
}

.vote-plus:hover:not(:disabled) {
  background: var(--sea-dark);
  border-color: var(--sea-dark);
  color: #fff;
}

.vote-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Your votes, stacked (§9.4) — the dots are yours alone, so the count beside them is
   never a total. */

.vote-dots {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
  min-height: 14px;
  flex-wrap: wrap;
}

.vote-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sea);
  flex: none;
}

.vote-count {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--sea);
  margin-left: 0.15rem;
}

.vote-none {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.voting .topic.ticket {
  padding-bottom: 0.5rem;
}

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

/* ---------------------------------------------------------------- discussion */

/* Phase 4 (§9.5): one topic at a time, full-width. Cards grow to fill the viewport
   (auto-fit rows stretch to the full width) and the page scrolls if they still don't
   fit — no inner scrolling panes. */

.discussion {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem;
  overflow-y: auto;
}

.discuss-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.discuss-progress {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.discuss-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.discuss-topic {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.3rem;
}

.discuss-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
}

.discuss-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  overflow-wrap: anywhere;
}

.discuss-votes {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sea-dark);
  background: #e8f0fe;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.discuss-tickets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 0.8rem;
  align-items: start;
}

.discuss-card {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.discussion-done {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thanks-card {
  text-align: center;
}

.thanks-card .wordmark {
  justify-content: center;
}

.thanks-end {
  margin-top: 0.9rem;
}
