/* ──────────────────────────────────────────────────────────────
 * Planning Poker — design tokens
 * Dark, neutral, sans-serif. No felt, no serif, no emoji decor.
 * ──────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg-base: #0f1115;
  --bg-elevated: #161a22;
  --bg-table: #1b2030;
  --bg-card: #1e2433;

  /* Borders */
  --border-subtle: #232a3a;
  --border-default: #2c3447;
  --border-strong: #3a445c;

  /* Text */
  --text-primary: #e6e8eb;
  --text-secondary: #9ba3b4;
  --text-tertiary: #6c7689;
  --text-on-accent: #ffffff;

  /* Accent (single — cool blue) */
  --accent: #5b8dee;
  --accent-hover: #6b9aef;
  --accent-active: #4a7ad8;
  --accent-soft: rgba(91, 141, 238, 0.12);
  --accent-glow: rgba(91, 141, 238, 0.35);

  /* Semantic (used sparingly) */
  --positive: #4ade80;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Effects */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

  --duration-fast: 120ms;
  --duration-base: 200ms;

  /* Type — Inter, fallback to system */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@supports (font-variation-settings: normal) {
  :root { --font-sans: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100%;
}

body {
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
}

input {
  font-family: inherit;
  color: inherit;
}

/* ──────────────────────────────────────────────────────────────
 * Buttons
 * ──────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background var(--duration-fast), transform var(--duration-fast);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-active);
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.5;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--duration-fast), color var(--duration-fast);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ──────────────────────────────────────────────────────────────
 * Landing
 * ──────────────────────────────────────────────────────────── */

.landing-body {
  overflow: auto;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.landing-title {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.landing-subtitle {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 0 40px;
  font-weight: 400;
}

.landing .btn-primary {
  padding: 14px 28px;
  font-size: 16px;
}

.landing-footer {
  margin-top: 64px;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* ──────────────────────────────────────────────────────────────
 * Session — layout shell
 * ──────────────────────────────────────────────────────────── */

.session-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.session-slug {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.participant-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.connection-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background var(--duration-base);
}

.connection-status.connected {
  background: var(--positive);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.connection-status.disconnected {
  background: var(--warning);
}

/* ──────────────────────────────────────────────────────────────
 * Arena — table + participants
 * ──────────────────────────────────────────────────────────── */

.session-arena {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 32px;
}

.table-container {
  position: relative;
  width: min(720px, 90vw);
  height: min(420px, 60vh);
}

.table-surface {
  position: absolute;
  inset: 25% 8%;
  background: var(--bg-table);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.btn-table {
  padding: 14px 32px;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-base);
  min-width: 180px;
}

.btn-table:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-table:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-table:disabled {
  background: transparent;
  color: var(--text-tertiary);
  font-weight: 400;
  box-shadow: none;
}

.btn-table.state-reveal {
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 32px var(--accent-glow);
}

/* ──────────────────────────────────────────────────────────────
 * Participants
 * ──────────────────────────────────────────────────────────── */

.participants-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.participant-slot {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.participant-name {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 96px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.participant-slot.is-you .participant-name {
  color: var(--text-primary);
}

/* Mini card above the name — pure rectangle, no playing-card vibes */
.mini-card {
  width: 36px;
  height: 52px;
  perspective: 600px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-back-face,
.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  border: 1px solid var(--border-default);
}

.card-back-face {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.card-face {
  transform: rotateY(180deg);
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-color: var(--accent);
}

/* Invisible spacer matching mini-card height so name baseline doesn't jump. */
.mini-card-spacer {
  width: 36px;
  height: 52px;
}

/* ──────────────────────────────────────────────────────────────
 * Stats — under the table after reveal
 * ──────────────────────────────────────────────────────────── */

.stats-area {
  position: absolute;
  left: 50%;
  bottom: -130px;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0;
  opacity: 0;
  transition: opacity var(--duration-base);
  pointer-events: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.stats-area.visible {
  opacity: 1;
  pointer-events: auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px;
  min-width: 64px;
  justify-content: center;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 500;
}

.stat-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  background: var(--border-subtle);
}

.consensus-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  background: rgba(74, 222, 128, 0.08);
  color: var(--positive);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.consensus-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.no-votes-msg {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Histogram — small bars beside numbers */
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 16px;
  border-left: 1px solid var(--border-subtle);
  height: 56px;
}

.histogram-bin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.histogram-bar {
  width: 14px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  opacity: 0.6;
}

.histogram-bar.is-min {
  opacity: 1;
}

.histogram-bar.is-max {
  background: var(--warning);
  opacity: 1;
}

.histogram-label {
  font-size: 10px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────────
 * Scale — voting cards at the bottom
 * ──────────────────────────────────────────────────────────── */

.scale-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.scale-card {
  width: 56px;
  height: 80px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: all var(--duration-fast);
}

.scale-card:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
}

.scale-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  transform: translateY(-3px);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.scale-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ──────────────────────────────────────────────────────────────
 * Modal
 * ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: min(380px, 90vw);
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.modal-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--duration-fast);
}

.modal-input::placeholder {
  color: var(--text-tertiary);
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-box .btn-primary {
  width: 100%;
  margin-top: 16px;
}

/* ──────────────────────────────────────────────────────────────
 * Toast
 * ──────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity var(--duration-base), transform var(--duration-base);
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ──────────────────────────────────────────────────────────────
 * Expired state
 * ──────────────────────────────────────────────────────────── */

.expired-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

.expired-screen h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 12px;
}

.expired-screen p {
  color: var(--text-secondary);
  margin: 0 0 24px;
}
