* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #222;
  /* prevent tap highlight flash on mobile */
  -webkit-tap-highlight-color: transparent;
}
.app { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { margin: 0 0 4px; font-size: 24px; }
.muted { color: #666; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* font-size 16px prevents iOS auto-zoom on focus */
input[type="text"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}
button, .filelike {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #2357ff;
  color: #fff;
  cursor: pointer;
  font: inherit;
  /* minimum touch target */
  min-height: 44px;
  white-space: nowrap;
}
button.secondary { background: #5b6473; }
.filelike input { display: none; }
.meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.images { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.images img {
  width: 100%;
  height: auto;
  border: 1px solid #d8dfeb;
  border-radius: 10px;
  background: #fff;
}
.answer-buttons {
  gap: 10px;
  margin-bottom: 12px;
}
.answer-buttons button {
  background: #eef2ff;
  color: #234;
  border: 1px solid #c9d3ff;
  min-width: 52px;
  min-height: 52px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 12px;
}
.answer-buttons button.active {
  background: #2357ff;
  color: #fff;
}
.two-col > label { min-width: 180px; }
.checkbox { flex-direction: row; align-items: center; margin-top: 26px; }
.statusline { min-height: 24px; }

/* nav buttons */
#prevBtn, #nextBtn {
  min-width: 72px;
  font-size: 16px;
}

/* collapsible toolbar sections on mobile */
details.toolbar-section > summary {
  cursor: pointer;
  padding: 6px 0;
  font-size: 13px;
  color: #5b6473;
  user-select: none;
  list-style: none;
}
details.toolbar-section > summary::before {
  content: '▶ ';
  font-size: 11px;
}
details.toolbar-section[open] > summary::before {
  content: '▼ ';
}

@media (max-width: 640px) {
  .app { padding: 8px 8px 80px; /* bottom padding for fixed nav */ }
  .card { padding: 12px; }
  h1 { font-size: 18px; }

  /* fixed bottom bar for prev/next */
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0;
    background: #fff;
    border-top: 1px solid #d0d7e2;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  }
  .nav-bar button {
    flex: 1;
    border-radius: 0;
    min-height: 56px;
    font-size: 18px;
  }
  .nav-bar #prevBtn { border-right: 1px solid #c9d3ff; background: #eef2ff; color: #234; }
  .nav-bar #nextBtn { background: #2357ff; color: #fff; }

  /* hide inline prev/next from toolbar on mobile */
  .toolbar-nav { display: none; }

  .answer-buttons button {
    flex: 1;
    min-width: 0;
    font-size: 20px;
    min-height: 56px;
  }

  /* make confidence input narrower */
  .two-col { gap: 8px; }
  .two-col > label { min-width: 120px; }
}

/* desktop: no fixed nav bar */
@media (min-width: 641px) {
  .nav-bar { display: none; }
}