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

body {
  min-height: 100vh;
  background: #f4f8ff;
  color: #003366;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
}

button, input { font: inherit; }

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.navbar {
  min-height: 56px;
  background: #008080;
  color: #fff;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar h1 {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.nav-icon {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.45rem;
  cursor: pointer;
  border-radius: 8px;
}

.nav-icon:active { background: rgba(255,255,255,0.16); }

.add-wrap { position: relative; }

.add-popup,
.share-popup {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid #d5dce6;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.18);
  padding: 6px;
  z-index: 1500;
  direction: rtl;
}

.add-popup.active,
.share-popup.active { display: flex; flex-direction: column; }

.add-popup {
  top: 48px;
  left: 0;
  min-width: 158px;
}

.add-popup button,
.share-popup button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #263238;
  text-align: right;
  padding: 8px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.add-popup button:hover,
.share-popup button:hover { background: #eef6f6; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  display: none;
  z-index: 2100;
}

.drawer-backdrop.active { display: block; }

.side-drawer {
  position: fixed;
  top: 0;
  right: -270px;
  width: 260px;
  max-width: 82vw;
  height: 100vh;
  background: #fff;
  box-shadow: -8px 0 24px rgba(0,0,0,0.18);
  z-index: 2200;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 8px;
  transition: right 0.22s ease;
}

.side-drawer.active { right: 0; }

.drawer-close {
  align-self: flex-start;
  width: 38px;
  height: 34px;
  border: 1px solid #c8d4df;
  border-radius: 8px;
  background: #fff;
  color: #003366;
  cursor: pointer;
}

.side-drawer a {
  color: #003366;
  text-decoration: none;
  padding: 12px 8px;
  border-bottom: 1px solid #eef2f5;
  font-weight: 700;
}

.toggle-bar {
  display: flex;
  justify-content: space-around;
  background: #e6f0ff;
  padding: 10px 0;
  flex: 0 0 auto;
  position: sticky;
  top: 56px;
  z-index: 999;
}

.toggle-item {
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: #003366;
}

.toggle-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #008080;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.45rem;
  color: #008080;
}

.toggle-item.active .toggle-circle {
  background: #4caf50;
  color: #fff;
  border-color: #4caf50;
}

.toggle-label {
  margin-top: 6px;
  font-size: 0.78rem;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #fafafa;
}

@media (hover: hover) and (pointer: fine) {
  .content {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}

.section { display: none; }
.section.active { display: block; }

.post-card {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 18px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.post-title {
  font-size: 1rem;
  color: #003366;
  font-weight: 700;
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}

.title-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.title-fade {
  display: inline-block;
  opacity: 0.72;
  -webkit-mask-image: linear-gradient(270deg, #000 35%, transparent);
  mask-image: linear-gradient(270deg, #000 35%, transparent);
}

.title-toggle {
  border: 0;
  background: transparent;
  color: #008080;
  font-family: "Segoe UI", "Arial", "Tahoma", "Noto Sans Hebrew", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 0.70rem;
  line-height: 1;
  font-weight: 700;
  padding: 0 6px;
  cursor: pointer;
}

.post-date {
  color: gray;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.carousel-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin: 10px 0 14px;
}

.carousel-track {
  display: flex;
  transition: transform 0.24s ease;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  direction: ltr;
}

.carousel-track.dragging {
  cursor: grabbing;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
  display: flex;
}

.carousel-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
}

.carousel-indicators {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.58);
}

.dot.active { background: #fff; }

.bubble {
  position: relative;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px;
  color: #111;
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.clamp-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble.clamped .clamp-content,
.comment.clamped .clamp-content,
.comment-body.clamped .clamp-content {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp-toggle,
.options-toggle {
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: #008080;
  font-weight: 700;
  cursor: pointer;
}

.progress-container { margin-top: 15px; }

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.progress-labels span { overflow-wrap: anywhere; }

.progress-bar {
  height: 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  background: #ddd;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: #2196f3;
}

.progress-fill.con { background: #ff9800; }

.survey-options.collapsed .option-row:nth-child(n+4) { display: none; }

.option-row {
  padding-bottom: 8px;
}

.option-label {
  border: 0;
  background: transparent;
  color: #003366;
  cursor: pointer;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vote-actions {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  margin-top: 15px;
  position: relative;
}

.vote-actions > button,
.load-more,
.comment-btn {
  border: 1px solid #008080;
  background: #fff;
  color: #008080;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.share-wrap { position: relative; }

.share-popup {
  bottom: 42px;
  right: 0;
  min-width: 190px;
}

.comments {
  margin-top: 12px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  background: #fafafa;
  border-radius: 8px;
  padding: 8px;
  color: #222;
  font-size: 0.9rem;
}

.comment-date {
  color: gray;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.comment-body {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comment-form {
  display: flex;
  gap: 8px;
}

.comment-input {
  min-width: 0;
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  color: #555;
}

.empty,
.loading {
  text-align: center;
  color: #666;
  padding: 28px 8px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 18px;
}

.modal,
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.modal.active,
.lightbox.active { display: flex; }

.modal {
  background: rgba(0,0,0,0.38);
  padding: 20px;
}

.modal-box {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.modal-box h2 {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 16px;
  color: #003366;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions button {
  border: 0;
  background: #008080;
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}

.modal-actions .secondary {
  background: #eef2f5;
  color: #003366;
}

.lightbox {
  background: rgba(0,0,0,0.88);
  direction: ltr;
}

.lightbox-stage {
  width: 100%;
  height: 100%;
  padding: 64px 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.lightbox img {
  max-width: 96vw;
  max-height: 86vh;
  object-fit: contain;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.lightbox-controls {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 8px;
  z-index: 5001;
}

.lightbox-controls button {
  min-width: 42px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  background: rgba(255,255,255,0.13);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.placeholder-page {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #fff;
  padding: 20px;
}

.placeholder-back {
  color: #008080;
  font-weight: 700;
}

@media (max-width: 480px) {
  .toggle-circle { width: 48px; height: 48px; font-size: 1.3rem; }
  .carousel-slide img { height: 180px; }
  .vote-actions { flex-wrap: wrap; }
}
