* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #101010;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
}

h1 { font-size: 20px; margin: 0 0 16px; }
.prompt { font-weight: 600; }
.label { font-weight: 600; margin: 16px 0 8px; }
.note { color: #666; font-size: 14px; }
.error { color: #c62828; font-weight: 600; }

/* Inputs at 16px+ stop iOS from zooming the page on focus. */
input[type="text"], input[type="number"], textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

.next {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: #101010;
  border: 0;
  border-radius: 12px;
  touch-action: manipulation;
}
.next:disabled { background: #bbb; }
a.next + a.next { margin-top: 12px; }

.options { display: grid; gap: 8px; }
.option {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
}
.option:has(input:checked) { border-color: #101010; background: #f4f4f4; }
.other-text { margin-top: 8px; }

.year { display: flex; gap: 8px; align-items: center; }
.year input { max-width: 140px; }

/* Likert */
.legend { list-style: none; padding: 10px 12px; margin: 0 0 8px; background: #f6f6f6; border-radius: 10px; font-size: 13px; }
.item { padding: 14px 0; border-bottom: 1px solid #eee; }
.item p { margin: 0 0 10px; }
.scale { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.scale label { position: relative; }
.scale input { position: absolute; opacity: 0; }
.scale span {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-weight: 600;
}
.scale input:checked + span { background: #101010; color: #fff; border-color: #101010; }
.ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12px; color: #666; }
.ends span:last-child { text-align: right; }

/* Slider */
.slider input { width: 100%; margin: 24px 0 4px; }
.slider.untouched input::-webkit-slider-thumb { opacity: 0.35; }
.slider .value { font-size: 18px; }

/* Feed: close to the Threads mobile layout */
.feed-top {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -24px -16px 0;
  padding: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.15);
}
.feed-top .chevron { display: inline-block; margin-left: 2px; color: #999; font-weight: 400; transform: translateY(-3px); }
.post { display: flex; gap: 12px; padding: 12px 0 10px; border-bottom: 0.5px solid rgba(0, 0, 0, 0.15); font-size: 15px; line-height: 1.4; }
.avatar-wrap { position: relative; flex: none; height: 36px; }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}
.follow {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #000;
  border: 2px solid #fff;
  border-radius: 50%;
}
.post-body { flex: 1; min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 6px; }
.meta b { font-weight: 600; }
.meta .time { color: #999; }
.meta .more { margin-left: auto; color: #000; letter-spacing: 1px; }
.post-body p { margin: 1px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.media {
  display: flex;
  gap: 6px;
  margin: 0 -16px 10px 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.media::-webkit-scrollbar { display: none; }
.media img {
  flex: none;
  width: 78%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  scroll-snap-align: start;
}
.actions { display: flex; gap: 4px; margin-left: -8px; color: #424242; font-size: 13px; }
.actions span { display: inline-flex; gap: 4px; align-items: center; padding: 6px 8px; border-radius: 999px; }
.actions svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.composer { display: flex; gap: 10px; margin-top: 16px; }
.composer-body { flex: 1; }
.composer .label { margin-top: 0; font-weight: 400; }

.end pre { white-space: pre-wrap; font-size: 12px; background: #f6f6f6; padding: 12px; border-radius: 10px; }

/* Desktop: no swipe with a mouse, so show both photos; frame the column like a feed app on the web. */
@media (min-width: 640px) {
  body { background: #f5f5f5; }
  .page { margin: 24px auto; background: #fff; border: 1px solid #e5e5e5; border-radius: 16px; }
  .feed-top { margin-top: -24px; border-radius: 16px 16px 0 0; }
  .media { margin-right: 0; overflow: visible; }
  .media img { width: calc(50% - 3px); }
}

.next[hidden] { display: none; }
.back { display: block; margin: 0 0 12px -4px; padding: 6px 4px; border: 0; background: none; font: inherit; color: #555; cursor: pointer; }
.slider + .slider { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }

/* Bottom tab bar on the feed page (phone only). */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.97);
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
}
.tab-bar svg { width: 26px; height: 26px; fill: none; stroke: #b8b8b8; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab-bar svg:first-child { stroke: #000; }
.tab-bar .filled { fill: #000; }
.feed-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) {
  .tab-bar { display: none; }
  .feed-page { padding-bottom: 32px; }
}
