/* ═══════════════════════════════════════════════
   Party Cards — Clean Professional Theme
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-body:    #f8fafc;
  --surface:    #ffffff;
  --surface-hover: #f1f5f9;
  --border:     #e2e8f0;
  --border-focus: #94a3b8;

  /* Text */
  --ink:    #0f172a;
  --muted:  #64748b;
  --faint:  #94a3b8;

  /* Accents */
  --primary:   #2563eb;
  --primary-hover: #1d4ed8;
  --success:   #059669;
  --warning:   #d97706;
  --danger:    #e11d48;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Misc */
  --radius: 6px;
  --radius-sm: 4px;
  --transition: 150ms ease-in-out;
}

/* ─── Reset ────────────────────────────────── */

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

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg-body);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

fieldset {
  min-width: 0;
  border: 0;
}

a { color: inherit; }

/* ─── Page Shell / Layout ──────────────────── */

.page-shell {
  position: relative;
  overflow-x: hidden;
}

.layout, .game-layout {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  padding: 48px 0 40px;
}

.layout { width: min(720px, calc(100% - 32px)); }
.game-layout { width: min(1080px, calc(100% - 32px)); }

.submission-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ─── Panel Base ─────────────────────── */

.form-panel,
.setup-panel,
.score-panel,
.card-table,
.board-shell,
.team-card,
.word-card,
.score-item,
.board-cell,
.game-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-panel,
.setup-panel,
.card-table {
  padding: 32px;
}

/* ─── Site Header ──────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.site-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.site-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.site-header .lead {
  font-size: 0.875rem;
  margin: 2px 0 0;
  color: var(--muted);
}

/* ─── Typography ───────────────────────────── */

h1, h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.25rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lead {
  max-width: 44rem;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.section-heading {
  margin-bottom: 20px;
}

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

/* ─── Word Card Rows ───────────────────────── */

.word-grid, .team-list {
  display: grid;
  gap: 16px;
}

.word-card {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: end;
  padding: 16px;
}

/* ─── Inputs ───────────────────────────────── */

.word-input {
  display: grid;
  gap: 6px;
}

.word-input span {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
}

.word-input input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--transition);
}

.word-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.word-input input:disabled {
  opacity: 0.5;
  background: var(--bg-body);
}

/* ─── Activity Options ──────── */

.word-activity-fieldset {
  margin: 0; padding: 0; border: 0;
}

.word-activity-fieldset legend {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
}

.activity-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.activity-option { cursor: pointer; }

.activity-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.activity-option span {
  display: grid;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.activity-option:hover span {
  background: var(--surface-hover);
  color: var(--ink);
}

/* Simple clean checked state */
.activity-option input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.activity-option input:focus-visible + span,
button:focus-visible,
input:focus-visible,
.secondary-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Hidden Utility ───────────────────────── */

.is-hidden {
  display: none !important;
}

/* ─── Form / Setup / Round Actions ─────────── */

.form-actions,
.setup-actions,
.round-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.form-actions {
  justify-content: space-between;
}

.status-text {
  min-height: 1.4rem;
  margin: 0;
  color: var(--muted);
}

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

.primary-button,
.secondary-button,
.ghost-button,
.secondary-link {
  display: inline-flex;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-button.ready {
  background: var(--success);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.secondary-button,
.secondary-link {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

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

.primary-button.ready:not(:disabled):hover {
  background: #047857; /* darker success */
}

.secondary-button:hover,
.secondary-link:hover {
  background: var(--surface-hover);
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.danger-button {
  color: var(--danger);
}
.danger-button:hover {
  color: #be123c;
}

/* ─── Rules Dialog ─────────────────────────── */

.rules-dialog {
  position: fixed;
  inset: 0;
  width: min(480px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100vh - 32px);
  margin: auto;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
}

.rules-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.rules-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.rules-content p {
  color: var(--muted);
  margin-top: 12px;
}

.rules-content .primary-button {
  margin-top: 20px;
  margin-inline: auto;
}


/* ─── Game Layout ──────────────────────────── */

.game-layout {
  display: grid;
  gap: 24px;
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── Team Cards ───────────────────────────── */

.team-card-list {
  gap: 16px;
}

.team-card {
  padding: 16px;
  gap: 16px;
  display: grid;
}

.member-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ─── Play Panel (Board Layout) ────────────── */

.play-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
}

.board-layout {
  align-items: start;
}

.board-panel {
  display: grid;
  gap: 20px;
}

/* ─── Score Panel ──────────────────────────── */

.score-panel {
  padding: 20px;
}

.scoreboard {
  display: grid;
  gap: 8px;
}

.score-item {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.score-item span {
  font-weight: 500;
}

.score-item strong {
  font-size: 1.125rem;
  font-weight: 600;
}

.score-item.is-active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.board-score-item {
  min-height: 56px;
}

.board-score-item > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.board-score-item small {
  color: var(--faint);
  font-size: 0.75rem;
}

/* ─── Turn Strip ───────────────────────────── */

.turn-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.active-team {
  color: var(--primary);
  font-weight: 600;
  font-size: 1rem;
}

.deck-count {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ─── Game Board ───────────────────────────── */

.board-shell {
  padding: 16px;
  overflow-x: auto;
}

.game-board {
  position: relative;
  width: 800px;
  height: 500px;
  background: var(--bg-body);
  border-radius: var(--radius);
  flex-shrink: 0;
  margin: 0 auto;
}

.board-path {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

.board-path path {
  fill: none;
  stroke: var(--border);
  stroke-width: 4px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.board-cell {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 2px solid var(--border);
  z-index: 2;
  transition: transform 0.2s ease;
}

.board-cell > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.board-cell.is-goal {
  border-color: var(--success);
  background: rgba(5, 150, 105, 0.1);
  transform: translate(-50%, -50%) scale(1.15);
}

.board-cell.is-bonus {
  border-color: var(--warning);
  background: rgba(217, 119, 6, 0.1);
}

.board-cell.is-bonus::after {
  content: '★';
  position: absolute;
  top: -8px;
  right: -8px;
  color: var(--warning);
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ─── Team Markers ─────────────────────────── */

.team-markers {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  z-index: 3;
  width: max-content;
  justify-content: center;
  pointer-events: none;
}

.team-marker {
  min-width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--team-color, var(--ink));
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ─── Card Table ───────────────────────────── */

.board-card-panel {
  padding: 24px;
}

/* ─── Timer Row ────────────────────────────── */

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.timer-display {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
}

.phase-label {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.875rem;
}

/* Timer Progress Bar */
.timer-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 100%;
  transition: width 1s linear;
}

.timer-bar-fill.is-urgent {
  background: var(--danger);
}

/* ─── Game Card ────────────────────────────── */

.game-card {
  display: grid;
  min-height: 240px;
  place-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.card-activity {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.game-card h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--ink);
}

.card-points {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

/* ─── Bonus Actions ────────────────────────── */

.bonus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ─── Success Checkmark ────────────────────── */

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  display: grid;
  place-items: center;
}

.success-icon::after {
  content: '✓';
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}


/* ─── Responsive ───────────────────────────── */

@media (max-width: 860px) {
  .word-card,
  .play-panel {
    grid-template-columns: 1fr;
  }

  .activity-options {
    grid-template-columns: 1fr;
  }

  .game-header,
  .header-actions,
  .form-actions,
  .setup-actions,
  .round-actions,
  .bonus-actions,
  .turn-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .member-list {
    grid-template-columns: 1fr;
  }

  .game-board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .secondary-link {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .layout,
  .game-layout {
    width: min(100% - 16px, 1080px);
    padding: 24px 0;
  }

  .form-panel,
  .setup-panel,
  .card-table,
  .score-panel,
  .rules-content {
    padding: 16px;
  }

  h1 { font-size: 1.5rem; }
  .game-card { min-height: 200px; }
  .game-board { gap: 2px; /* fallback, though it's absolute now */ }
  .board-cell { /* absolute positioning handles dimensions now */ }
}
