/* Planning poker: lobby, table, deck, reveal and the examples drawer. */

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--magenta));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}

.lede {
  max-width: 64ch;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ===================================================================== lobby */

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.lobby .card {
  margin-bottom: 1rem;
}

.profile-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}

.profile-fields {
  flex: 1 1 auto;
  min-width: 0;
}

.save-row {
  margin-top: 0.75rem;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  max-height: 260px;
  overflow-y: auto;
}

.avatar-choice {
  padding: 0.2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.avatar-choice:hover {
  border-color: var(--border-bright);
}

.avatar-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.recent-list,
.how-list {
  margin: 0;
  padding-left: 1.1rem;
}

.recent-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.recent-list li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.recent-list a {
  font-family: var(--mono);
  font-weight: 600;
}

.how-list li {
  margin-bottom: 0.3rem;
  color: var(--text-dim);
}

.how p {
  margin-bottom: 0;
}

/* ====================================================================== room */

.room-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 16px 5rem;
  align-items: start;
}

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

.conn-banner {
  display: none;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--amber) 50%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  font-size: 0.9rem;
}

.conn-banner[data-visible="true"] {
  display: flex;
}

.conn-banner .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid color-mix(in srgb, var(--amber) 35%, transparent);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- current story --- */

.story-head {
  margin-bottom: 1rem;
}

.story-head .story-key {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
}

.story-head h1 {
  font-family: var(--sans);
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  letter-spacing: 0;
  text-transform: none;
  margin: 0.2rem 0 0.4rem;
}

.story-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  white-space: pre-wrap;
  max-height: 7.5rem;
  overflow-y: auto;
  margin: 0;
  padding-right: 0.5rem;
}

.story-desc.expanded {
  max-height: none;
}

.story-empty {
  color: var(--text-dim);
}

/* --- the table --- */

.table {
  position: relative;
  padding: 1.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--surface);
  margin-bottom: 1rem;
}

.seats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.seat {
  position: relative;
  width: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius-sm);
}

.seat.is-you {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.seat .seat-avatar {
  width: 46px;
  height: 46px;
  position: relative;
}

.seat.offline .seat-avatar {
  opacity: 0.4;
  filter: grayscale(1);
}

.seat .seat-name {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat .seat-tags {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 1rem;
}

.seat .tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.seat .tag.crown {
  color: var(--magenta);
}

.seat .tag.async {
  color: var(--violet);
}

/* The card at each seat: face down while voting, flipped on reveal. */
.seat-card {
  width: 38px;
  height: 52px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  color: var(--text-faint);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.seat-card.empty {
  border-style: dashed;
  color: transparent;
}

/* Waiting: a gentle bob, so the eye can find who has not voted. */
.seat-card.waiting {
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.seat-card.voted {
  background: linear-gradient(135deg, var(--accent-dim), color-mix(in srgb, var(--accent) 35%, var(--surface-3)));
  border-color: var(--accent);
  color: transparent;
  /* Card-back hatching: reads as face down without needing an image. */
  background-image: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--accent) 22%, transparent) 0 3px,
    transparent 3px 6px
  );
}

.seat-card.revealed {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--text);
  animation: flip-in 0.3s ease-out backwards;
}

.seat-card.revealed.hidden-vote {
  color: var(--text-faint);
}

@keyframes flip-in {
  from {
    transform: rotateY(90deg) scale(0.9);
  }
  to {
    transform: rotateY(0) scale(1);
  }
}

.seat-card.outlier-high {
  box-shadow: 0 0 0 2px var(--red);
}

.seat-card.outlier-low {
  box-shadow: 0 0 0 2px var(--accent);
}

.reaction-float {
  position: absolute;
  top: -4px;
  left: 50%;
  font-size: 1.3rem;
  pointer-events: none;
  animation: float-up 1.4s ease-out forwards;
}

@keyframes float-up {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.6);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -48px) scale(1.3);
  }
}

/* --- progress / status strip --- */

.table-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.progress {
  flex: 1 1 160px;
  max-width: 260px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--magenta));
  transition: width 0.25s ease;
}

.countdown {
  font-size: 1rem;
  color: var(--amber);
}

/* --- the deck --- */

.deck-wrap {
  margin-bottom: 1rem;
}

.deck {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.card-btn {
  position: relative;
  width: 62px;
  height: 88px;
  padding: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.card-btn:hover:not(:disabled) {
  transform: translateY(-6px);
  border-color: var(--accent);
  background: var(--surface-2);
}

.card-btn[aria-pressed="true"] {
  transform: translateY(-10px);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 25%, transparent);
}

.card-btn .card-hint {
  position: absolute;
  bottom: 5px;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.card-btn:disabled {
  opacity: 0.4;
}

@media (max-width: 560px) {
  .card-btn {
    width: 50px;
    height: 72px;
    font-size: 1.05rem;
  }

  .seat {
    width: 86px;
  }
}

/* --- facilitator controls --- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.controls .estimate-box {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-left: auto;
}

.controls select {
  width: auto;
  min-width: 80px;
}

/* --- reveal: distribution + stats --- */

.results {
  margin-bottom: 1rem;
}

.dist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.dist-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.dist-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
}

.dist-bar {
  height: 26px;
  border-radius: 4px;
  background: var(--surface-3);
  position: relative;
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.dist-voters {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}

.dist-voters .avatar {
  width: 22px;
  height: 22px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 0.6rem;
}

.stat {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.stat .stat-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.stat .stat-value {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.spotlight {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border));
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber) 8%, var(--surface));
  font-size: 0.92rem;
}

.spotlight strong {
  color: var(--amber);
}

.unanimous-note {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--border));
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
  font-size: 0.92rem;
}

/* ============================================================ side column */

.side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 72px;
}

@media (max-width: 960px) {
  .side {
    position: static;
  }
}

.side section {
  padding: 0.85rem;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 300px;
  overflow-y: auto;
}

.queue li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.85rem;
}

.queue li.current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.queue li.done {
  opacity: 0.65;
}

.queue li.skipped {
  opacity: 0.5;
  text-decoration: line-through;
}

.queue .q-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue .q-key {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-right: 0.3rem;
}

.queue .q-points {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.queue-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.reactions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.reactions button {
  font-size: 1.05rem;
  padding: 0.25rem 0.45rem;
  line-height: 1;
}

.share-row input {
  font-family: var(--mono);
  font-size: 0.75rem;
}

.qr {
  margin-top: 0.6rem;
  display: grid;
  place-items: center;
}

.qr svg {
  width: 148px;
  height: 148px;
  background: #fff;
  padding: 6px;
  border-radius: 6px;
}

/* ================================================== examples drawer + modals */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  z-index: 70;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-bright);
  background: var(--surface);
  box-shadow: -14px 0 40px rgb(0 0 0 / 35%);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.drawer[data-open="true"] {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.drawer-head h2 {
  margin: 0;
  flex: 1 1 auto;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem;
}

.example-group {
  margin-bottom: 1.1rem;
}

.example-group h3 {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.example-group h3 .chip {
  display: grid;
  place-items: center;
  min-width: 2rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.9rem;
}

.example {
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.example .ex-key {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
}

.example .ex-title {
  display: block;
  font-weight: 600;
  margin: 0.1rem 0;
}

.example .ex-why {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 0;
}

/* Hover tooltip on a deck card, showing that value's examples. */
.card-tip {
  position: fixed;
  z-index: 80;
  max-width: 300px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  pointer-events: none;
}

.card-tip strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}

.card-tip ul {
  margin: 0;
  padding-left: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(560px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.1rem;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-bottom: 0.75rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.diff-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
}

.diff-row .from {
  color: var(--text-faint);
}

.diff-row .to {
  color: var(--green);
}

/* ============================================================== celebration */

#celebrate-canvas {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
}

.shake {
  animation: shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translate(-2px, 1px);
  }
  20%,
  80% {
    transform: translate(4px, -2px);
  }
  30%,
  50%,
  70% {
    transform: translate(-7px, 2px);
  }
  40%,
  60% {
    transform: translate(7px, -1px);
  }
}

/* The quiet alternative for anyone who asked not to be animated at. */
.calm-banner {
  position: fixed;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  z-index: 96;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
}

/* ================================================================= history */

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.history-table th {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.history-table td.points {
  font-family: var(--mono);
  font-weight: 700;
}

.award {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.4rem 0;
}

.award .award-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  min-width: 10rem;
}

/* ================================================== examples admin page */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.value-column {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.value-column h3 {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

.value-column .chip {
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: var(--surface-3);
  font-size: 1rem;
  font-weight: 700;
}

.admin-example {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.86rem;
}

.admin-example .row {
  justify-content: space-between;
  gap: 0.4rem;
}
