/* CollaBoard - Component & Application Specific Styles */

/* ==========================================================================
   Lobby & Landing Page
   ========================================================================== */
.lobby-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.lobby-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: rgba(79, 70, 229, 0.15);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-full);
  color: #a5b4fc;
  font-size: 0.85rem;
  font-weight: 600;
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title span {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 680px;
}

/* Philosophy Banner */
.philosophy-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-md);
}

.banner-content h4 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: #38bdf8;
}

.banner-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.banner-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Alert Banner for Room Not Found / Notices */
.lobby-alert-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(185, 28, 28, 0.28));
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15);
}

.lobby-alert-banner .alert-icon {
  font-size: 2.25rem;
  flex-shrink: 0;
}

.lobby-alert-banner .alert-content {
  flex: 1;
}

.lobby-alert-banner .alert-content strong {
  color: #fca5a5;
  font-size: 1.1rem;
  display: block;
  margin-bottom: 0.25rem;
}

.lobby-alert-banner .alert-content p {
  color: #e2e8f0;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

/* Lobby Action Cards Grid */
.lobby-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.action-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s;
}

.action-card:hover {
  border-color: #475569;
}

.card-header-icon {
  font-size: 2.25rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
}

.action-card h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

.action-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* App Selection Grid in Create Room */
.app-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.app-select-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.app-select-chip:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.app-select-chip.active {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.15);
  box-shadow: 0 0 0 1px var(--primary);
}

.chip-icon {
  font-size: 1.25rem;
}

.chip-info {
  display: flex;
  flex-direction: column;
}

.chip-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.chip-badge {
  font-size: 0.65rem;
  color: var(--text-subtle);
}

/* Apps Catalog Showcase */
.apps-showcase-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-header {
  text-align: center;
}

.section-header h3 {
  font-size: 1.75rem;
  font-weight: 700;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.showcase-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.showcase-icon {
  font-size: 2rem;
}

.showcase-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.showcase-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.showcase-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.showcase-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #94a3b8;
}

/* ==========================================================================
   Room Shell & Top Bar
   ========================================================================== */
.room-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 61px);
  overflow: hidden;
}

.room-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}

.room-app-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
}

.room-app-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.room-app-tab:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.room-app-tab.active {
  background: rgba(79, 70, 229, 0.2);
  border-color: var(--primary-border);
  color: #a5b4fc;
}

.room-app-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: var(--bg-main);
}

.room-app-panel {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
}

.room-app-panel.active {
  display: block;
}

.room-app-panel[data-app-panel="whiteboard"].active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.room-app-bar-e2e {
  white-space: nowrap;
}

.room-focus-btn {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  font-weight: 600;
  transition: all 0.15s ease;
}

.room-focus-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: #fef08a;
}

/* ==========================================================================
   1. Whiteboard App
   ========================================================================== */
.app-whiteboard-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

.wb-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.wb-tool-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wb-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.wb-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.wb-btn:hover {
  background: #475569;
}

.wb-btn.active {
  background: var(--primary);
  border-color: var(--primary-hover);
}

.wb-color-picker {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.wb-palette {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.wb-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wb-range {
  width: 80px;
}

.wb-width-value {
  font-size: 0.75rem;
  min-width: 32px;
  font-family: monospace;
}

.wb-toolbar-spacer {
  flex: 1;
}

.wb-canvas-container {
  flex: 1;
  position: relative;
  background: #ffffff;
  overflow: hidden;
  cursor: crosshair;
}

#whiteboardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Page pinch-zoom stays available elsewhere; on the canvas, touches draw instead of scrolling/zooming */
  touch-action: none;
}

/* ==========================================================================
   2. Brainstorming App (Infinite Memo Board)
   ========================================================================== */
.app-infinite-board {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 120px);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  background-color: #0b0f19;
}

.board-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(148, 163, 184, 0.28) 1.2px, transparent 1.2px);
  z-index: 1;
}

.board-world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
  z-index: 2;
}

.board-connectors-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 5;
}

.connector-group {
  cursor: pointer;
  pointer-events: stroke;
}

.connector-hit-area {
  cursor: pointer;
  pointer-events: stroke;
}

.connector-path {
  transition: stroke 0.15s, stroke-width 0.15s;
}

.connector-group:hover .connector-path {
  stroke: #38bdf8 !important;
  stroke-width: 3.5px !important;
}

.connector-group.selected .connector-path {
  stroke: #3b82f6 !important;
  stroke-width: 3.5px !important;
}

.board-objects-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
}

/* Memo Object Styling & Physical Physics */
.board-memo-object {
  position: absolute;
  user-select: none;
  cursor: grab;
  transform-origin: center center;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

.board-memo-object:hover {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

.app-infinite-board.is-dragging .board-memo-object.selected {
  cursor: grabbing;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.45));
}

.memo-svg-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.memo-content-box {
  position: absolute;
  inset: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  line-height: 1.45;
  pointer-events: auto;
  word-break: break-word;
}

.memo-text-display {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  white-space: pre-wrap;
}

.memo-author-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
  margin-top: 4px;
}

/* Template-specific content offsets */
.board-memo-object[data-template-id="todo-memo"] .memo-content-box {
  top: 40px;
  left: 14px;
  right: 14px;
  bottom: 12px;
}

.board-memo-object[data-template-id="priority-memo"] .memo-content-box {
  top: 24px;
  left: 14px;
  right: 14px;
  bottom: 12px;
}

/* Checklist / Markdown Todo Items */
.memo-todo-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
  margin-bottom: 5px;
}

.memo-todo-row.completed .memo-todo-text {
  text-decoration: line-through;
  opacity: 0.5;
}

.memo-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 2px;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: transparent;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.memo-checkbox:hover {
  border-color: #10b981;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.memo-checkbox.checked {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  font-weight: 700;
}

.memo-todo-text {
  flex: 1;
  word-break: break-word;
}

/* Inline Text Editor */
.board-memo-object.editing {
  z-index: 100 !important;
}

.board-memo-object.editing .memo-content-box {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 2px #3b82f6, 0 12px 32px rgba(0, 0, 0, 0.4) !important;
  border-radius: 6px !important;
  z-index: 105 !important;
  padding: 8px !important;
}

.memo-inline-editor {
  width: 100%;
  flex: 1;
  min-height: 80px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: inherit;
  color: #0f172a !important;
  line-height: 1.45;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  user-select: text;
}

.memo-inline-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #e2e8f0;
}

.memo-editor-tip {
  font-size: 0.68rem;
  color: #64748b;
  user-select: none;
}

.memo-editor-done-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.memo-editor-done-btn:hover {
  background: #1d4ed8;
}

/* Selection Outline & Handles */
.memo-selection-outline {
  position: absolute;
  inset: -4px;
  border: 2px solid #3b82f6;
  border-radius: 4px;
  pointer-events: none;
  z-index: 20;
}

.memo-resize-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 2px;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.memo-resize-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.memo-resize-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.memo-resize-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.memo-resize-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }

.memo-rotate-stem {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: #3b82f6;
  pointer-events: none;
}

.memo-rotate-handle {
  position: absolute;
  top: -28px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.board-selection-marquee {
  position: absolute;
  border: 1px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  pointer-events: none;
  z-index: 30;
}

/* Cursors Layer */
.board-cursors-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.remote-cursor {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  transition: transform 0.05s linear;
}

.cursor-label {
  background: #1e293b;
  border: 1px solid #3b82f6;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Main Top Toolbar */
.board-main-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 5px 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 100;
  user-select: none;
}

.toolbar-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tb-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.tb-btn.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.tb-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tb-icon {
  font-size: 1rem;
}

.tb-badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.18);
  padding: 1px 6px;
  border-radius: 10px;
}

.tb-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 3px;
}

.tb-zoom-label {
  font-size: 0.78rem;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tb-search-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.tb-search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.tb-search-input {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.78rem;
  width: 110px;
  outline: none;
  transition: width 0.2s ease, border-color 0.2s ease;
}

.tb-search-field.has-count .tb-search-input {
  padding-right: 36px;
}

.tb-search-input:focus {
  width: 160px;
  border-color: #3b82f6;
}

.tb-search-count {
  position: absolute;
  right: 8px;
  font-size: 0.7rem;
  color: #94a3b8;
  pointer-events: none;
}

.tb-search-nav {
  display: none;
  align-items: center;
  gap: 1px;
}

.tb-search-nav.is-visible {
  display: flex;
}

.tb-search-nav-btn {
  padding: 3px 6px;
  min-width: 24px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1;
}

/* Floating Context Toolbar */
.board-context-toolbar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 4px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 95;
  transform: translateX(-50%);
  user-select: none;
}

.ctx-select option {
  background: #1e293b;
  color: #f8fafc;
}

.ctx-select {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 14px;
  padding: 3px 8px;
  outline: none;
  cursor: pointer;
}

.ctx-palette {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctx-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.ctx-color-dot:hover {
  transform: scale(1.25);
}

.ctx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.ctx-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ctx-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* 21 Styles Picker Modal */
.board-style-picker-modal {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 680px;
  max-width: 92vw;
  max-height: 80vh;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  z-index: 150;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: stylePickerFade 0.18s ease-out;
}

@keyframes stylePickerFade {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.style-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #1e293b;
}

.style-picker-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.style-picker-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.style-picker-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.style-picker-categories {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  background: #1e293b;
  overflow-x: auto;
}

.style-cat-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.style-cat-btn:hover {
  color: #f8fafc;
}

.style-cat-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

.style-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: 480px;
}

.style-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.style-picker-item:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  background: #273549;
}

.style-picker-item.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}

.style-picker-preview {
  position: relative;
  width: 90px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
}

.style-picker-preview .memo-svg-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.style-picker-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Centered Memo Content Edit Modal Dialog */
.board-memo-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: memoEditOverlayFade 0.15s ease-out;
}

@keyframes memoEditOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.board-memo-edit-dialog {
  width: 580px;
  max-width: 94vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: memoEditDialogScale 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes memoEditDialogScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.memo-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #1e293b;
  background: #111c33;
}

.memo-edit-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.memo-edit-badge {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #1e293b;
  border-radius: 10px;
  border: 1px solid #334155;
}

.memo-edit-title-wrap {
  display: flex;
  flex-direction: column;
}

.memo-edit-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.memo-edit-subtitle {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 1px;
}

.memo-edit-close-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.12s;
}

.memo-edit-close-btn:hover {
  background: #1e293b;
  color: #ffffff;
}

.memo-edit-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.memo-edit-textarea {
  width: 100%;
  height: 240px;
  min-height: 180px;
  max-height: 55vh;
  resize: vertical;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.6;
  border: 1.5px solid #334155;
  border-radius: 10px;
  color: #f8fafc;
  background: #1e293b;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.memo-edit-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: #172338;
}

.memo-edit-textarea::placeholder {
  color: #64748b;
}

.memo-edit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid #1e293b;
  background: #111c33;
  gap: 12px;
}

.memo-edit-hints {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.memo-edit-hint {
  font-size: 0.78rem;
  color: #94a3b8;
}

.memo-edit-hint code,
.memo-edit-hint kbd {
  background: #1e293b;
  color: #93c5fd;
  border: 1px solid #334155;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
}

.memo-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memo-edit-btn {
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.memo-edit-cancel {
  background: #1e293b;
  border: 1px solid #475569;
  color: #cbd5e1;
}

.memo-edit-cancel:hover {
  background: #334155;
  color: #ffffff;
}

.memo-edit-save {
  background: #2563eb;
  border: 1px solid #3b82f6;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.memo-edit-save:hover {
  background: #1d4ed8;
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}

/* Minimap Panel */
.board-minimap-panel {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 90;
  user-select: none;
}

.minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.minimap-toggle {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 4px;
}

.minimap-canvas-wrap {
  width: 180px;
  height: 120px;
  display: block;
}

.minimap-canvas-wrap.collapsed {
  display: none;
}

#minimapCanvas {
  display: block;
  cursor: crosshair;
}

/* Cursor tool modifiers */
.app-infinite-board.cursor-crosshair {
  cursor: crosshair !important;
}

.app-infinite-board.cursor-grab {
  cursor: grab !important;
}

.app-infinite-board.is-panning {
  cursor: grabbing !important;
}


/* ==========================================================================
   3. Q&A Board App
   ========================================================================== */
.app-qna-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.qna-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qna-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.qna-topic-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.qna-host-topic-edit {
  display: flex;
  gap: 0.5rem;
}

.qna-topic-input {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
}

.qna-stats-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.qna-stat-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.qna-layout-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .qna-layout-grid {
    grid-template-columns: 1fr;
  }
}

.qna-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: fit-content;
}

.qna-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.qna-textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
}

.qna-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qna-anon-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.qna-stream-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qna-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qna-stream-legend {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.qna-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.qna-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  gap: 1.25rem;
  transition: all 0.15s;
}

.qna-pinned {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), var(--bg-surface));
}

.qna-answered {
  opacity: 0.65;
  background: rgba(15, 23, 42, 0.5);
}

.qna-vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qna-upvote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 48px;
  height: 52px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.qna-upvote-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.qna-upvote-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.qna-upvote-arrow {
  font-size: 0.8rem;
}

.qna-upvote-count {
  font-size: 0.95rem;
  font-weight: 700;
}

.qna-body-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qna-pin-pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.qna-done-pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.qna-text {
  font-size: 1.05rem;
  line-height: 1.4;
  word-break: break-word;
}

.qna-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.qna-host-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
}

.qna-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

/* ==========================================================================
   4. Study & Quiz App
   ========================================================================== */
.app-quiz-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.quiz-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.quiz-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a855f7;
  letter-spacing: 0.05em;
}

.quiz-role-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 0.5rem;
}

.quiz-role-tag.host-tag {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.quiz-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.quiz-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quiz-count-pill {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.quiz-layout-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .quiz-layout-grid {
    grid-template-columns: 1fr;
  }
}

.quiz-creator-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: fit-content;
}

.quiz-creator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiz-draft-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.quiz-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.quiz-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.quiz-input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
}

.quiz-options-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-options-group > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quiz-option-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-radio-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  cursor: pointer;
}

.quiz-opt-text {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
}

.quiz-feedback {
  font-size: 0.85rem;
  color: #34d399;
  text-align: center;
  min-height: 1.2rem;
}

/* Question Bank / Pool */
.quiz-pool-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-pool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.quiz-panel-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.quiz-pool-count {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
}

.quiz-waiting-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), var(--bg-surface));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.quiz-waiting-icon {
  font-size: 2rem;
}

.quiz-waiting-text {
  flex: 1;
}

.quiz-waiting-text h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #c084fc;
  margin-bottom: 0.25rem;
}

.quiz-waiting-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quiz-waiting-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.quiz-pool-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease;
}

.quiz-card-item.item-published {
  border-color: rgba(148, 163, 184, 0.2);
  opacity: 0.85;
  background: rgba(15, 23, 42, 0.5);
}

.quiz-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiz-card-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quiz-num-badge {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.quiz-status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.quiz-status-tag.tag-ready {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.quiz-status-tag.tag-published {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.quiz-author-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quiz-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quiz-card-question {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

.quiz-card-options-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 600px) {
  .quiz-card-options-preview {
    grid-template-columns: 1fr;
  }
}

.quiz-opt-chip {
  font-size: 0.8rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.opt-is-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-weight: 600;
}

.quiz-card-explain {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid #a855f7;
}

.quiz-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.quiz-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Quiz Live Solving View
   ========================================================================== */
.quiz-play-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.quiz-play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.quiz-round-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #f59e0b;
  font-weight: 700;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.quiz-play-author {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quiz-respondent-bar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-main);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.quiz-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quiz-roster-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quiz-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.quiz-user-pill.submitted {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
  font-weight: 600;
}

.quiz-user-avatar {
  font-size: 0.8rem;
}

.quiz-user-check {
  font-weight: 700;
}

.quiz-question-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.quiz-play-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-choice-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}

.quiz-choice-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary);
  transform: translateX(4px);
}

.quiz-choice-btn.selected {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.quiz-choice-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.quiz-choice-btn.selected .quiz-choice-num {
  background: #a855f7;
  color: #fff;
  border-color: #a855f7;
}

.quiz-choice-text {
  flex: 1;
  font-weight: 500;
}

.quiz-choice-check {
  font-size: 0.8rem;
  font-weight: 700;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.quiz-selection-status {
  margin-top: 1rem;
  font-size: 0.85rem;
  text-align: center;
}

.quiz-play-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.quiz-host-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-participant-waiting {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Quiz Revealed Answer View
   ========================================================================== */
.quiz-revealed-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.quiz-result-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  flex-wrap: wrap;
}

.quiz-result-banner.banner-correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border-color: #10b981;
}

.quiz-result-banner.banner-host-revealed {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05));
  border-color: #3b82f6;
}

.quiz-result-banner.banner-wrong {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05));
  border-color: #ef4444;
}

.quiz-result-banner.banner-skipped {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  border-color: #f59e0b;
}

.quiz-banner-icon {
  font-size: 2.2rem;
}

.quiz-banner-text {
  flex: 1;
}

.quiz-banner-text h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.quiz-banner-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quiz-round-accuracy-pill {
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  color: var(--text-main);
}

.quiz-revealed-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.quiz-revealed-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-result-option-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  transition: all 0.15s ease;
}

.quiz-result-option-row.opt-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.quiz-result-option-row.opt-wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.quiz-opt-main-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quiz-opt-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.quiz-choice-num.num-correct {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.quiz-opt-text-revealed {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.quiz-opt-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-answer-correct {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: #10b981;
  color: #fff;
}

.badge-my-choice {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.badge-my-choice.my-right {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
}

.badge-my-choice.my-wrong {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef4444;
}

.badge-voter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quiz-opt-voters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.quiz-voter-chip {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.quiz-voter-chip.is-me {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  font-weight: 600;
}

.quiz-explanation-box {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-explain-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #c084fc;
}

.quiz-explain-content {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
}

.quiz-revealed-standings {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-standings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-standings-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.quiz-mini-leaderboard {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiz-mini-rank-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}

.quiz-mini-rank-pill.my-rank {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.15);
}

.mini-rank-score {
  font-weight: 700;
  color: #fbbf24;
}

.quiz-revealed-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.quiz-host-next-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-participant-revealed-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Quiz Final Summary & Podium
   ========================================================================== */
.quiz-summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.quiz-summary-header {
  text-align: center;
}

.quiz-podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0;
  min-height: 220px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 140px;
}

.podium-crown {
  font-size: 1.8rem;
}

.podium-avatar {
  font-size: 2.2rem;
}

.podium-name {
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.podium-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
}

.podium-pillar {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
}

.pillar-1 {
  height: 120px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.pillar-2 {
  height: 90px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
}

.pillar-3 {
  height: 65px;
  background: linear-gradient(180deg, #b45309, #78350f);
}

.quiz-ranking-table-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-ranking-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-rank-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 1rem;
}

.quiz-rank-row.my-rank {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
}

.quiz-rank-col.rank-num {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-muted);
  width: 35px;
}

.quiz-rank-col.rank-user {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.quiz-rank-col.rank-stats {
  text-align: right;
  font-weight: 700;
  color: #fbbf24;
}

.quiz-summary-actions {
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   5. Instant Poll App
   ========================================================================== */
.app-poll-wrapper {
  padding: 2rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.poll-main-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  box-shadow: var(--shadow-md);
}

.poll-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #06b6d4;
  letter-spacing: 0.05em;
}

.poll-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.poll-question-title {
  font-size: 1.6rem;
  font-weight: 700;
}

.poll-status-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

.status-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.status-closed {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.poll-meta-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poll-option-item {
  position: relative;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.poll-option-item:hover:not(.disabled) {
  border-color: #64748b;
}

.poll-option-item.selected {
  border-color: var(--accent);
}

.poll-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.2), rgba(79, 70, 229, 0.25));
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.poll-option-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  z-index: 2;
}

.poll-option-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.poll-option-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.poll-option-radio.checked {
  border-color: var(--accent);
}

.poll-option-radio.checked::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.poll-option-text {
  font-size: 1rem;
  font-weight: 500;
}

.poll-my-vote-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: var(--accent);
  color: #0f172a;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.poll-pct {
  font-size: 1.1rem;
  color: #67e8f9;
}

.poll-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.poll-footer-controls {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

.poll-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.poll-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 1rem;
}

.poll-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.poll-opt-input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

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

/* Poll Navigation & Tabs */
.poll-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.poll-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.poll-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.poll-tab-btn:hover {
  color: var(--text-main);
}

.poll-tab-btn.active {
  background: var(--accent);
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.poll-badge-live {
  font-size: 0.65rem;
  background: #10b981;
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.poll-history-count {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

.poll-tab-btn.active .poll-history-count {
  background: rgba(15, 23, 42, 0.25);
  color: #0f172a;
}

/* History Banner in Active View */
.poll-history-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(79, 70, 229, 0.15));
  border: 1px solid rgba(6, 182, 212, 0.4);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.poll-history-view-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #67e8f9;
}

/* History Tab View */
.poll-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.poll-history-title-group h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.poll-history-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.poll-history-header-actions {
  display: flex;
  gap: 0.5rem;
}

.poll-history-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.poll-history-empty {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.poll-history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.poll-history-card:hover {
  border-color: #475569;
}

.poll-history-card.is-active-poll {
  border-color: #06b6d4;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.poll-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.poll-history-badges {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.badge-current-active {
  font-size: 0.7rem;
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.5);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.poll-history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.poll-history-question {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.poll-history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.poll-history-winner {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fbbf24;
}

.poll-history-stats {
  display: flex;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.poll-history-options-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.poll-history-opt-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.poll-history-opt-name {
  width: 35%;
  min-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poll-history-opt-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.poll-history-opt-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #6366f1);
  border-radius: var(--radius-full);
}

.poll-history-opt-count {
  width: 80px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.poll-history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   6. P2P File & Photo Share App
   ========================================================================== */
.app-fileshare-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
}

.fs-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.fs-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #10b981;
  letter-spacing: 0.05em;
}

.fs-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.fs-security-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.fs-main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .fs-main-grid {
    grid-template-columns: 1fr;
  }
}

.fs-dropzone {
  background: var(--bg-surface);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  height: fit-content;
}

.fs-dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.fs-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.fs-drop-icon {
  font-size: 3rem;
}

.fs-dropzone h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.fs-dropzone p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fs-file-input {
  display: none;
}

.fs-list-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fs-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fs-count-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fs-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fs-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: border-color 0.15s;
}

.fs-item-card.fs-mine {
  border-left: 3px solid var(--primary);
}

.fs-item-preview {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.fs-img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fs-icon-thumb {
  font-size: 1.5rem;
}

.fs-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.fs-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fs-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.4rem;
}

.fs-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.fs-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-main);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.fs-progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.1s;
}

.fs-progress-text {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
}

.fs-badge-transferring {
  font-size: 0.75rem;
  color: #38bdf8;
  padding: 0.2rem 0.5rem;
  background: rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-sm);
}

.fs-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

/* ==========================================================================
   Quiz Live Host Results Panel (Below Question)
   ========================================================================== */
.quiz-live-results-section {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.quiz-live-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.quiz-live-results-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quiz-live-badge {
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.quiz-live-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-live-opt-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s, background 0.2s;
}

.quiz-live-opt-card.opt-designated-correct {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.06);
}

.quiz-live-opt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quiz-live-opt-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.quiz-live-opt-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.quiz-live-opt-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-voter-count-live {
  font-size: 0.8rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  color: var(--text-main);
}

.quiz-live-voters-container {
  padding-left: 2.75rem;
}

.quiz-no-voters {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.quiz-voter-chip.is-voted {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
  font-weight: 600;
}


/* ==========================================================================
   Entry security: waiting room, join requests, approval toggle, transport badges
   ========================================================================== */

.form-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  cursor: pointer;
}

.form-toggle input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
}

.form-toggle-text small {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.popover-approval-toggle {
  margin-top: 0.75rem;
}

.popover-approval-status {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lobby-alert-banner[role="status"] {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.16), rgba(6, 182, 212, 0.12));
  border-color: var(--primary-border);
  box-shadow: none;
  justify-content: flex-start;
}

/* Waiting room & tab conflict screens */
.waiting-room {
  max-width: 460px;
  margin: 12vh auto 0;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.waiting-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.waiting-title {
  font-size: 1.45rem;
  font-weight: 800;
  text-wrap: balance;
}

.waiting-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 38ch;
}

.waiting-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-main);
  border: 1px dashed var(--primary-border);
}

.waiting-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.waiting-code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  font-variant-numeric: tabular-nums;
}

.waiting-code-hint {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.waiting-timer {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.waiting-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

/* Join requests bar (inside room shell) */
.join-requests-bar {
  margin: 0.5rem 1rem 0;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.join-requests-bar[hidden] {
  display: none;
}

.join-requests-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.join-requests-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.join-requests-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex: 1;
}

.join-requests-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.join-request-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.join-request-name {
  font-weight: 600;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-request-code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--accent);
}

.join-request-actions {
  display: flex;
  gap: 0.3rem;
}

/* Peer transport badges */
.p-transport {
  font-size: 0.62rem;
  padding: 0.08rem 0.35rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.p-transport-direct {
  background: rgba(16, 185, 129, 0.16);
  color: var(--success);
}

.p-transport-relay {
  background: rgba(6, 182, 212, 0.16);
  color: var(--accent);
}

.p-transport-connecting {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-muted);
}

.fs-item-error {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--danger);
}

/* Direct (P2P) connection problems */
.p2p-issue-bar {
  margin: 0.5rem 1rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  font-size: 0.88rem;
}

.p2p-issue-bar[hidden] {
  display: none;
}

.p2p-issue-text {
  flex: 1 1 22rem;
  line-height: 1.5;
}

.p2p-issue-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.p2p-issue-actions {
  display: flex;
  gap: 0.4rem;
}

button.p-transport-unreachable {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.62rem;
  background: rgba(239, 68, 68, 0.18);
  color: var(--danger);
}

button.p-transport-unreachable:hover,
button.p-transport-unreachable:focus-visible {
  background: rgba(239, 68, 68, 0.3);
  outline: none;
}

.p2p-help-dialog {
  max-width: 600px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
}

.p2p-help-body {
  overflow-y: auto;
  display: grid;
  gap: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.p2p-help-section h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.p2p-help-section p,
.p2p-help-section li {
  color: var(--text-muted);
  max-width: 62ch;
}

.p2p-help-section strong {
  color: var(--text-main);
}

.p2p-help-now {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
}

.p2p-help-who {
  margin-top: 0.35rem;
}

.p2p-help-list,
.p2p-help-steps {
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
}

.p2p-help-it code {
  font-size: 0.8rem;
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--accent);
}

.p2p-help-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ==========================================================================
   Shared: icon button and rendered Markdown
   ========================================================================== */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

.md-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }

.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  margin: 1.2em 0 0.5em;
  line-height: 1.35;
  font-weight: 700;
}

.md-body h1 { font-size: 1.5rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-color); }
.md-body h2 { font-size: 1.3rem; padding-bottom: 0.25em; border-bottom: 1px solid var(--border-color); }
.md-body h3 { font-size: 1.12rem; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 1rem; color: var(--text-muted); }

.md-body p,
.md-body ul,
.md-body ol,
.md-body blockquote,
.md-body pre,
.md-body .md-table-wrap {
  margin: 0 0 0.85em;
}

.md-body ul,
.md-body ol {
  padding-left: 1.5rem;
}

.md-body li + li { margin-top: 0.2em; }
.md-body li > ul,
.md-body li > ol { margin: 0.2em 0 0; }
.md-body li.md-task { list-style: none; margin-left: -1.2rem; }
.md-body li.md-task input { margin-right: 0.35rem; vertical-align: middle; }

.md-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.md-body blockquote {
  padding: 0.4rem 0.9rem;
  border-left: 3px solid var(--primary);
  background: rgba(79, 70, 229, 0.08);
  color: var(--text-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.md-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: #fda4af;
}

.md-body pre {
  padding: 0.8rem 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.md-body pre code {
  padding: 0;
  background: none;
  color: var(--text-main);
  font-size: 0.85rem;
  white-space: pre;
}

.md-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.2em 0;
}

.md-body .md-table-wrap { overflow-x: auto; }

.md-body table {
  border-collapse: collapse;
  min-width: 50%;
  font-size: 0.9rem;
}

.md-body th,
.md-body td {
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.7rem;
}

.md-body th { background: var(--bg-surface-elevated); font-weight: 600; }

/* ==========================================================================
   7. Notice Board App
   ========================================================================== */
/* Component display rules must not override the hidden attribute used by the notice/feedback boards */
.app-notice-wrapper [hidden],
.app-feedback-wrapper [hidden] {
  display: none !important;
}

.room-app-panel[data-app-panel="notice"].active {
  display: flex;
  flex-direction: column;
}

.app-notice-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.notice-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.notice-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.05em;
}

.notice-heading {
  font-size: 1.35rem;
  font-weight: 700;
}

.notice-count-pill,
.fb-count-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
}

.notice-unread-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.notice-compose {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
}

.notice-compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.notice-compose-head h3 {
  font-size: 1rem;
}

.notice-compose-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-main);
}

.notice-compose-tab {
  padding: 0.25rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.notice-compose-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.notice-input,
.notice-textarea,
.fb-input,
.fb-textarea,
.fb-bank-textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
}

.notice-input:focus,
.notice-textarea:focus,
.fb-input:focus,
.fb-textarea:focus,
.fb-bank-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.notice-input {
  font-weight: 600;
}

.notice-textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Pretendard", monospace;
  font-size: 0.88rem;
}

.notice-preview {
  min-height: 180px;
  max-height: 45vh;
  overflow-y: auto;
  padding: 0.75rem 0.9rem;
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.notice-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notice-compose-hint {
  margin-right: auto;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.notice-list {
  flex: 0 1 auto;
  max-height: 38%;
  min-height: 3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.notice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  flex-shrink: 0;
  padding: 0.65rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.notice-row:last-child {
  border-bottom: none;
}

.notice-row:hover {
  background: var(--bg-surface-elevated);
}

.notice-row.active {
  background: rgba(79, 70, 229, 0.18);
  box-shadow: inset 3px 0 0 var(--primary);
}

.notice-row-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.notice-row.unread .notice-row-title {
  font-weight: 700;
}

.notice-unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: #f59e0b;
  vertical-align: middle;
}

.notice-row-author {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.notice-row-date {
  font-size: 0.8rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.notice-empty,
.notice-detail-placeholder,
.fb-empty,
.fb-bank-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.notice-detail {
  flex: 1 1 0;
  min-height: 12rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.notice-detail.is-empty {
  justify-content: center;
}

.notice-detail-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0.85rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.notice-back-btn {
  display: none;
}

.notice-detail-titles {
  flex: 1;
  min-width: 0;
}

.notice-detail-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

.notice-detail-meta {
  display: flex;
  gap: 0.9rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.notice-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notice-delete-btn {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.notice-detail-body {
  padding: 1rem 1.25rem 1.5rem;
}

.notice-muted {
  color: var(--text-subtle);
}

/* ==========================================================================
   8. Facilitated Feedback App
   ========================================================================== */
.app-feedback-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.app-feedback-wrapper.is-host {
  max-width: 1280px;
}

.fb-header-card,
.fb-bank-card,
.fb-current-card,
.fb-answer-card,
.fb-responses-panel,
.fb-history-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
}

.fb-header-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.fb-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fb-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fb-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.05em;
}

.fb-heading {
  font-size: 1.3rem;
  font-weight: 700;
}

.fb-header-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fb-header-stats .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.fb-stat {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fb-stat strong {
  color: var(--text-main);
}

.fb-adhoc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.fb-adhoc-row .fb-input {
  flex: 1 1 260px;
}

.fb-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.fb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.is-host .fb-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

@media (max-width: 960px) {
  .is-host .fb-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.fb-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* Question bank (host) */
.fb-bank-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 170px);
}

.fb-bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fb-bank-head h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fb-bank-note,
.fb-bank-help,
.fb-muted {
  font-size: 0.78rem;
  color: var(--text-subtle);
  line-height: 1.5;
}

.fb-bank-help code {
  padding: 0 0.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--accent);
}

.fb-bank-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 0.5rem;
}

.fb-bank-sections {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 -0.35rem;
  padding: 0 0.35rem;
}

.fb-bank-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 0.2rem;
}

.fb-bank-section-desc {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 0.4rem;
  line-height: 1.45;
}

.fb-bank-q {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.fb-bank-q + .fb-bank-q {
  margin-top: 0.15rem;
}

.fb-bank-q:hover {
  background: var(--bg-main);
}

.fb-bank-q.is-launched .fb-bank-q-text {
  color: var(--text-subtle);
}

.fb-bank-q.is-active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
}

.fb-bank-q-text {
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.45;
}

.fb-launch-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.fb-bank-textarea {
  flex: 1;
  min-height: 320px;
  resize: vertical;
  font-size: 0.82rem;
  line-height: 1.55;
}

.fb-bank-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fb-spacer {
  flex: 1;
}

/* Current question */
.fb-current-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), var(--bg-surface) 60%);
}

.fb-current-card.is-open {
  border-color: rgba(16, 185, 129, 0.45);
}

.fb-current-card.is-closed {
  background: var(--bg-surface);
}

.fb-current-card.is-waiting {
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.25rem;
  background: var(--bg-surface);
  border-style: dashed;
}

.fb-waiting-icon {
  font-size: 2.2rem;
}

.fb-past-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-size: 0.82rem;
}

.fb-current-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.fb-section-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  color: #34d399;
  margin-right: 0.25rem;
}

.fb-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.pill-open { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.pill-closed { background: rgba(148, 163, 184, 0.18); color: var(--text-muted); }
.pill-revealed { background: rgba(6, 182, 212, 0.18); color: #67e8f9; }
.pill-hidden { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }

.fb-question-text {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.fb-current-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fb-host-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.fb-copy-btn {
  margin-left: auto;
}

/* Answer form */
.fb-answer-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fb-textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

.fb-answer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fb-answer-hint {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.fb-answer-closed {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

/* Responses */
.fb-responses-panel,
.fb-history-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.fb-responses-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fb-responses-head h3,
.fb-history-panel h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fb-response-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.7rem;
}

.fb-response-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.fb-response-card.is-mine {
  border-color: var(--primary-border);
  box-shadow: inset 3px 0 0 var(--primary);
}

.fb-response-text {
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-response-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fb-response-author {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-response-time {
  color: var(--text-subtle);
}

.fb-response-del {
  padding: 0 0.25rem;
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
}

.fb-response-del:hover {
  color: #f87171;
}

/* Session flow */
.fb-history-list {
  display: flex;
  flex-direction: column;
}

.fb-history-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fb-history-row:last-child {
  border-bottom: none;
}

.fb-history-row:hover {
  background: var(--bg-main);
}

.fb-history-row.active .fb-history-text {
  color: #34d399;
  font-weight: 600;
}

.fb-history-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.fb-history-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Feedback: presentation (projector) mode */
.fb-present {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.12), transparent 45%), #0b1120;
  color: #f8fafc;
}

.fb-present [hidden] {
  display: none !important;
}

.fbp-content {
  overflow-y: auto;
  padding: clamp(1.5rem, 5vh, 4rem) clamp(1.5rem, 6vw, 6rem) 2rem;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 2.25rem);
}

.fbp-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding-right: 11rem; /* room for the join QR */
}

.fbp-section {
  font-size: clamp(0.95rem, 1.6vw, 1.35rem);
  font-weight: 700;
  color: #34d399;
}

.fbp-pill {
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  font-weight: 700;
  padding: 0.2rem 0.8rem;
  border-radius: var(--radius-full);
}

.fbp-pill.is-open { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.fbp-pill.is-closed { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.fbp-question {
  font-size: clamp(1.8rem, 4.2vw, 4rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  padding-right: 11rem;
}

.fbp-sub {
  font-size: clamp(1rem, 1.8vw, 1.6rem);
  color: #cbd5e1;
}

.fbp-hint {
  font-size: clamp(0.85rem, 1.2vw, 1.1rem);
  color: #64748b;
}

.fbp-waiting,
.fbp-collecting {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.fbp-waiting .fbp-question {
  padding-right: 0;
}

.fbp-waiting-icon {
  font-size: clamp(3rem, 8vw, 6rem);
}

.fbp-count {
  font-size: clamp(4rem, 14vw, 11rem);
  font-weight: 800;
  line-height: 1;
  color: #34d399;
  font-variant-numeric: tabular-nums;
}

.fbp-answers {
  display: grid;
  gap: clamp(0.6rem, 1.4vw, 1.25rem);
  align-content: start;
}

.fbp-answers.is-few { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.fbp-answers.is-some { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.fbp-answers.is-many { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

.fbp-answer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  padding: clamp(0.8rem, 1.5vw, 1.4rem);
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 4px solid #34d399;
  border-radius: var(--radius-lg);
}

.fbp-answer-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.is-few .fbp-answer-text { font-size: clamp(1.2rem, 2.2vw, 2rem); }
.is-some .fbp-answer-text { font-size: clamp(1.05rem, 1.6vw, 1.5rem); }
.is-many .fbp-answer-text { font-size: clamp(0.95rem, 1.2vw, 1.15rem); }

.fbp-answer-author {
  font-size: clamp(0.75rem, 1vw, 0.95rem);
  color: #94a3b8;
}

.fbp-join {
  position: absolute;
  top: clamp(1rem, 3vh, 2rem);
  right: clamp(1rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.fbp-join-qr {
  display: block;
  width: 132px;
  height: 132px;
}

.fbp-join-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.fbp-join-hint {
  font-size: 0.72rem;
  color: #475569;
}

.fbp-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.fbp-controls-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Hide the controls on a projector until the mouse is used; they stay reachable by keyboard. */
.fb-present:fullscreen .fbp-controls {
  opacity: 0;
  transition: opacity 0.2s;
}

.fb-present:fullscreen .fbp-controls:hover,
.fb-present:fullscreen .fbp-controls:focus-within {
  opacity: 1;
}

@media (max-width: 640px) {
  .fbp-top,
  .fbp-question {
    padding-right: 0;
  }

  .fbp-join {
    display: none;
  }
}

/* Lobby: "?" button that opens the user guide */
.help-open-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-main);
  font: 800 1rem/1 var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.help-open-btn:hover,
.help-open-btn:focus-visible {
  background: var(--bg-surface-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

/* First visit: a few soft rings, then it stays still */
.help-open-btn.is-new::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
  animation: help-ring 1.6s ease-out 3;
  pointer-events: none;
}

@keyframes help-ring {
  to { box-shadow: 0 0 0 12px rgba(6, 182, 212, 0); }
}

/* User guide: full screen */
body.help-open {
  overflow: hidden;
}

.help-screen {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  color: var(--text-main);
  animation: help-in 0.2s ease-out;
}

@keyframes help-in {
  from { opacity: 0; transform: translateY(12px); }
}

.help-header {
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.help-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.7rem 1.5rem 0.3rem;
}

.help-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.help-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 1.05rem;
  cursor: pointer;
}

.help-close:hover,
.help-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.help-nav {
  position: relative;
  display: flex;
  gap: 0.35rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.25rem 1.5rem 0.55rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.help-nav::-webkit-scrollbar {
  display: none;
}

.help-nav-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font: 600 0.88rem var(--font-sans);
  cursor: pointer;
}

.help-nav-btn:hover {
  color: var(--text-main);
}

.help-nav-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.help-scroll {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 1rem;
  isolation: isolate;
}

.help-scroll > * {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Hero */
.help-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 1.5rem;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

/* Glow spans the full screen width and fades out downward, so no box edge shows */
.help-hero::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: -1;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
  background:
    radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.25), transparent 45%),
    radial-gradient(circle at 85% 60%, rgba(6, 182, 212, 0.14), transparent 45%);
  pointer-events: none;
}

.help-hero-pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  font-size: 0.82rem;
  font-weight: 700;
}

.help-hero h1 {
  margin: 1rem 0 0.9rem;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  word-break: keep-all;
}

.help-hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #818cf8, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.help-hero-copy > p {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
  word-break: keep-all;
}

.help-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.4rem 0;
}

.help-hero-stats > div {
  display: flex;
  flex-direction: column;
  min-width: 96px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.help-hero-stats b {
  font-size: 1.25rem;
  font-weight: 800;
  color: #22d3ee;
}

.help-hero-stats span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.help-hero-art {
  display: block;
  width: 100%;
  height: auto;
}

/* Sections */
.help-section {
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

.help-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 800;
  word-break: keep-all;
}

.help-section-title > span {
  color: var(--accent);
}

.help-section-title + :not(.help-section-sub) {
  margin-top: 1rem;
}

.help-section-sub {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Quick start */
.help-track {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
}

.help-track-btn {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font: 700 0.92rem var(--font-sans);
  cursor: pointer;
}

.help-track-btn.active {
  background: var(--primary);
  color: #fff;
}

.help-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.75rem;
  margin: 1.25rem 0 2.5rem;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.help-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--bg-surface), rgba(30, 41, 59, 0.4));
  animation: help-step-in 0.35s ease-out both;
}

.help-step:nth-child(2) { animation-delay: 0.06s; }
.help-step:nth-child(3) { animation-delay: 0.12s; }

@keyframes help-step-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Arrow between steps */
.help-step:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -1.35rem;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
}

.help-step-num {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.help-step-icon {
  font-size: 2.2rem;
  line-height: 1.2;
}

.help-step strong {
  font-size: 1.05rem;
}

.help-step p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: keep-all;
}

/* P2P explainer */
.help-p2p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.help-p2p-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

.p2p-server {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 1rem;
  border: 1px dashed var(--text-subtle);
  border-radius: var(--radius-md);
  opacity: 0.8;
}

.p2p-server::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  height: 1.6rem;
  border-left: 2px dotted var(--text-subtle);
}

.p2p-server span {
  font-size: 1.6rem;
}

.p2p-server small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.p2p-devices {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.p2p-device {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: rgba(79, 70, 229, 0.18);
  font-size: 1.8rem;
}

.p2p-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  font-size: 0.9rem;
}

.p2p-link i {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  z-index: -1;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #22d3ee 0 8px, transparent 8px 14px);
  background-size: 28px 3px;
  animation: help-flow 0.9s linear infinite;
}

@keyframes help-flow {
  to { background-position: 28px 0; }
}

.help-p2p-points {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.help-p2p-points li {
  color: var(--text-muted);
  line-height: 1.6;
  word-break: keep-all;
}

.help-p2p-points b {
  display: block;
  color: var(--text-main);
}

/* Boards */
.help-board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.help-board-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.help-board-card:hover {
  border-color: var(--primary-border);
  transform: translateY(-2px);
}

.help-board-card.active {
  border-color: var(--accent);
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.16), var(--bg-surface));
  box-shadow: 0 0 0 1px var(--accent);
}

.help-board-icon {
  font-size: 1.7rem;
  line-height: 1.2;
}

.help-board-card strong {
  font-size: 0.98rem;
}

.help-board-card small {
  color: var(--text-muted);
  font-size: 0.8rem;
  word-break: keep-all;
}

.help-board-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.75rem;
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  scroll-margin-top: 1rem;
}

.help-board-text h3 {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
}

.help-board-text h3 small {
  display: block;
  margin-top: 0.15rem;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.help-when {
  margin-bottom: 0.9rem;
  color: var(--text-main);
  word-break: keep-all;
}

.help-when span {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  font-size: 0.78rem;
  font-weight: 700;
}

.help-mini-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.help-mini-steps li {
  position: relative;
  padding-left: 2.1rem;
  color: var(--text-muted);
  line-height: 1.55;
  word-break: keep-all;
  counter-increment: step;
}

.help-mini-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.help-note {
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.1);
  color: var(--text-muted);
  font-size: 0.88rem;
  word-break: keep-all;
}

/* Board mockups: simplified screens drawn with CSS */
.help-mockup {
  animation: help-step-in 0.3s ease-out;
}

.hm-window {
  overflow: hidden;
  border: 1px solid #475569;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.hm-titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 700;
}

.hm-titlebar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f87171;
}

.hm-titlebar i:nth-child(2) { background: #fbbf24; }
.hm-titlebar i:nth-child(3) { background: #34d399; }
.hm-titlebar span { margin-left: 6px; }

.hm-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 190px;
  padding: 12px;
  font-size: 0.8rem;
}

.hm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hm-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

.hm-chip.is-primary {
  background: #4f46e5;
  color: #fff;
}

.hm-toolbar {
  display: flex;
  gap: 6px;
}

.hm-toolbar i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #e2e8f0;
}

.hm-toolbar i.is-on { background: #4f46e5; }

.hm-canvas {
  width: 100%;
  height: auto;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.hm-canvas path:first-child {
  stroke-dasharray: 260;
  animation: hm-draw 2.4s ease-in-out infinite alternate;
}

@keyframes hm-draw {
  from { stroke-dashoffset: 260; }
  to { stroke-dashoffset: 0; }
}

.hm-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
}

.hm-note {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 6px;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}

.hm-note:nth-child(odd) { transform: rotate(-2deg); }
.hm-note:nth-child(even) { transform: rotate(1.5deg); }
.hm-note.is-yellow { background: #fde68a; }
.hm-note.is-cyan { background: #a5f3fc; }
.hm-note.is-violet { background: #ddd6fe; }
.hm-note.is-green { background: #bbf7d0; }

.hm-note.is-hidden {
  color: #6d28d9;
  font-size: 1.3rem;
  background: repeating-linear-gradient(45deg, #ddd6fe 0 8px, #c4b5fd 8px 16px);
}

.hm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.hm-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-item b {
  color: #4f46e5;
  font-size: 0.75rem;
}

.hm-item em {
  flex-shrink: 0;
  color: #64748b;
  font-size: 0.68rem;
  font-style: normal;
}

.hm-item.is-done {
  opacity: 0.7;
}

.hm-item.is-done em {
  padding: 1px 6px;
  border-radius: 999px;
  background: #d1fae5;
  color: #047857;
  font-weight: 700;
}

.hm-item.is-selected {
  border-color: #818cf8;
  background: #eef2ff;
}

.hm-md {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.hm-question {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef2ff;
  font-weight: 800;
}

.hm-question small {
  display: block;
  color: #059669;
  font-size: 0.68rem;
}

.hm-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.hm-options span {
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.hm-options .is-correct {
  border-color: #10b981;
  background: #d1fae5;
  color: #047857;
  font-weight: 700;
}

.hm-bars,
.hm-file {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hm-bars > div,
.hm-file {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: 8px;
}

.hm-file {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 2.2rem;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.hm-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-bars i,
.hm-file i {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.hm-bars i::after,
.hm-file i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  animation: hm-grow 1s ease-out both;
}

@keyframes hm-grow {
  from { width: 0; }
}

.hm-bars b,
.hm-file b {
  color: #475569;
  font-size: 0.72rem;
  text-align: right;
}

.hm-answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
}

.hm-answers span {
  padding: 8px 10px;
  border-left: 3px solid #10b981;
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  font-weight: 700;
}

/* Host features */
.help-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 0.75rem;
}

.help-feature {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.help-feature-icon {
  font-size: 1.7rem;
}

.help-feature p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: keep-all;
}

/* FAQ */
.help-faq {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.help-faq details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.help-faq summary {
  position: relative;
  padding: 0.9rem 2.5rem 0.9rem 1rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.help-faq summary::-webkit-details-marker {
  display: none;
}

.help-faq summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
}

.help-faq details[open] summary::after {
  content: "−";
}

.help-faq details p {
  padding: 0 1rem 1rem;
  color: var(--text-muted);
  line-height: 1.65;
  word-break: keep-all;
}

.help-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .help-screen,
  .help-step,
  .help-mockup,
  .p2p-link i,
  .hm-canvas path:first-child,
  .hm-bars i::after,
  .hm-file i::after,
  .help-open-btn.is-new::after {
    animation: none;
  }
}

@media (max-width: 900px) {
  .help-hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1.5rem;
  }

  .help-hero-art {
    max-width: 560px;
    margin: 0 auto;
  }

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

  .help-board-detail,
  .help-p2p {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .help-header-row,
  .help-nav,
  .help-scroll > * {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .help-hero-cta {
    width: 100%;
  }

  .help-track {
    display: flex;
  }

  .help-track-btn {
    flex: 1;
    padding: 0.5rem 0.4rem;
    font-size: 0.85rem;
  }

  .help-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
  }

  .help-step:not(:last-child)::after {
    content: "↓";
    top: auto;
    right: auto;
    bottom: -1.3rem;
    left: 50%;
    transform: translateX(-50%);
  }

  .help-board-card {
    padding: 0.75rem;
  }

  .help-board-detail,
  .help-p2p {
    padding: 1rem;
  }

  .p2p-device {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .p2p-link {
    width: 44px;
  }
}

/* User guide: notices (terms-style) */
.help-notices {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
}

.help-notices details {
  border-bottom: 1px solid var(--border-color);
}

.help-notices summary {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 1.1rem 2.5rem 1.1rem 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  word-break: keep-all;
}

.help-notices summary::-webkit-details-marker {
  display: none;
}

.help-notices summary::after {
  content: "+";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 800;
}

.help-notices details[open] summary::after {
  content: "−";
}

.help-notice-num {
  flex-shrink: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 800;
}

.help-notices details > div {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 0.5rem 1.2rem 2.85rem;
}

.help-notices details p {
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.7;
  word-break: keep-all;
}

.help-footer-note {
  color: var(--text-subtle);
  font-size: 0.78rem;
  font-style: normal;
}

@media (max-width: 640px) {
  .help-notices details > div {
    padding-left: 0.25rem;
  }
}

/* User guide: privacy policy and contact */
.help-policy-meta {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--text-subtle);
  font-size: 0.82rem;
}

.help-policy {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.help-policy-block {
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.help-policy-label {
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.help-policy-block h3 {
  margin-bottom: 0.6rem;
  font-size: 1.08rem;
  font-weight: 800;
}

.help-policy-block h4 {
  margin: 0.75rem 0 0.35rem;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
}

.help-policy-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 1.1rem;
}

.help-policy-list li,
.help-policy-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.help-policy-list li::marker {
  color: var(--accent);
}

.help-policy-block .help-policy-note {
  margin-top: 0.6rem;
}

.help-contact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 0.75rem;
}

.help-contact-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.4rem 1.25rem;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(79, 70, 229, 0.28), var(--bg-surface));
}

.help-contact-email {
  color: var(--text-main);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}

.help-contact-email:hover {
  color: var(--accent);
}

.help-contact-card p:last-child {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.help-contact-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(150deg, rgba(245, 158, 11, 0.1), var(--bg-surface));
}

.help-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
}

.help-footer-links button {
  padding: 0.2rem;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: 600 0.85rem var(--font-sans);
  font-style: normal;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.help-footer-links button:hover {
  color: var(--accent);
}
