:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #f0f0f7;
  --surface: #ffffff;
  --text: #1e1e2e;
  --text-muted: #6b7280;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
  --shadow-card: 3px 3px 10px rgba(0,0,0,0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
}

.view { height: 100dvh; }

/* ── Landing ── */
.landing-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 32px;
  padding: 24px;
}

.logo { text-align: center; }
.logo-icon { font-size: 56px; }
.logo h1 { font-size: 2.2rem; font-weight: 800; color: var(--primary); margin-top: 8px; }
.logo-sub { color: var(--text-muted); margin-top: 6px; }

.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
}

.tab-row { display: flex; gap: 8px; margin-bottom: 24px; }
.tab {
  flex: 1;
  padding: 10px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.tab.active { border-color: var(--primary); color: var(--primary); background: #eef2ff; }

.field-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; margin-top: 14px; }
.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
  background: var(--surface);
}
.field-input:focus { border-color: var(--primary); }
textarea.field-input { resize: vertical; min-height: 80px; }
.code-input { letter-spacing: 6px; font-size: 1.4rem; font-weight: 700; text-align: center; }

.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  padding: 10px 18px;
  background: #f3f4f6;
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { background: #e5e7eb; }

.error-msg { color: #ef4444; font-size: 0.85rem; margin-top: 12px; text-align: center; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid #e5e7eb;
  padding: 0 16px;
  height: 52px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-center { flex: 1; text-align: center; }
.room-topic { font-weight: 700; font-size: 0.95rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-badge { font-size: 0.8rem; color: #22c55e; font-weight: 600; }

.room-code-badge {
  display: inline-block;
  background: #eef2ff;
  color: var(--primary);
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.room-code-badge:hover { background: #e0e7ff; }

.icon-btn {
  width: 36px; height: 36px;
  border: none; background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: #f3f4f6; }
.btn-close-room:hover { background: #fee2e2 !important; }

/* ── Board ── */
.board {
  position: fixed;
  top: 52px; left: 0; right: 0; bottom: 0;
  overflow: auto;
}
.board-empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  pointer-events: none;
}

/* ── Sticky Note ── */
.sticky {
  position: absolute;
  width: 160px;
  min-height: 120px;
  padding: 12px;
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  word-break: break-word;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sticky:hover { box-shadow: 5px 5px 18px rgba(0,0,0,0.22); z-index: 10; cursor: grab; }
.sticky.dragging { cursor: grabbing; z-index: 100; box-shadow: 8px 8px 24px rgba(0,0,0,0.28); opacity: 0.92; transition: none !important; }

.sticky-ai-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #7c3aed;
  background: #ede9fe;
  border-radius: 4px;
  padding: 1px 5px;
  align-self: flex-start;
}
.sticky-text { font-size: 0.88rem; line-height: 1.4; flex: 1; }
.sticky-category { font-size: 0.72rem; color: #6b7280; font-weight: 600; }
.sticky-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.sticky-vote {
  font-size: 0.78rem;
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 20px;
  padding: 2px 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.sticky-vote.voted { background: #fde68a; }
.sticky-vote:hover { background: rgba(0,0,0,0.12); }
.sticky-delete {
  font-size: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 0 2px;
}
.sticky-delete:hover { color: #ef4444; }

/* Mobile: flow list instead of absolute */
@media (max-width: 600px) {
  .board { overflow-y: auto; }
  .sticky {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: calc(50% - 12px);
    display: inline-flex;
    vertical-align: top;
    margin: 6px;
  }
  #board { padding: 6px; }
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 28px; right: 24px;
  width: 56px; height: 56px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: background 0.15s, transform 0.15s;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.07); }

/* ── Modals ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-box h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.color-picker { display: flex; gap: 10px; margin-top: 8px; }
.color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}
.color-dot.selected { border-color: var(--primary); }

/* AI Modal */
.ai-modal { max-width: 500px; }
.angle-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.angle-chip {
  display: flex; align-items: center; gap: 4px;
  background: #f3f4f6; border-radius: 20px;
  padding: 6px 14px; cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.angle-chip input { display: none; }
.angle-chip:has(input:checked) { background: #eef2ff; color: var(--primary); }

.ai-results { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-idea-card {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.ai-idea-info { flex: 1; }
.ai-idea-title { font-weight: 700; font-size: 0.92rem; }
.ai-idea-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }
.ai-idea-cat { font-size: 0.75rem; color: var(--primary); font-weight: 600; margin-top: 4px; }
.btn-add-idea {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-add-idea:hover { background: var(--primary-dark); }
.btn-add-idea.added { background: #22c55e; cursor: default; }

/* Export Modal */
.export-modal { max-width: 600px; }
.export-pre {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 14px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 90px; left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 500;
  pointer-events: none;
}
