/* ============================================================
   PASNESER TOUR BUILDER — Design System
   Premium · European · Minimal · Outdoors/Navigation
   ============================================================ */

/* --- Color System --- */
:root {
  /* Primary — deep forest/teal for navigation feel */
  --primary-50:  #eef4f3;
  --primary-100: #d4e4e1;
  --primary-200: #a9c9c3;
  --primary-300: #6fa39a;
  --primary-400: #4a8579;
  --primary-500: #2d6b5e;
  --primary-600: #20544a;
  --primary-700: #1a4239;
  --primary-800: #153630;
  --primary-900: #0f2620;

  /* Secondary — warm stone/amber accent */
  --secondary-50:  #faf6f0;
  --secondary-100: #f0e6d6;
  --secondary-200: #e1ccaa;
  --secondary-300: #cda975;
  --secondary-400: #b88a4a;
  --secondary-500: #9e7038;
  --secondary-600: #80582c;
  --secondary-700: #634524;
  --secondary-800: #4a3520;
  --secondary-900: #382819;

  /* Accent — signal blue for interactive */
  --accent-50:  #eef4fa;
  --accent-100: #d4e3f5;
  --accent-200: #a8c8ed;
  --accent-300: #71a4e0;
  --accent-400: #4a82cf;
  --accent-500: #2d63b0;
  --accent-600: #234e8c;
  --accent-700: #1c3d6e;
  --accent-800: #163055;
  --accent-900: #112440;

  /* Success — muted green */
  --success-50:  #edf6ee;
  --success-100: #cfe5d2;
  --success-200: #9cca9f;
  --success-300: #6ba870;
  --success-400: #4a8c50;
  --success-500: #356f3a;
  --success-600: #2a5a2e;
  --success-700: #224725;
  --success-800: #1a361d;
  --success-900: #122715;

  /* Warning — muted amber */
  --warning-50:  #fbf5e8;
  --warning-100: #f5e3c0;
  --warning-200: #ecc98a;
  --warning-300: #e0ab53;
  --warning-400: #c98f30;
  --warning-500: #a97521;
  --warning-600: #875c1a;
  --warning-700: #6a4818;
  --warning-800: #4f3615;
  --warning-900: #3a2811;

  /* Error — muted red */
  --error-50:  #f8ede9;
  --error-100: #f0d0c5;
  --error-200: #e0a597;
  --error-300: #d07b68;
  --error-400: #b85a45;
  --error-500: #9c4533;
  --error-600: #7d3628;
  --error-700: #622c22;
  --error-800: #49211d;
  --error-900: #341815;

  /* Neutral — warm stone grays */
  --neutral-0:   #ffffff;
  --neutral-50:  #f7f5f3;
  --neutral-100: #edeae6;
  --neutral-200: #dcd7d1;
  --neutral-300: #c4bdb4;
  --neutral-400: #9e978d;
  --neutral-500: #7a746b;
  --neutral-600: #5d5750;
  --neutral-700: #44403a;
  --neutral-800: #2e2b27;
  --neutral-900: #1a1916;

  /* Semantic */
  --bg: var(--neutral-50);
  --bg-elevated: var(--neutral-0);
  --bg-dark: var(--primary-900);
  --text: var(--neutral-800);
  --text-secondary: var(--neutral-500);
  --text-tertiary: var(--neutral-400);
  --text-inverse: var(--neutral-50);
  --border: var(--neutral-200);
  --border-strong: var(--neutral-300);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing — 8px base */
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 8px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-10: 64px;
  --space-12: 80px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,25,22,0.08);
  --shadow-md: 0 4px 16px rgba(26,25,22,0.10);
  --shadow-lg: 0 12px 40px rgba(26,25,22,0.14);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;

  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

p { line-height: 1.55; }

.mono { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--text-secondary); }
.tiny { font-size: 0.8rem; }
.small { font-size: 0.875rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  border-color: var(--border-strong);
  background: var(--neutral-50);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary-600);
  color: var(--text-inverse);
  border-color: var(--primary-600);
}
.btn-primary:hover {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.btn-accent {
  background: var(--accent-500);
  color: var(--text-inverse);
  border-color: var(--accent-500);
}
.btn-accent:hover {
  background: var(--accent-400);
  border-color: var(--accent-400);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--neutral-100);
}

.btn-danger {
  color: var(--error-500);
  border-color: var(--error-200);
}
.btn-danger:hover {
  background: var(--error-50);
  border-color: var(--error-300);
}

.btn-icon {
  padding: var(--space-3);
  width: 38px;
  height: 38px;
}
.btn-icon-sm {
  padding: var(--space-2);
  width: 30px;
  height: 30px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: 1rem;
}

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

/* --- Inputs --- */
.input, .textarea, .select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-elevated);
  transition: border-color var(--duration) var(--ease);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(74,133,121,0.12);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--neutral-100);
  color: var(--neutral-700);
}
.badge-nav { background: var(--accent-50); color: var(--accent-700); }
.badge-story { background: var(--secondary-50); color: var(--secondary-700); }
.badge-interactive { background: var(--warning-50); color: var(--warning-700); }
.badge-note { background: var(--neutral-100); color: var(--neutral-600); }
.badge-success { background: var(--success-50); color: var(--success-700); }

/* --- Top Bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  height: 52px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--primary-700);
  cursor: pointer;
  user-select: none;
}
.topbar-brand .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-700);
  color: var(--neutral-50);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --- Save Status --- */
.save-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: opacity var(--duration) var(--ease);
}
.save-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-400);
  transition: background var(--duration) var(--ease);
}
.save-status.syncing .dot { background: var(--warning-400); animation: pulse 1.2s ease infinite; }
.save-status.synced .dot { background: var(--success-400); }
.save-status.local .dot { background: var(--neutral-400); }

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

/* --- Mode Tabs --- */
.mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  padding: 3px;
}
.mode-tab {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  letter-spacing: 0.02em;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--bg-elevated);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

/* --- Projects Screen --- */
.projects-screen {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.projects-content {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5);
  width: 100%;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-6);
}
.projects-header h1 {
  font-size: 1.5rem;
  color: var(--neutral-800);
}
.projects-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-1);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.project-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.project-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neutral-800);
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.project-card-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.project-card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.project-card-new {
  border: 2px dashed var(--border-strong);
  background: transparent;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
}
.project-card-new:hover {
  border-color: var(--primary-400);
  color: var(--primary-600);
}

/* --- Tour Builder Layout --- */
.builder {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.builder-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  height: 48px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.builder-subbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.builder-project-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.builder-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* --- Map Canvas --- */
.map-container {
  flex: 1;
  position: relative;
  background: #e8eae6;
  overflow: hidden;
}

.map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.map-canvas:active { cursor: grabbing; }

.map-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.map-controls {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 10;
  pointer-events: auto;
}

.map-control-group {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.map-btn:hover { background: var(--neutral-100); }
.map-btn svg { width: 18px; height: 18px; }

.map-layer-toggle {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  pointer-events: auto;
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  z-index: 10;
}
.map-layer-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.map-layer-btn.active {
  background: var(--primary-600);
  color: var(--text-inverse);
}

.map-scale {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--bg-elevated);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 10;
}

/* --- Maker Mode --- */
.maker-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.maker-stats {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.maker-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}
.maker-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
.maker-stat-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--neutral-800);
}

.maker-controls {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.capture-btn {
  width: 100%;
  max-width: 420px;
  padding: var(--space-6) var(--space-5);
  border: none;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: var(--text-inverse);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  box-shadow: 0 4px 24px rgba(45,107,94,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.capture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(45,107,94,0.4);
}
.capture-btn:active { transform: scale(0.97); }
.capture-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.capture-btn-measuring {
  background: linear-gradient(135deg, var(--warning-500), var(--warning-400));
  animation: measure-pulse 1.5s ease infinite;
}
@keyframes measure-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(169,117,33,0.3); }
  50% { box-shadow: 0 4px 32px rgba(169,117,33,0.5); }
}

.capture-btn-icon {
  width: 32px;
  height: 32px;
}

.maker-secondary-controls {
  display: flex;
  gap: var(--space-3);
  width: 100%;
  max-width: 420px;
  justify-content: center;
}

/* --- Capture Overlay --- */
.capture-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,38,32,0.85);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-5);
  animation: fade-in var(--duration) var(--ease);
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.capture-countdown {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--secondary-300);
}

.capture-progress-ring {
  width: 160px;
  height: 160px;
  position: relative;
}
.capture-progress-ring svg {
  transform: rotate(-90deg);
}
.capture-progress-ring .bg-circle {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 4;
}
.capture-progress-ring .fg-circle {
  fill: none;
  stroke: var(--secondary-300);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.capture-voice-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-inverse);
  font-size: 0.9rem;
}
.voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}
.voice-wave span {
  width: 3px;
  border-radius: 2px;
  background: var(--secondary-300);
  animation: wave 0.6s ease infinite alternate;
}
.voice-wave span:nth-child(1) { height: 40%; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 80%; animation-delay: 0.15s; }
@keyframes wave {
  from { transform: scaleY(0.4); }
  to { transform: scaleY(1); }
}

.capture-gps-info {
  color: var(--text-inverse);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- Review Panel --- */
.review-panel {
  width: 360px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.review-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  text-align: center;
  color: var(--text-tertiary);
  flex: 1;
}

.review-panel-content {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.point-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.point-number {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-700);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.field-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.coord-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}
.coord-row {
  display: flex;
  gap: var(--space-3);
}
.coord-row .label {
  color: var(--text-tertiary);
  width: 50px;
  flex-shrink: 0;
}

/* --- Audio Player --- */
.audio-player {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.audio-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--primary-600);
  color: var(--text-inverse);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.audio-play-btn:hover { background: var(--primary-500); }
.audio-play-btn svg { width: 16px; height: 16px; }
.audio-progress {
  flex: 1;
  height: 4px;
  background: var(--neutral-200);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}
.audio-progress-fill {
  height: 100%;
  background: var(--primary-400);
  transition: width 100ms linear;
}
.audio-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Category Selector --- */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.category-option {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: center;
}
.category-option:hover { border-color: var(--border-strong); }
.category-option.selected {
  background: var(--primary-50);
  border-color: var(--primary-400);
  color: var(--primary-700);
}

/* --- Tags --- */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tag-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  user-select: none;
}
.tag-chip:hover { border-color: var(--border-strong); }
.tag-chip.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: var(--text-inverse);
}

/* --- Trigger Control --- */
.trigger-control {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.trigger-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text);
  transition: all var(--duration) var(--ease);
}
.trigger-step-btn:hover { border-color: var(--primary-400); color: var(--primary-600); }
.trigger-value {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-700);
}

/* --- Simulate Controls --- */
.sim-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sim-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary-600);
  color: var(--text-inverse);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.sim-play-btn:hover { background: var(--primary-500); }
.sim-play-btn svg { width: 20px; height: 20px; }

.sim-scrubber {
  flex: 1;
  height: 6px;
  background: var(--neutral-200);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
.sim-scrubber-fill {
  height: 100%;
  background: var(--primary-400);
  border-radius: 3px;
  transition: width 50ms linear;
}
.sim-scrubber-handle {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-600);
  border: 2px solid var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%);
  transition: left 50ms linear;
}

.sim-speed {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sim-speed-btn {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.sim-speed-btn.active {
  background: var(--primary-600);
  color: var(--text-inverse);
  border-color: var(--primary-600);
}

.sim-progress-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Sim Log --- */
.sim-log-panel {
  width: 300px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sim-log-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sim-log-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.sim-log-entry {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
  border-left: 3px solid var(--border);
  font-size: 0.8rem;
  animation: slide-in var(--duration) var(--ease);
}
.sim-log-entry.nav { border-left-color: var(--accent-400); }
.sim-log-entry.story { border-left-color: var(--secondary-400); }
.sim-log-entry.interactive { border-left-color: var(--warning-400); }
.sim-log-entry .time {
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  font-size: 0.75rem;
}
.sim-log-entry .desc {
  color: var(--text);
  margin-top: 2px;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.sim-log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
  padding: var(--space-5);
}

/* --- Export Menu --- */
.export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 500;
  overflow: hidden;
  animation: fade-in var(--duration) var(--ease);
}
.export-menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  border-bottom: 1px solid var(--border);
}
.export-menu-item:last-child { border-bottom: none; }
.export-menu-item:hover { background: var(--neutral-50); }
.export-menu-item .name { font-weight: 500; font-size: 0.85rem; }
.export-menu-item .desc { font-size: 0.75rem; color: var(--text-tertiary); }

/* --- Dropdown wrapper --- */
.dropdown {
  position: relative;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-2) 0;
  border: none;
}

/* --- Checkbox row --- */
.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}
.check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.check-row.checked .check-box {
  background: var(--primary-600);
  border-color: var(--primary-600);
}
.check-row.checked .check-box::after {
  content: '✓';
  color: var(--text-inverse);
  font-size: 0.7rem;
  font-weight: 700;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .topbar { padding: 0 var(--space-4); height: 48px; }
  .topbar-brand { font-size: 0.95rem; }
  .topbar-brand .brand-mark { width: 24px; height: 24px; font-size: 0.6rem; }

  .builder-subbar {
    padding: 0 var(--space-3);
    height: 44px;
  }
  .mode-tab { padding: var(--space-2) var(--space-3); font-size: 0.75rem; }

  .review-panel {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 50;
    transition: transform var(--duration) var(--ease);
  }
  .review-panel.hidden-mobile { transform: translateY(100%); }

  .sim-log-panel {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 50;
  }

  .sim-controls { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
  .sim-play-btn { width: 38px; height: 38px; }
  .sim-speed-btn { padding: var(--space-1) var(--space-2); font-size: 0.7rem; }
  .sim-progress-info { font-size: 0.7rem; gap: var(--space-2); }

  .maker-stats { gap: var(--space-4); padding: var(--space-2) var(--space-4); }
  .maker-stat-value { font-size: 0.82rem; }

  .projects-content { padding: var(--space-5) var(--space-4); }
  .project-grid { grid-template-columns: 1fr; }

  .map-layer-toggle { bottom: var(--space-3); left: var(--space-3); }
  .map-controls { top: var(--space-3); right: var(--space-3); }
  .map-scale { bottom: var(--space-3); right: var(--space-3); }
}

@media (max-width: 480px) {
  .maker-secondary-controls { gap: var(--space-2); }
  .capture-btn { font-size: 1rem; padding: var(--space-5); }
}

/* --- Utility --- */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

/* --- Real Builder additions --- */
.project-actions{display:flex;gap:var(--space-2);flex-wrap:wrap}
.maker-recenter{position:absolute;right:14px;bottom:14px;z-index:8;width:44px;height:44px;font-size:20px;background:rgba(255,255,255,.92)}
.capture-live-transcript{margin-top:10px;max-width:310px;font-size:.78rem;line-height:1.4;color:rgba(255,255,255,.78);max-height:64px;overflow:hidden}
.quick-classify{position:absolute;left:12px;right:12px;bottom:12px;z-index:30;background:var(--bg-elevated);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:var(--space-4);max-width:700px;margin:auto}
.quick-classify-head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-3)}
.quick-classify-cats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-2);margin-bottom:var(--space-3)}
.quick-classify-hint{margin-top:3px;color:var(--text-muted);font-size:.74rem;font-weight:400}
.quick-classify-label{margin:10px 0 7px;color:var(--text-muted);font-size:.68rem;font-weight:800;letter-spacing:.07em}
.quick-classify-label span{font-weight:500;letter-spacing:0;text-transform:none}
.quick-subtypes{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-bottom:var(--space-3)}
.subtype-option{min-height:40px;padding:8px 12px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-elevated);color:var(--text);font-size:.78rem;font-weight:600;cursor:pointer;transition:all var(--duration) var(--ease)}
.subtype-option:hover{border-color:var(--border-strong)}
.subtype-option.selected{background:var(--primary-600);border-color:var(--primary-600);color:var(--text-inverse)}
.quick-tags{max-height:126px;overflow:auto}
#mic-btn.recording{background:#7e2924;color:#fff;border-color:#7e2924}
.settings-backdrop{position:fixed;inset:0;z-index:1000;background:rgba(13,18,20,.58);display:flex;align-items:center;justify-content:center;padding:20px}
.settings-modal{width:min(620px,100%);max-height:90vh;overflow:auto;background:var(--bg-elevated);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);padding:var(--space-5)}
.settings-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-4);margin-bottom:var(--space-4)}
.settings-head h2{margin:0 0 4px}.settings-head p{margin:0;color:var(--text-muted);font-size:.85rem}
.settings-section{border-top:1px solid var(--border);padding-top:var(--space-4);margin-top:var(--space-4)}
.settings-section h3{margin:0 0 var(--space-3);font-size:1rem}
.settings-section label{display:block;font-size:.78rem;font-weight:700;color:var(--text-muted);margin:var(--space-3) 0}
.settings-section label .input{margin-top:6px;width:100%}
.settings-actions{display:flex;gap:var(--space-2);flex-wrap:wrap;margin-top:var(--space-3)}
.settings-cloud-state{font-size:.85rem;margin-top:var(--space-2)}

@media (max-width:768px){
  .project-actions{width:100%}.projects-header{gap:var(--space-3);flex-wrap:wrap}
  .topbar-right #settings-btn{padding-inline:8px}
  .quick-classify-cats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .settings-backdrop{padding:8px;align-items:flex-end}.settings-modal{border-radius:18px 18px 0 0;max-height:92vh}
}

/* Capture overlay cancel is deliberately low-emphasis but always reachable. */
.capture-cancel { color: rgba(255,255,255,.88); border-color: rgba(255,255,255,.25); }
.capture-cancel:hover { background: rgba(255,255,255,.10); }

/* === V1.2 field-hardening additions === */
#app { height: 100vh; height: 100dvh; }
.save-status.save-error { color: var(--error-500); font-weight: 700; }
.save-status.save-error .dot { background: var(--error-500); animation: pulse 1s ease infinite; }

.capture-overlay-v12 {
  justify-content: stretch;
  align-items: stretch;
  padding: 10px;
  overflow: hidden;
  background: rgba(15,38,32,.76);
}
.capture-sheet {
  width: min(760px, 100%);
  max-height: 100%;
  overflow-y: auto;
  margin: auto;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.capture-sheet-head { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); }
.capture-status-line { color:var(--text-secondary); font-size:.78rem; margin-top:3px; line-height:1.35; }
.capture-error { color:var(--error-500)!important; font-weight:700; }
.capture-mini-ring { position:relative; width:86px; height:86px; flex:0 0 86px; display:grid; place-items:center; }
.capture-mini-ring svg { position:absolute; inset:0; transform:rotate(-90deg); }
.capture-mini-ring circle { fill:none; stroke-width:7; }
.capture-mini-ring .bg-circle { stroke:var(--neutral-200); }
.capture-mini-ring .fg-circle { stroke:var(--secondary-500); transition:stroke-dashoffset .1s linear; }
.capture-mini-ring > span { font-family:var(--font-mono); font-size:1.35rem; font-weight:800; color:var(--primary-700); }
.capture-quality { font-family:var(--font-mono); font-size:.78rem; padding:8px 10px; background:var(--neutral-50); border:1px solid var(--border); border-radius:var(--radius-md); }
.capture-voice-box { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); padding:10px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--neutral-50); }
.capture-voice-box > div { min-width:0; }
.capture-voice-box .btn { flex-shrink:0; }
.capture-voice-box .btn.recording { background:#7e2924; color:#fff; border-color:#7e2924; }
.capture-section-label { margin:5px 0 7px; color:var(--text-muted); font-size:.68rem; font-weight:800; letter-spacing:.07em; }
.capture-transcript-light { margin-top:5px; font-size:.76rem; max-height:42px; overflow:auto; color:var(--text-secondary); }
.capture-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:var(--space-2); position:sticky; bottom:-16px; background:var(--bg-elevated); padding:10px 0 2px; }

.gps-redo-backdrop { position:fixed; inset:0; z-index:1500; background:rgba(13,18,20,.66); display:grid; place-items:center; padding:16px; }
.gps-redo-card { width:min(360px,100%); background:var(--bg-elevated); border-radius:var(--radius-xl); padding:var(--space-5); box-shadow:var(--shadow-lg); text-align:center; }
.gps-redo-count { font-family:var(--font-mono); font-size:3rem; font-weight:800; color:var(--primary-700); margin:12px 0; }
.gps-redo-card p { color:var(--text-secondary); margin-bottom:12px; }
#replace-voice.recording { background:#7e2924; color:#fff; border-color:#7e2924; }

@media (max-width: 600px) {
  .topbar { padding: 0 8px; height:48px; gap:6px; }
  .topbar-brand { font-size:0; gap:0; flex:0 0 auto; }
  .topbar-brand .brand-mark { width:26px; height:26px; }
  .topbar-center { flex:1 1 auto; min-width:0; justify-content:center; }
  .mode-tabs { min-width:0; }
  .mode-tab { padding:6px 8px; font-size:.72rem; }
  .topbar-right { gap:6px; flex:0 0 auto; min-width:0; }
  .topbar > .topbar-right .save-status span { display:none; }
  .topbar > .topbar-right .save-status { gap:0; }
  .topbar > .topbar-right .save-status.save-error span { display:inline; font-size:.62rem; max-width:58px; line-height:1.05; }
  #export-btn { padding:7px 8px; font-size:.76rem; }

  .builder-subbar { padding:0 8px; gap:6px; height:44px; min-width:0; }
  .builder-subbar-left { gap:6px; min-width:0; flex:1; }
  .builder-project-name { min-width:0; max-width:145px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.82rem; }
  .builder-subbar > .topbar-right { display:none; }
  #project-distance-badge { display:none; }
  #project-point-badge { font-size:.65rem; padding:2px 6px; flex-shrink:0; }

  .maker-controls { padding:10px 12px max(10px, env(safe-area-inset-bottom)); gap:9px; }
  .capture-btn { padding:14px 10px; font-size:.95rem; border-radius:14px; }
  .capture-btn svg { width:24px; height:24px; }
  .maker-secondary-controls .btn { padding:8px 9px; gap:5px; font-size:.76rem; flex:1; }
  .maker-stats { gap:14px; padding:6px 10px; }
  .maker-stat-label { font-size:.58rem; }
  .maker-stat-value { font-size:.73rem; }
  .maker-recenter { bottom:10px; right:10px; }

  .capture-overlay-v12 { padding:0; background:rgba(15,38,32,.82); }
  .capture-sheet { width:100%; max-height:100%; margin:auto 0 0; border-radius:18px 18px 0 0; border-bottom:none; padding:12px 12px max(12px, env(safe-area-inset-bottom)); }
  .capture-mini-ring { width:66px; height:66px; flex-basis:66px; }
  .capture-mini-ring svg { width:66px; height:66px; }
  .capture-mini-ring > span { font-size:1.05rem; }
  .capture-voice-box { align-items:stretch; flex-direction:column; }
  .capture-voice-box .btn { width:100%; }
  .quick-classify-cats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .category-option, .subtype-option, .tag-chip { min-height:38px; }
  .capture-actions { justify-content:stretch; }
  .capture-actions .btn { flex:1 1 140px; padding:9px 8px; font-size:.75rem; }

  .review-panel-content { padding:var(--space-4); gap:var(--space-4); padding-bottom:max(var(--space-4), env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .mode-tab { padding:6px 6px; font-size:.68rem; }
  #export-btn { padding:6px; }
  .builder-project-name { max-width:120px; }
}
.map-attribution-html{position:absolute;right:6px;bottom:4px;z-index:11;background:rgba(255,255,255,.84);padding:2px 5px;border-radius:3px;font-size:9px;line-height:1.25;color:#3f4546;pointer-events:auto}
.map-attribution-html a{color:inherit;text-decoration:none}.map-attribution-html a:hover{text-decoration:underline}

/* Mobile field-status toast: the desktop mode hint is intentionally hidden on
   small screens, so critical GPS/save/voice messages still need a visible home. */
.app-toast { display:none; }
@media (max-width: 600px) {
  .builder { position:relative; }
  .app-toast {
    display:block;
    position:absolute;
    top:50px;
    left:8px;
    right:8px;
    z-index:190;
    padding:8px 10px;
    border:1px solid rgba(43,27,18,.16);
    border-radius:10px;
    background:rgba(255,244,213,.96);
    color:var(--primary-700);
    box-shadow:var(--shadow-md);
    font-size:.76rem;
    line-height:1.3;
    text-align:center;
    opacity:0;
    transform:translateY(-6px);
    pointer-events:none;
    transition:opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
  }
  .app-toast.show { opacity:1; transform:translateY(0); }
}


/* === V1.2 step 5: mobile / PWA field hardening === */
html, body { min-height:100%; overscroll-behavior:none; }
#app { min-height:0; height:100vh; }
@supports (height: 100dvh) { #app { height:100dvh; } }

/* viewport-fit=cover lets installed iPhones use the full screen; controls must
   then explicitly stay outside notches/home indicators. env() is zero elsewhere. */
.topbar {
  height:calc(52px + env(safe-area-inset-top));
  padding-top:env(safe-area-inset-top);
  padding-left:max(var(--space-5), env(safe-area-inset-left));
  padding-right:max(var(--space-5), env(safe-area-inset-right));
}
.projects-content {
  padding-left:max(var(--space-5), env(safe-area-inset-left));
  padding-right:max(var(--space-5), env(safe-area-inset-right));
  padding-bottom:max(var(--space-7), env(safe-area-inset-bottom));
}
.builder-subbar {
  padding-left:max(var(--space-5), env(safe-area-inset-left));
  padding-right:max(var(--space-5), env(safe-area-inset-right));
}
.maker-controls, .sim-controls {
  padding-left:max(var(--space-5), env(safe-area-inset-left));
  padding-right:max(var(--space-5), env(safe-area-inset-right));
  padding-bottom:max(var(--space-4), env(safe-area-inset-bottom));
}
.settings-backdrop {
  padding-top:max(20px, env(safe-area-inset-top));
  padding-right:max(20px, env(safe-area-inset-right));
  padding-bottom:max(20px, env(safe-area-inset-bottom));
  padding-left:max(20px, env(safe-area-inset-left));
}
.settings-readiness { display:flex; flex-direction:column; gap:7px; }
.readiness-row { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; font-size:.82rem; }
.readiness-row span { color:var(--text-secondary); }
.readiness-row strong { text-align:right; overflow-wrap:anywhere; }

/* Touch devices should not depend on hover feedback. */
@media (hover: none) and (pointer: coarse) {
  .btn, .mode-tab, .map-btn, .category-option, .subtype-option, .tag-chip, .sim-speed-btn { -webkit-tap-highlight-color:transparent; }
  .btn:hover, .mode-tab:hover, .map-btn:hover, .category-option:hover, .subtype-option:hover, .tag-chip:hover { transform:none; }
  .btn { min-height:40px; }
}

@media (max-width: 768px) {
  .topbar {
    height:calc(48px + env(safe-area-inset-top));
    padding-top:env(safe-area-inset-top);
    padding-left:max(var(--space-4), env(safe-area-inset-left));
    padding-right:max(var(--space-4), env(safe-area-inset-right));
  }
  .builder-subbar {
    padding-left:max(var(--space-3), env(safe-area-inset-left));
    padding-right:max(var(--space-3), env(safe-area-inset-right));
  }
  .projects-content {
    padding-left:max(var(--space-4), env(safe-area-inset-left));
    padding-right:max(var(--space-4), env(safe-area-inset-right));
    padding-bottom:max(var(--space-5), env(safe-area-inset-bottom));
  }
  .sim-controls { padding-bottom:max(var(--space-2), env(safe-area-inset-bottom)); }
  .settings-backdrop {
    padding-top:max(8px, env(safe-area-inset-top));
    padding-right:max(8px, env(safe-area-inset-right));
    padding-bottom:env(safe-area-inset-bottom);
    padding-left:max(8px, env(safe-area-inset-left));
  }
  .settings-modal { max-height:calc(92dvh - env(safe-area-inset-top)); }
}

@media (max-width: 600px) {
  .topbar {
    padding-left:max(8px, env(safe-area-inset-left));
    padding-right:max(8px, env(safe-area-inset-right));
  }
  .topbar-center { overflow:hidden; }
  .mode-tabs { max-width:100%; }
  .mode-tab { min-width:0; min-height:34px; }
  .builder-subbar {
    padding-left:max(8px, env(safe-area-inset-left));
    padding-right:max(8px, env(safe-area-inset-right));
  }
  .maker-stats {
    scrollbar-width:none;
    padding-left:max(10px, env(safe-area-inset-left));
    padding-right:max(10px, env(safe-area-inset-right));
  }
  .maker-stats::-webkit-scrollbar { display:none; }
  .maker-controls {
    padding-left:max(12px, env(safe-area-inset-left));
    padding-right:max(12px, env(safe-area-inset-right));
    padding-bottom:max(10px, env(safe-area-inset-bottom));
  }
  .capture-sheet {
    padding-left:max(12px, env(safe-area-inset-left));
    padding-right:max(12px, env(safe-area-inset-right));
    padding-bottom:max(12px, env(safe-area-inset-bottom));
  }
  .export-menu { max-width:calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  .readiness-row { font-size:.78rem; }
}

@media (max-width: 340px) {
  .mode-tab { padding:5px; font-size:.64rem; }
  #export-btn { padding-inline:5px; font-size:.70rem; }
  .builder-project-name { max-width:92px; }
  .maker-secondary-controls .btn { padding-inline:6px; font-size:.70rem; }
  .project-actions .btn { flex:1 1 100%; }
}


/* === V1.2.1 field UX: progressive one-hand capture === */
.maker-controls-v121 { gap:10px; }
.maker-action-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.field-action {
  min-height:58px; border:1px solid var(--border); border-radius:14px;
  background:var(--bg-elevated); color:var(--primary-700); box-shadow:var(--shadow-sm);
  display:flex; align-items:center; justify-content:center; gap:9px; padding:10px 8px;
  font-size:.76rem; font-weight:800; letter-spacing:.035em; cursor:pointer;
}
.field-action-primary { background:var(--primary-700); color:var(--text-inverse); border-color:var(--primary-700); }
.field-action:active { transform:scale(.98); }
.field-action:disabled { opacity:.44; cursor:not-allowed; transform:none; }
.field-action.recording, #mic-btn.recording { background:#7e2924; color:#fff; border-color:#7e2924; }
.maker-session-controls { justify-content:center; }
.maker-session-controls .btn { flex:0 1 180px; }

.field-choice-overlay {
  position:absolute; inset:0; z-index:60; display:flex; align-items:flex-end; justify-content:center;
  padding:12px; background:rgba(15,38,32,.58);
}
.field-choice-sheet {
  width:min(560px,100%); max-height:92%; overflow:auto; background:var(--bg-elevated); color:var(--text);
  border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow-lg); padding:12px;
}
.field-choice-head { display:grid; grid-template-columns:38px 1fr 38px; align-items:start; gap:8px; margin-bottom:10px; text-align:center; }
.field-choice-head strong { display:block; font-size:1rem; color:var(--primary-700); }
.field-choice-head span { display:block; margin-top:2px; color:var(--text-muted); font-size:.72rem; line-height:1.3; }
.field-close, .field-back {
  width:36px; height:36px; border:0; border-radius:10px; background:var(--neutral-100); color:var(--text);
  font-size:1.35rem; line-height:1; cursor:pointer;
}
.field-choice-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.field-choice-btn {
  min-height:62px; border:1px solid var(--border); border-radius:13px; background:var(--bg-elevated); color:var(--text);
  padding:10px; text-align:left; cursor:pointer;
}
.field-choice-btn strong { display:block; font-size:.91rem; color:var(--primary-700); }
.field-choice-btn span { display:block; margin-top:3px; font-size:.69rem; color:var(--text-muted); line-height:1.25; }
.field-choice-btn:active { transform:scale(.985); }
.field-text-sheet { max-width:520px; }
.field-textarea { width:100%; resize:vertical; min-height:120px; font-size:1rem; }
.field-text-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:10px; }
.capture-selected-type { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--neutral-50); }
.capture-selected-type strong { color:var(--primary-700); }
.capture-selected-type span { color:var(--text-secondary); font-size:.82rem; text-align:right; }
.capture-selected-hint { margin-top:5px; color:var(--text-muted); font-size:.70rem; }

@media (max-width:600px) {
  .maker-controls-v121 { padding:9px 10px max(9px, env(safe-area-inset-bottom)); }
  .maker-action-grid { gap:7px; }
  .field-action { min-height:54px; padding:8px 5px; font-size:.68rem; gap:6px; }
  .field-action svg { width:20px; height:20px; flex:0 0 auto; }
  .maker-session-controls .btn { flex:1; min-height:36px; padding:6px 8px; }
  .field-choice-overlay { padding:0; }
  .field-choice-sheet { width:100%; max-height:88%; border-radius:18px 18px 0 0; border-bottom:0; padding:12px 12px max(12px, env(safe-area-inset-bottom)); }
  .field-choice-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .field-choice-btn { min-height:60px; }
}


/* === V1.2.2 field reliability === */
.project-card { position: relative; }
.project-card-delete {
  position:absolute; top:10px; right:10px; width:32px; height:32px; border-radius:10px;
  border:1px solid var(--border); background:var(--surface); color:var(--text-muted); font-size:22px; line-height:1; cursor:pointer; z-index:2;
}
.project-card-delete:hover { color:var(--error-500); border-color:var(--error-500); }
.maker-mic-meter, .capture-mic-meter { display:flex; align-items:center; gap:8px; padding:6px 10px; font-size:.72rem; font-weight:700; letter-spacing:.08em; }
.mic-level-track { flex:1; min-width:90px; height:8px; border-radius:999px; overflow:hidden; background:rgba(127,127,127,.2); }
.mic-level-fill { height:100%; width:0; border-radius:999px; background:currentColor; transition:width .1s linear; }
.maker-mic-meter.hidden, .capture-mic-meter.hidden { display:none; }

/* Field bundle panel (T7a) */
.bundle-panel{display:flex;flex-direction:column;gap:10px;font-size:.88rem}
.bundle-facts{color:var(--text-muted)}
.bundle-warning{background:#fbe9e7;color:#7e2924;border:1px solid #e3a8a1;border-radius:var(--radius-md);padding:8px 10px;font-weight:600}
.bundle-status{min-height:1.3em}
.bundle-panel progress{width:100%}
.bundle-actions{display:flex;flex-wrap:wrap;gap:8px}
.bundle-actions .btn{flex:1 1 140px;min-height:44px}
.mark-sheet-status{font-size:.82rem;min-height:1.3em;margin:6px 2px;color:var(--text-muted)}
.mark-sheet-status.error{color:#b3261e;font-weight:700}
.mark-photo-strip{display:flex;gap:6px;overflow-x:auto;margin:6px 0}
.mark-photo-strip img,.photo-thumb{width:56px;height:56px;object-fit:cover;border-radius:6px;border:1px solid var(--border);flex:none}
.photo-thumbs{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
#precise-btn[aria-pressed="true"]{background:var(--primary-600);color:var(--text-inverse)}
#problem-btn{background:#7e2924;color:#fff;border-color:#7e2924}
