/* === Stardew Valley Gift Guide === */

:root {
  --love: #e74e85;
  --love-bg: #ffe0e9;
  --like: #3a9d6e;
  --like-bg: #e7f4ee;
  --dislike: #c8861f;
  --dislike-bg: #fbeed4;
  --hate: #b04a4a;
  --hate-bg: #f7e0e0;
  --neutral: #7a7a9b;
}

main { max-width: 820px; }

/* --- Tabs (self-contained) --- */
.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.45rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--ink); background: var(--pick-bg); transform: none; border-color: transparent; }
.tab.picked { background: var(--pick-bg); border-color: var(--pick-border); color: var(--primary-dark); }

.gift-search {
  width: 100%;
  padding: 0.7rem 0.95rem;
  margin-bottom: 1rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  font: inherit;
  background: var(--card);
  transition: border-color 0.15s ease;
}
.gift-search:focus { outline: none; border-color: var(--primary); }

/* --- Villager grid --- */
.villager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}
.villager-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--btn);
  cursor: pointer;
  transition: all 0.15s ease;
}
.villager-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.villager-btn.picked { border-color: var(--pick-border); background: var(--pick-bg); box-shadow: var(--shadow); }
.villager-btn .v-name {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.villager-btn .v-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.cand-heart { color: var(--love); }
.empty-note { color: var(--muted); text-align: center; padding: 1.5rem 0; grid-column: 1 / -1; }

/* --- Villager detail --- */
.detail-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.25rem 0 1.1rem;
}
.detail-head h2 {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 2rem;
  color: var(--primary-dark);
}
.detail-bday { color: var(--muted); font-size: 0.95rem; }
.cand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--love);
  background: var(--love-bg);
  border: 1px solid var(--love);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
}
.link-back {
  background: none;
  border: none;
  padding: 0.2rem 0;
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  width: auto;
}
.link-back:hover { color: var(--primary-dark); transform: none; border: none; }

.tier {
  background: var(--card);
  border: 2px solid var(--border);
  border-left: 6px solid var(--t-accent, var(--border));
  border-radius: 16px;
  padding: 0.95rem 1.1rem 1.05rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}
.tier.love   { --t-accent: var(--love); }
.tier.like   { --t-accent: var(--like); }
.tier.dislike{ --t-accent: var(--dislike); }
.tier.hate   { --t-accent: var(--hate); }

.tier-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.tier-emoji { font-size: 1.25rem; }
.tier-title {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--t-accent);
}
.tier-pts { color: var(--muted); font-size: 0.8rem; font-weight: 600; margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--t-bg, #f4f4f8);
  color: var(--t-accent, var(--ink));
  border: 1.5px solid transparent;
}
.tier.love .chip   { --t-bg: var(--love-bg); }
.tier.like .chip   { --t-bg: var(--like-bg); }
.tier.dislike .chip{ --t-bg: var(--dislike-bg); }
.tier.hate .chip   { --t-bg: var(--hate-bg); }

/* a gift this villager feels differently about than the universal default */
.chip.chip-exc { border-color: var(--t-accent); border-style: dashed; }
.chip-note {
  font-weight: 600;
  font-size: 0.72em;
  opacity: 0.75;
  margin-left: 0.35rem;
  white-space: nowrap;
}

.gf-exc-head {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.uni-exc {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}
.uni-exc-head {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t-accent, var(--muted));
}
.uni-exc-list { margin: 0; padding: 0; list-style: none; }
.uni-exc-list li {
  font-size: 0.86rem;
  color: var(--muted);
  padding: 0.18rem 0;
  line-height: 1.45;
}
.uni-exc-list strong { color: var(--ink); font-weight: 700; }
.uni-exc-name {
  color: var(--t-accent, var(--primary-dark));
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.uni-exc-name:hover { color: var(--primary-dark); }

.rules { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.rules li {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.12rem 0 0.12rem 1rem;
  position: relative;
  line-height: 1.4;
}
.rules li::before { content: "+"; position: absolute; left: 0; color: var(--t-accent); font-weight: 700; }
.tier-empty { color: var(--muted); font-size: 0.88rem; font-style: italic; }

/* --- Gift finder results --- */
.gf-hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.suggest .pill { padding: 0.34rem 0.8rem; font-size: 0.85rem; }

.gf-item {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin: 0.5rem 0 0.2rem;
}
.gf-universal {
  display: inline-block;
  margin-bottom: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--t-bg, #f4f4f8);
  color: var(--t-accent, var(--ink));
}
.gf-group { margin-bottom: 0.7rem; }
.gf-group .tier-head { margin-bottom: 0.45rem; }
.gf-none { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.gf-note { color: var(--muted); font-size: 0.82rem; margin-top: 1rem; line-height: 1.45; }

footer .src { color: var(--muted); }

/* --- Favorites grid (alphabetized, expandable) --- */
.lm-universal { margin-bottom: 1.1rem; }

.fav-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.fav-item {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.fav-item.open { border-color: var(--love); }
.fav-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}
.fav-head:hover { background: var(--love-bg); }
.fav-caret {
  color: var(--love);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}
.fav-item.open .fav-caret { transform: rotate(90deg); }
.fav-name { flex: 1 1 auto; text-align: left; }
.fav-count {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--love);
  background: var(--love-bg);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}
.fav-body { padding: 0 0.85rem 0.75rem; }
.fav-body .chip { background: var(--love-bg); color: var(--love); }

@media (max-width: 500px) {
  .villager-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .detail-head h2 { font-size: 1.6rem; }
  .tab { min-width: 0; font-size: 0.9rem; }
}

/* --- Print button --- */
.print-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--btn);
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.print-btn:hover { border-color: var(--primary); color: var(--primary-dark); }

@media print {
  .crumb, .tabs, .gift-search, .gf-hint, .suggest,
  .link-back, .print-btn, footer { display: none !important; }
  body {
    background: #fff !important;
    padding: 0.3rem 0 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  main { max-width: none !important; }
  .header { margin-bottom: 0.4rem; }
  h1, .subtitle { color: #000; }
  .villager-grid { display: grid !important; }
  .villager-btn, .tier, .detail-head {
    box-shadow: none !important;
    break-inside: avoid;
  }
}
