/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #252836;
  --border: #2e3145;
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Landing ──────────────────────────────────────────────────── */
.landing {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.logo-icon { font-size: 2.5rem; }
.logo-text { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }

.tagline { color: var(--text-muted); font-size: 1.05rem; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  flex: 1;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color .2s, transform .2s;
  position: relative;
}

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

.tool-card--disabled { opacity: .5; cursor: default; }

.tool-icon { font-size: 2.25rem; }

.tool-info h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: .35rem; }
.tool-info p  { font-size: .9rem; color: var(--text-muted); line-height: 1.45; }

.tool-badge {
  align-self: flex-start;
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tool-badge.available    { background: rgba(99,102,241,.2); color: var(--accent-hover); }
.tool-badge.coming-soon  { background: rgba(107,114,128,.15); color: var(--text-muted); }

.landing-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  padding-top: 2rem;
  margin-top: auto;
}

/* ── Retro: create/join page ──────────────────────────────────── */
.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.page-back { color: var(--text-muted); font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 2rem; }
.page-back:hover { color: var(--text); }

.page h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: .5rem; }
.page .subtitle { color: var(--text-muted); margin-bottom: 2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-muted); margin-bottom: .5rem; letter-spacing: .04em; text-transform: uppercase; }

input[type="text"], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
select option { background: var(--surface); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--accent); color: #fff; width: 100%; justify-content: center; }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger   { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.divider { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: .85rem; margin: 1.5rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Retro board ──────────────────────────────────────────────── */
.board-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.board-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.board-topbar .board-name { font-weight: 600; font-size: 1.05rem; flex: 1; }

.phase-indicator {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
}

.phase-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.participants-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .8rem;
  color: var(--text-muted);
}

/* Facilitator toolbar */
.facilitator-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  background: rgba(99,102,241,.08);
  border-bottom: 1px solid rgba(99,102,241,.2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.facilitator-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent-hover);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-right: .25rem;
}

.facilitator-bar .btn { font-size: .85rem; padding: .45rem 1rem; }
.facilitator-bar .spacer { flex: 1; }

/* Columns */
.board-columns {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
}

.column {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.column-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.column-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.column-title { font-weight: 600; font-size: .95rem; }
.column-count { margin-left: auto; font-size: .8rem; color: var(--text-muted); background: var(--surface2); padding: .1rem .5rem; border-radius: 999px; }

.cards-list {
  flex: 1;
  overflow-y: auto;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* Add card form at bottom of column */
.add-card-form {
  padding: .75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.add-card-form textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .6rem .75rem;
  font-size: .9rem;
  font-family: inherit;
  resize: none;
  height: 68px;
  outline: none;
  transition: border-color .15s;
}
.add-card-form textarea:focus { border-color: var(--accent); }
.add-card-form textarea::placeholder { color: var(--text-muted); }

.add-card-form .form-row {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
}

.add-card-btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .5rem;
  font-size: .85rem;
  font-weight: 600;
}
.add-card-btn:hover { opacity: .9; }

/* Sticky cards */
.card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .85rem;
  position: relative;
  transition: border-color .15s;
}

.card:hover { border-color: #3e4260; }

.card-content { font-size: .9rem; line-height: 1.45; word-break: break-word; }

.card-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
}

.card-author { font-size: .75rem; color: var(--text-muted); }
.card-group-label { font-size: .7rem; background: rgba(99,102,241,.2); color: var(--accent-hover); padding: .1rem .5rem; border-radius: 999px; }

.card-actions { display: flex; align-items: center; gap: .35rem; margin-left: auto; }

.vote-btn, .delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .8rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  line-height: 1;
}
.vote-btn:hover  { background: rgba(99,102,241,.15); color: var(--accent-hover); }
.delete-btn:hover { background: rgba(239,68,68,.15); color: var(--red); }
.vote-count { font-size: .75rem; color: var(--text-muted); }

/* ── AI Panel ─────────────────────────────────────────────────── */
.ai-panel {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.5rem;
  flex-shrink: 0;
  max-height: 280px;
  overflow-y: auto;
}

.ai-panel h3 { font-size: .85rem; font-weight: 600; color: var(--accent-hover); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .75rem; }

.action-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.action-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .9rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.action-item-content { flex: 1; font-size: .9rem; }
.action-item-owner { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.action-delete-btn { background: none; border: none; color: var(--text-muted); font-size: .9rem; padding: .1rem; }
.action-delete-btn:hover { color: var(--red); }

/* ── Join modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.modal p  { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Share link box ───────────────────────────────────────────── */
.share-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}
.share-box .share-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .4rem; }
.share-box .share-url { font-size: .9rem; word-break: break-all; color: var(--accent-hover); margin-bottom: .6rem; }
.share-box .copy-btn { font-size: .8rem; padding: .35rem .8rem; }

/* ── Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem 1.25rem;
  font-size: .9rem;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ── Loading / empty states ───────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  padding: 2rem 1rem;
}

.spinner {
  display: inline-block;
  width: 1.2rem; height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
