/* ============================================
   FruitMod — Cleaned stylesheet (style.css)
   Preserves original layout/visuals, removes
   duplicates, and fixes inconsistent rules.
   ============================================ */

/* Font */
@font-face {
  font-family: 'Teletactile';
  src: url('Teletactile-3zavL.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Variables */
:root {
  --bg: #0f0f10;
  --panel: #111214;
  --muted: #6f6f6f;
  --accent: #8fda66;
  --white: #ffffff;
  --gap: 18px;
  /* no banner variables in default build */
}

/* Reset & base */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: 'Teletactile', monospace;
  background: linear-gradient(#0b0b0b, #111214 60%);
  color: var(--white);
  overflow-x: hidden; /* prevent horizontal scroll */
}

/* Content container scrolls (keeps header/footer fixed) */
#content {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 150px;   /* space for fixed header */
  padding-bottom: 110px; /* space for bottom nav */
  min-height: calc(100vh - 260px);
}

/* Top fixed header */
.top-fixed {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  background: var(--panel);
  z-index: 20;
  padding: 14px 12px;
  border-bottom: 2px solid #222;
  text-align: center;
}

.title {
  margin: 0;
  font-size: 28px;
  letter-spacing: 4px;
}

/* Search */
.search-row {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.search-row input {
  width: 70%;
  max-width: 520px;
  padding: 10px;
  border: 2px solid #333;
  background: #1b1b1b;
  color: var(--white);
  font-family: inherit;
}
.search-row button {
  padding: 10px 14px;
  border: 2px solid #333;
  background: #0b0b0b;
  color: var(--white);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease-in-out;
}

/* Grid */
.grid {
  width: 94%;
  margin: 0 auto;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Make guides cards slightly taller (20% taller than standard card media area) */
.guides-card img {
  aspect-ratio: 2 / 1; /* width:height = 2 -> taller media than normal cards */
}

/* Card */
.card {
  background: #070707;
  border: 3px solid #222;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  outline: none;
  transition: transform 0.12s ease-in-out;
}
.card img {
  width: 100%;
  /* Make card/media area ~30% less tall than 5:3. Using width/height = 12/5 (~2.4)
     results in height = ~41.67% of width (vs 60% for 5:3). */
  aspect-ratio: 12 / 5;
  height: auto; /* let aspect-ratio determine height */
  object-fit: cover;
  display: block;
}

/* Guide-specific override: make guides slightly taller than normal cards
   This rule is placed after the generic .card img rule so it takes precedence. */
.card.guides-card img {
  aspect-ratio: 2 / 1;
}
.card .label {
  background: #0f0f10;
  padding: 12px;
  text-align: center;
  font-size: 18px;
  letter-spacing: 2px;
}

/* Coming soon */
.coming-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--muted);
}

/* Utility */
.hidden { display: none !important; pointer-events: none !important; }

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(#0b0b0b, #0b0b0b 40%);
  padding: 18px 10px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 2px solid #222;
  z-index: 30;
}
.nav-item {
  background: transparent;
  border: 0;
  color: var(--white);
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 2px;
  opacity: 0.8;
  cursor: pointer;
  padding: 6px 8px;
  transition: transform 0.1s ease-in-out;
}
.nav-item { position: relative; }
.nav-item.active { color: var(--accent); opacity: 1; }

/* Modal (backdrop + panel) */
.modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
  pointer-events: auto;
  transition: background 0.3s ease-in-out;
}

/* panel slides from bottom */
.modal-panel {
  width: 100%;
  max-width: 900px;
  /* Make the panel adapt to viewport height so it always fits on screen
     (keeps slide-from-bottom animation while preventing overflow on tall devices) */
  height: auto;
  max-height: calc(100vh - 40px);
  background: var(--panel);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border: 3px solid #222;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(.22,.9,.32,1);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

/* when modal receives .show, slide panel up */
.modal.show .modal-panel {
  transform: translateY(0);
}

/* Close button */
.modal-close {
  position: absolute;
  right: 16px;
  /* Keep the close button inside the panel so it doesn't get clipped on tall aspect devices */
  top: 8px;
  background: transparent;
  border: 0;
  color: var(--white);
  font-size: 60px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease-in-out;
}

/* Title (keeps previous visual style) */
.modal-title {
  width: 100%;
  padding: 14px;
  background: linear-gradient(#222, #111);
  text-align: center;
  font-size: 26px;
  letter-spacing: 4px;
  color: var(--white);
  margin: 0;
}

/* Modal image banner */
.modal-image {
  width: 100%;
  height: auto;
  /* reduce max image height so modal content fits inside max-height on tall screens */
  max-height: 40vh;
  object-fit: contain;
  display: block;
  border-bottom: 3px solid #222;
}

/* Guide modal: make description fill remaining space and scroll */
#guideModal .modal-panel .description {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  max-height: none;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
}

/* Meta row (size/type/like) */
.meta-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #151515;
  border-bottom: 2px solid #222;
}
.meta-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 18px;
}
.icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}

/* Description area: scrollable, centered */
.description {
  padding: 12px 18px;
  font-size: 16px;
  text-align: center;
  white-space: pre-wrap;
  /* Let description grow and scroll within the constrained modal panel */
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #e1e1e1;
  overflow-y: auto;
}
.icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}

/* Description area: scrollable, centered */
.description {
  padding: 12px 18px;
  font-size: 16px;
  text-align: center;
  white-space: pre-wrap;
  flex: 0 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #e1e1e1;
  overflow-y: auto;
  max-height: 20%;
}

/* Download CTA + Ad area: stacked & responsive */
.download-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(#0b0b0b, #121212);
  padding: 22px;
  border-top: 2px solid #222;
  gap: 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  text-decoration: none;
  padding: 18px 36px;
  font-size: 28px;
  border-radius: 8px;
  border: 4px solid #333;
  background: #0b0b0b;
  color: var(--white);
  transition: transform 0.1s ease-in-out;
}

/* small ad icon inside the download button */
.download-ad-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: inline-block;
}

/* counter text like 0/1 */
.download-counter {
  font-size: 18px;
  color: var(--muted);
  background: transparent;
  padding-left: 6px;
}

/* red notice under the download button */
.download-notice {
  margin-top: 10px;
  color: #ff6b6b; /* red */
  text-align: center;
  font-size: 14px;
  max-width: 720px;
}

/* red badge for the guides nav item */
.nav-badge {
  display: inline-block;
  background: #ff4d4d;
  color: white;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 8px;
}

/* Updates list styling */
.updates-list {
  width: 94%;
  margin: 16px auto 80px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.update-item {
  background: #0b0b0b;
  border: 2px solid #222;
  padding: 12px 14px;
  border-radius: 8px;
}
.update-head { display: flex; align-items: baseline; gap: 12px; }
.update-item .version, .update-item .update-version { font-weight: 700; color: var(--accent); margin-right: 8px; }
.update-date { font-size: 12px; color: var(--muted); }
.update-item .notes { display: block; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }

/* Year header for grouped updates */
.updates-year {
  width: 94%;
  margin: 18px auto 6px auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Ad placeholders removed */

/* (Banner removed) */
/* Responsive tweaks */
@media (max-width: 420px) {
  .modal-image { height: 34vh; object-fit: cover; }
  .modal-panel { height: 80vh; }
  .title { font-size: 24px; }
  .search-row input { width: 65%; }
  .bottom-nav { padding: 12px 6px; }
  .nav-item { font-size: 16px; padding: 4px 6px; }
  .download-btn { font-size: 22px; padding: 14px 28px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 320px) {
  .grid { gap: 10px; }
  .search-row input { width: 60%; }
  .title { font-size: 22px; }
}
/* Make ad cards identical to mod cards */
/* Ad-related styles removed */