/* Wrapper reset */
.discover-wrap{ border:0!important; }

/* Filter bar */
.discover-filterbar{
  max-width:1002px; margin:18px auto 0; padding:10px 12px;
  background:#f8f8fb; border:1px solid #eee; border-radius:10px;
}
.filters-row{ display:flex; gap:8px; align-items:center; }
.topic-input{
  flex:1; padding:10px 12px; border:1px solid #ddd; border-radius:10px;
  font-size:14px; background:#fff;
}
.near-toggle{
  border:1px solid #ddd; background:#fafafa; padding:10px 12px; border-radius:10px;
  font-weight:600; cursor:pointer;
}
.near-toggle[aria-pressed="true"]{
  background:#eef6ff; border-color:#cfe3ff;
}
.apply-btn{ font-weight:600; }

/* Topic Filter Bar */
.discover-topic-bar {
  max-width: 1002px;
  margin: 18px auto 0;
  padding: 16px 18px;
  background: #f8f8fb;
  border: 1px solid #eee;
  border-radius: 12px;
}

.topic-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.topic-bar-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.clear-topic-btn {
  font-size: 13px;
  color: #666;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.clear-topic-btn:hover {
  background: #eee;
  color: #333;
}

/* Topic Tags */
.topic-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.topic-tag {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.topic-tag:hover {
  border-color: #04b83c;
  color: #04b83c;
  background: #f0fff4;
}
.topic-tag.active {
  background: #04b83c;
  color: #fff;
  border-color: #04b83c;
}
.topic-tag.active:hover {
  background: #039d33;
  border-color: #039d33;
  color: #fff;
}

.topic-tag-more,
.topic-tag-less {
  background: #f0f0f0;
  color: #666;
  border-color: #ddd;
}
.topic-tag-more:hover,
.topic-tag-less:hover {
  background: #e5e5e5;
  color: #333;
  border-color: #ccc;
}

/* Free-form Search */
.topic-search-row {
  display: flex;
  gap: 8px;
}

.topic-search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}
.topic-search-input:focus {
  outline: none;
  border-color: #04b83c;
  box-shadow: 0 0 0 2px rgba(4, 184, 60, 0.1);
}
.topic-search-input::placeholder {
  color: #999;
}

.topic-search-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #04b83c;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.topic-search-btn:hover {
  background: #039d33;
}

/* Expanded Categories */
.topic-categories-expanded {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e5e5;
}

.topic-category-section {
  margin-bottom: 14px;
}

.topic-category-name {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.topic-category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-tag-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Card */
.discover-card{
  padding:20px; width:1002px; margin:20px auto;
  box-shadow: rgba(50,50,93,.25) 0 2px 5px -1px, rgba(0,0,0,.3) 0 1px 3px -1px;
  background:#f5f4f7; border-radius:10px; position:relative;
}
.discover-hero{ display:flex; gap:12px; align-items:center }
.discover-days_ago{
   position:absolute;
   top:10px;
   right:10px;
   border:3px solid #fff; box-shadow:0 4px 10px rgba(0,0,0,.1);
   border-radius:100px; display:block;
   padding:2px 6px;
   color:#04b83c;
   font-size:11px;
   font-weight:bold;
}
.discover-ico{
  border:3px solid #fff; box-shadow:0 4px 10px rgba(0,0,0,.1);
  height:44px; width:44px; border-radius:100px; display:block;
}
.discover-title a{ font-size:16px; font-weight:700; color:#000; text-decoration:none; }
.discover-sub{ color:#777; }
.discover-badges{ display:flex; gap:8px; align-items:center }
.chip{ border:1px solid #eee; padding:2px 6px; border-radius:999px; background:#fafafa; font-size:11px; color:#999; }

/

/* 16:9 viewport + scaled iframe */
.discover-shot{ margin:14px 0; position:relative; border-radius:10px; overflow:hidden; }
.discover-shot .viewport{ width:100%; aspect-ratio:16 / 9; position:relative; background:#f7f7f7; }
.discover-shot .viewport > * { position:absolute; inset:0; }
.scaled-stage { position:absolute; inset:0; overflow:hidden; }
.scaled-frame{
  position:absolute; top:0; left:0; border:0; display:block;
  width:1920px; height:1080px; transform-origin:0 0;
}
.shot-fallback{ width:100%; height:100%; object-fit:cover; display:none; border-radius:10px; }
.shot-fallback.visible{ display:block; }

.discover-desc{ font-size:15px; color:#333; height:54px; overflow:hidden; }

.discover-actions{
  display:flex; justify-content:space-between; align-items:center; padding-top:12px;
}

/* Buttons shared-ish with site page */
.btn{
  border:1px solid #ddd; background:#fafafa; padding:8px 12px; border-radius:10px;
  cursor:pointer; font-weight:600;
}
.btn:hover{ background:#f3f4f6; }

/* Hide feedback button on discover page */
.page-discover #feedbackBtn {
  display: none !important;
}

/* Personalize Bar - centered above card */
.discover-personalize-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px auto 20px;
  padding: 0 16px;
}
.discover-personalize-bar .button2 {
  font-size: 15px;
  padding: 10px 24px;
}
.personalize-active {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #f0fff4;
  border: 2px solid #04b83c;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  color: #2e7d32;
}
.personalize-edit-btn {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #04b83c;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.personalize-edit-btn:hover {
  background: #039d33;
}
.personalize-clear-btn {
  padding: 0 4px;
  font-size: 18px;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.personalize-clear-btn:hover {
  color: #dc2626;
}

/* Near Me toggle switch */
.near-me-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  padding: 8px 16px 8px 20px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 9999px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
.near-me-toggle:hover {
  border-color: #d1d5db;
  background: #f3f4f6;
}
.near-me-toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  transition: color 0.2s ease;
}
.near-me-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.near-me-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
.near-me-toggle.is-active {
  background: #eff6ff;
  border-color: #3b82f6;
}
.near-me-toggle.is-active .near-me-toggle-switch {
  background: #3b82f6;
}
.near-me-toggle.is-active .near-me-toggle-switch::after {
  transform: translateX(16px);
}
.near-me-toggle.is-active .near-me-toggle-label {
  color: #1d4ed8;
  font-weight: 600;
}
.near-me-toggle.is-active:hover {
  border-color: #2563eb;
  background: #dbeafe;
}
.distance-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #dbeafe;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  margin-left: 8px;
}
.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  margin-left: 8px;
  vertical-align: middle;
}

.vote-group{ display:flex; gap:12px; align-items:center; }

/* Upvote button - matching /launches page style */
.sl2-upvote{
  display:inline-block;
  width:48px; height:48px;
  border-radius:12px;
  border:2px solid #e5e7eb;
  background:#fff;
  cursor:pointer;
  user-select:none;
  vertical-align:middle;
  text-align:center;
  padding-top:6px;
  transition:border-color .2s, box-shadow .2s, background-color .2s;
}
.sl2-upvote:hover{ border-color:#04b83c; }
.sl2-upvote svg{
  width:16px; height:16px;
  fill:#374151;
  display:block;
  margin:0 auto 4px;
}
.sl2-upvote .sl2-upcount{
  margin:0;
  font-size:14px;
  font-weight:600;
  line-height:1;
  color:#374151;
}
.sl2-upvote.is-upvoted{
  border-color:#04b83c;
  box-shadow:0 0 0 2px #04b83c1a;
}
.sl2-upvote.is-upvoted svg{ fill:#04b83c; }
.sl2-upvote.is-upvoted .sl2-upcount{ color:#04b83c; }

/* Downvote button - matching upvote style */
.sl2-downvote{
  display:inline-block;
  width:48px; height:48px;
  border-radius:12px;
  border:2px solid #e5e7eb;
  background:#fff;
  cursor:pointer;
  user-select:none;
  vertical-align:middle;
  text-align:center;
  padding-top:6px;
  transition:border-color .2s, box-shadow .2s, background-color .2s;
}
.sl2-downvote:hover{ border-color:#dc2626; }
.sl2-downvote svg{
  width:16px; height:16px;
  fill:#374151;
  display:block;
  margin:0 auto 4px;
}
.sl2-downvote .sl2-downcount{
  margin:0;
  font-size:14px;
  font-weight:600;
  line-height:1;
  color:#374151;
}
.sl2-downvote.is-downvoted{
  border-color:#dc2626;
  box-shadow:0 0 0 2px #dc262633;
}
.sl2-downvote.is-downvoted svg{ fill:#dc2626; }
.sl2-downvote.is-downvoted .sl2-downcount{ color:#dc2626; }

/* Hidden bin for preloading the next iframe */
#iframe-preload-bin{
  position:absolute; width:0; height:0; overflow:hidden; left:-9999px; top:-9999px;
}


.discover-wrap {
  position: relative; /* parent context */
}

.discover-instructions {
  position: absolute;
  top: 0px;
  left: -100px; 
  width: 120px;
  font-size: 0.85rem;
  color: #444;
  border:1px solid #f1f1f1;
  padding:10px;
}

.discover-instructions div {
  margin-bottom: 8px;
}

.discover-instructions kbd {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.8rem;
  margin-right: 6px;
}

/* ========================================
   MOBILE RESPONSIVE - DISCOVER PAGE
   ======================================== */

/* Tablet (768px - 1079px) */
@media (max-width: 1079px) {
  .discover-topic-bar {
    width: calc(100% - 32px);
    margin: 16px 16px 0;
  }

  .discover-card {
    width: 100%;
    max-width: 100%;
    margin: 20px 16px;
  }

  /* Hide side elements on tablet */
  .discover-instructions {
    display: none;
  }

  .discover-card-notice {
    display: none;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  /* Topic filter bar - mobile */
  .discover-topic-bar {
    width: calc(100% - 16px);
    margin: 12px 8px 0;
    padding: 12px 14px;
  }

  .topic-bar-header {
    margin-bottom: 10px;
  }

  .topic-bar-label {
    font-size: 13px;
  }

  .topic-tags-row {
    gap: 6px;
    margin-bottom: 10px;
  }

  .topic-tag {
    padding: 5px 12px;
    font-size: 12px;
  }

  .topic-search-row {
    flex-direction: column;
    gap: 8px;
  }

  .topic-search-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .topic-search-btn {
    width: 100%;
    padding: 12px 18px;
    font-size: 15px;
  }

  .topic-categories-expanded {
    margin-top: 12px;
    padding-top: 12px;
  }

  .topic-category-section {
    margin-bottom: 12px;
  }

  .topic-category-name {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .topic-tag-sm {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Card - full width on mobile */
  .discover-card {
    width: calc(100% - 16px);
    margin: 12px 8px;
    padding: 16px;
  }

  /* Hide desktop-only elements */
  .discover-instructions {
    display: none;
  }

  .discover-card-notice {
    display: none;
  }

  /* Hero section - stack on very small screens if needed */
  .discover-hero {
    flex-wrap: wrap;
    gap: 10px;
  }

  .discover-ico {
    width: 40px;
    height: 40px;
  }

  .discover-title a {
    font-size: 15px;
  }

  .discover-sub {
    font-size: 13px;
  }

  /* Days ago badge */
  .discover-days_ago {
    top: 8px;
    right: 8px;
    font-size: 10px;
    padding: 2px 6px;
  }

  /* Screenshot viewport */
  .discover-shot {
    margin: 12px 0;
  }

  /* Description */
  .discover-desc {
    font-size: 14px;
    line-height: 1.5;
    height: auto; /* Allow to expand on mobile */
    max-height: 80px;
    overflow: hidden;
  }

  /* Actions row - row layout on mobile */
  .discover-actions {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    padding-top: 16px;
  }

  /* Vote group on mobile - single row with save on right */
  .vote-group {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  /* Larger vote buttons on mobile */
  .sl2-upvote,
  .sl2-downvote {
    width: 64px;
    height: 64px;
    padding-top: 10px;
  }

  .sl2-upvote svg,
  .sl2-downvote svg {
    width: 20px;
    height: 20px;
    margin-bottom: 6px;
  }

  .sl2-upvote .sl2-upcount,
  .sl2-downvote .sl2-downcount {
    font-size: 16px;
  }

  /* Save button - larger and on the right */
  .vote-group .save-btn {
    padding: 12px 20px;
    font-size: 16px;
    margin-left: auto;
  }

  /* Next Launch button - full width and larger */
  .discover-actions .discover-next {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-weight: 700;
  }

  /* Badges */
  .discover-badges {
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
  }

  .chip {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* Add mobile touch instructions at bottom */
  .mobile-discover-help {
    display: block;
    margin-top: 16px;
    padding: 12px;
    background: #f8f8fb;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    text-align: center;
  }
}

/* Desktop - hide mobile-only elements */
.mobile-discover-help {
  display: none;
}

/* ========================================
   PERSONALIZED INTERESTS UI
   ======================================== */


/* ========================================
   INTERESTS MODAL
   ======================================== */

.interests-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.interests-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.interests-modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.interests-modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #eee;
  position: relative;
}
.interests-modal-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: #111;
}
.interests-modal-header p {
  margin: 0;
  font-size: 14px;
  color: #666;
}
.interests-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #999;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.interests-modal-close:hover {
  background: #eee;
  color: #333;
}

.interests-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.interests-section {
  margin-bottom: 24px;
}
.interests-section:last-child {
  margin-bottom: 0;
}
.interests-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.interests-section-desc {
  font-size: 13px;
  color: #999;
  margin: -8px 0 12px;
}

.interests-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interest-chip {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  background: #f8f8fb;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.interest-chip:hover {
  border-color: #04b83c;
  color: #04b83c;
  background: #f0fff4;
}
.interest-chip.selected {
  background: #04b83c;
  color: #fff;
  border-color: #04b83c;
}
.interest-chip.selected:hover {
  background: #039d33;
  border-color: #039d33;
}

/* Custom Interests Input */
.custom-interest-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.custom-interest-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
}
.custom-interest-input:focus {
  outline: none;
  border-color: #04b83c;
  box-shadow: 0 0 0 2px rgba(4, 184, 60, 0.1);
}
.add-custom-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #04b83c;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.add-custom-btn:hover {
  background: #039d33;
}

.custom-interests-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.custom-interest-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #6366f1;
  border-radius: 20px;
}
.custom-interest-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}
.custom-interest-remove:hover {
  color: #fff;
}

/* Modal Footer */
.interests-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}
.clear-all-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.clear-all-btn:hover {
  color: #dc2626;
  border-color: #dc2626;
  background: #fff5f5;
}
.save-interests-btn {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #04b83c;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.save-interests-btn:hover {
  background: #039d33;
}

/* Modal Mobile Responsive */
@media (max-width: 767px) {
  /* Full screen modal on mobile */
  .interests-modal {
    align-items: stretch;
    padding: 0;
  }

  .interests-modal-backdrop {
    display: none;
  }

  .interests-modal-content {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Fixed header */
  .interests-modal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    padding-top: 60px;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid #eee;
  }
  .interests-modal-header h2 {
    font-size: 18px;
    padding-right: 50px;
  }

  /* Make close button larger and easier to tap */
  .interests-modal-close {
    width: 44px;
    height: 44px;
    font-size: 24px;
    top: 56px;
    right: 12px;
  }

  /* Scrollable body */
  .interests-modal-body {
    position: fixed;
    top: 130px;
    left: 0;
    right: 0;
    bottom: 70px;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 30px;
    -webkit-overflow-scrolling: touch;
  }

  /* Fixed footer */
  .interests-modal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #fafafa;
    border-top: 1px solid #eee;
    z-index: 10;
  }

  .interest-chip {
    padding: 6px 12px;
    font-size: 12px;
  }

  .custom-interest-input-row {
    flex-direction: column;
  }
  .add-custom-btn {
    width: 100%;
  }

  /* Footer buttons side by side */
  .clear-all-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  .save-interests-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

