/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Comic Sans MS", "Quicksand", "Nunito", "Trebuchet MS",
               "PingFang TC", "PingFang SC", "Hiragino Sans", "Microsoft JhengHei",
               "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #e8f5d8 0%, #fef0f4 50%, #fffaea 100%);
  color: #2d3142;
  min-height: 100vh;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: #1d6fb8; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: #d6336c;
  padding: 0.2rem 0.4rem;
  border-radius: 12px;
}
.brand:hover { background: #fff0f4; }
.brand-emoji { font-size: 1.7rem; }

.main-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; flex: 1; }
.main-nav button {
  background: #f3f9e7;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  color: #2d3142;
  font-size: 0.95rem;
  transition: transform 0.1s ease, background 0.15s;
}
.main-nav button:hover { background: #d8eeb2; }
.main-nav button:active { transform: scale(0.96); }
.main-nav button.active { background: #b9dd80; border-color: #6ab04c; }

.lang-picker select {
  padding: 0.5rem 0.8rem;
  border-radius: 14px;
  border: 2px solid #c8e6a0;
  background: #f3f9e7;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2c5e1a;
}

/* ---------- Main / views ---------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.section-title {
  font-size: 1.6rem;
  margin: 1.6rem 0 0.8rem;
  color: #2c5e1a;
}
.lead { font-size: 1.1rem; }

/* ---------- Buttons ---------- */
.btn {
  border: 0;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.2px;
  transition: transform 0.1s ease, box-shadow 0.15s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,0.08); }
.btn-primary { background: #d6336c; color: #fff; }
.btn-back {
  background: #f3f9e7;
  color: #2c5e1a;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border: 2px solid transparent;
}

/* ---------- Flower grid ---------- */
.flower-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.flower-card {
  background: #fff;
  border-radius: 22px;
  padding: 0.6rem;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  display: block;
  text-decoration: none;
}
.flower-card:hover {
  transform: translateY(-3px);
  border-color: #f0a6c4;
  box-shadow: 0 8px 18px rgba(0,0,0,0.1);
}
.flower-card .photo {
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f9e7;
  position: relative;
  margin-bottom: 0.5rem;
}
.flower-card .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.flower-card:hover .photo img { transform: scale(1.05); }
.flower-card .name {
  font-weight: 800;
  font-size: 1.05rem;
  color: #2c5e1a;
  margin: 0 0.2rem 0.2rem;
}
.flower-card .pronunciation {
  font-size: 0.85rem;
  color: #6c7a91;
  margin: 0 0.2rem 0.15rem;
  font-style: italic;
}
.flower-card .english-name {
  font-size: 0.85rem;
  color: #d6336c;
  margin: 0 0.2rem 0.15rem;
  font-weight: 700;
}
.flower-card .latin {
  font-size: 0.8rem;
  color: #6c7a91;
  font-style: italic;
  margin: 0 0.2rem 0.4rem;
}

/* ---------- Stats bar ---------- */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}
.stats-bar .stat {
  background: #fff;
  border-radius: 16px;
  padding: 0.55rem 1rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border-left: 5px solid #d6336c;
}
.stats-bar .stat:nth-child(2) { border-left-color: #6ab04c; }
.stats-bar .stat:nth-child(3) { border-left-color: #f9ca24; }
.stats-bar .stat-num {
  font-weight: 800;
  font-size: 1.6rem;
  color: #2c5e1a;
  line-height: 1;
}
.stats-bar .stat-label {
  font-size: 0.95rem;
  color: #6c7a91;
  font-weight: 600;
}

.filter-status {
  font-size: 0.95rem;
  color: #6c7a91;
  margin: -0.3rem 0 0.8rem;
  font-weight: 600;
}

/* ---------- Filter row ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin: 0.4rem 0 1rem;
}
.filter-row input[type="search"] {
  flex: 1 1 220px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 2px solid #c8e6a0;
  font-size: 1rem;
  background: #fff;
}
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  background: #fff;
  border: 2px solid #c8e6a0;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #2c5e1a;
}
.chip.active { background: #d6336c; border-color: #d6336c; color: #fff; }
.chip-yellow.active { background: #f9ca24; border-color: #f9ca24; color: #4a3500; }
.chip-blue.active { background: #686de0; border-color: #686de0; }
.chip-white.active { background: #6c7a91; border-color: #6c7a91; }
.chip-pink.active { background: #d6336c; border-color: #d6336c; }
.chip-other.active { background: #8a6d3b; border-color: #8a6d3b; }

/* ---------- Detail ---------- */
.flower-detail {
  background: #fff;
  border-radius: 26px;
  padding: 1.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.07);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}
.flower-detail .photo {
  aspect-ratio: 4/3;
  border-radius: 18px;
  overflow: hidden;
  background: #f3f9e7;
  position: relative;
}
.flower-detail .photo img { width: 100%; height: 100%; object-fit: cover; }
.flower-detail h1 {
  margin: 0 0 0.2rem;
  font-size: 2rem;
  color: #2c5e1a;
}
.flower-detail .pronunciation.big {
  font-style: italic;
  color: #6c7a91;
  font-size: 1.05rem;
  margin: 0.2rem 0 0.1rem;
}
.flower-detail .english-name.big {
  color: #d6336c;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0.1rem 0 0.1rem;
}
.flower-detail .latin {
  font-style: italic;
  color: #6c7a91;
  margin: 0 0 1rem;
}
.flower-detail .description { font-size: 1.1rem; }
.flower-detail .facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
}
.flower-detail .fact {
  background: #fff7e8;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
}
.flower-detail .fact-label {
  font-weight: 800;
  font-size: 0.8rem;
  color: #b35a00;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.1rem;
}
.flower-detail .where ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}
.flower-detail .where li { padding: 0.15rem 0; }
.flower-detail .photo-credit {
  font-size: 0.78rem;
  color: #6c7a91;
  margin-top: 0.3rem;
}
.flower-detail .photo-credit a { color: inherit; text-decoration: underline; }
.flower-detail .actions { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.flower-detail .learn-more {
  background: #6ab04c;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  display: inline-block;
}
.flower-detail .poison-warn {
  background: #ffe8e0;
  border-left: 5px solid #c2492f;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  margin-top: 0.8rem;
  font-weight: 700;
  color: #7a2a18;
}

/* ---------- Quiz ---------- */
.quiz-area {
  background: #fff;
  border-radius: 26px;
  padding: 1.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.07);
  text-align: center;
}
.quiz-photo {
  width: min(360px, 100%);
  aspect-ratio: 4/3;
  margin: 0 auto 1rem;
  border-radius: 18px;
  overflow: hidden;
  background: #f3f9e7;
}
.quiz-photo img { width: 100%; height: 100%; object-fit: cover; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; max-width: 480px; margin: 0 auto; }
.quiz-options button {
  background: #f3f9e7;
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 0.7rem 1rem;
  font-weight: 800;
  font-size: 1rem;
  color: #2c5e1a;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
  line-height: 1.2;
}
.quiz-options button .opt-pron {
  font-weight: 500;
  font-style: italic;
  color: #6c7a91;
  font-size: 0.85rem;
}
.quiz-options button small {
  font-weight: 600;
  color: #d6336c;
  font-size: 0.8rem;
}
.quiz-options button.right { background: #c7f0d8; border-color: #6ab04c; }
.quiz-options button.wrong { background: #ffd6d0; border-color: #d6336c; }
.quiz-options button:disabled { cursor: default; opacity: 0.85; }

.quiz-status { font-size: 1.1rem; margin: 0.5rem 0 1rem; font-weight: 700; color: #2c5e1a; }
.quiz-feedback { font-size: 1.4rem; font-weight: 800; min-height: 2rem; margin: 0.6rem 0; }
.quiz-feedback.correct { color: #2c8a5d; }
.quiz-feedback.wrong { color: #c2492f; }

.quiz-final {
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  font-size: 1.2rem;
}
.quiz-final .score-badge {
  background: #fff3c2;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-weight: 800;
  color: #8a6300;
  font-size: 1.6rem;
  box-shadow: inset 0 0 0 3px #ffd870;
}

/* ---------- Spots ---------- */
.spots-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0.6rem;
}
@media (max-width: 720px) {
  .spots-list { grid-template-columns: 1fr; }
}
.spot-card {
  background: #fff;
  border-radius: 22px;
  padding: 1rem 1.1rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border-top: 8px solid #6ab04c;
}
.spot-card:nth-child(3n) { border-top-color: #d6336c; }
.spot-card:nth-child(3n+1) { border-top-color: #f9ca24; }
.spot-card h3 {
  margin: 0 0 0.3rem;
  color: #2c5e1a;
  font-size: 1.15rem;
}
.spot-title-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.spot-title-link:hover {
  color: #d6336c;
  text-decoration: underline;
}
.spot-title-link .map-pin {
  font-size: 0.85em;
  opacity: 0.7;
}
.spot-card .region {
  font-size: 0.85rem;
  color: #6c7a91;
  margin-bottom: 0.4rem;
}
.spot-card p { margin: 0; }
.flowers-here-label {
  margin-top: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
  font-size: 0.78rem;
  color: #b35a00;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.flowers-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.flower-thumb {
  background: none;
  border: 0;
  padding: 0.3rem;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  border-radius: 12px;
  transition: transform 0.12s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}
.flower-thumb:hover {
  transform: translateY(-2px);
  background: #fff0f4;
}
.flower-thumb .photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: #f3f9e7;
  margin-bottom: 0.4rem;
  border: 3px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.flower-thumb .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.flower-thumb .thumb-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2c5e1a;
  line-height: 1.2;
  display: block;
}
.flower-thumb .thumb-pron {
  font-size: 0.78rem;
  font-style: italic;
  color: #6c7a91;
  line-height: 1.15;
  display: block;
  margin-top: 0.1rem;
}
.flower-thumb .photo.photo-fallback .fallback-emoji {
  font-size: 2rem;
}
.flower-detail .related-flowers {
  grid-column: 1 / -1;
  border-top: 2px dashed #f1e6d0;
  padding-top: 1rem;
  margin-top: 0.4rem;
}
.flower-detail .related-flowers .flowers-thumbs {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.flower-detail .related-flowers .flower-thumb .photo {
  width: 112px;
  height: 112px;
  margin-bottom: 0.5rem;
}
.flower-detail .related-flowers .flower-thumb .photo.photo-fallback .fallback-emoji {
  font-size: 2.6rem;
}
.flower-detail .related-flowers .flower-thumb .thumb-name {
  font-size: 1.05rem;
  line-height: 1.25;
}
.flower-detail .related-flowers .flower-thumb .thumb-pron {
  font-size: 0.88rem;
}
@media (max-width: 720px) {
  .flower-detail .related-flowers .flowers-thumbs {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- About ---------- */
.about-content {
  background: #fff;
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}
.about-content h2 { color: #2c5e1a; margin-top: 1rem; }
.about-content .warn {
  background: #fff3c2;
  border-left: 5px solid #f9ca24;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-weight: 700;
  color: #6b4e00;
}
.sources { padding-left: 1.2rem; }
.sources li { margin: 0.3rem 0; }
.small { font-size: 0.9rem; color: #6c7a91; margin-top: 1rem; }

/* ---------- Feedback ---------- */
.feedback-section {
  margin-top: 1.5rem;
  background: #fff;
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border-top: 8px solid #6ab04c;
}
.feedback-section h2 { margin: 0 0 0.4rem; color: #2c5e1a; }
.feedback-section .lead { margin-top: 0; }
.feedback-form { margin-top: 0.8rem; }
.feedback-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #e6e1d4;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: #2c5e1a;
  background: #fffbf2;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s;
}
.feedback-form textarea:focus {
  outline: none;
  border-color: #6ab04c;
  background: #fff;
}
.feedback-form .hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.feedback-form .cf-turnstile-mount { margin: 0.7rem 0; }
.feedback-form button[type="submit"] { margin-top: 0.5rem; }
.feedback-status {
  margin: 0.7rem 0 0;
  font-weight: 700;
  min-height: 1.2em;
}
.feedback-status.ok { color: #2c8a5d; }
.feedback-status.err { color: #c2492f; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 1.2rem;
  background: #fff;
  color: #6c7a91;
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* ---------- Photo fallback ---------- */
.photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-fallback img { display: none; }
.fallback-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}

/* ---------- Loading state ---------- */
.skeleton {
  background: linear-gradient(90deg, #f3f9e7 25%, #e1ecd0 50%, #f3f9e7 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ---------- Season badge (in bloom this month) ---------- */
.season-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  line-height: 1.3;
  vertical-align: middle;
  background: #d8eeb2;
  color: #2c5e1a;
  border: 1px solid #6ab04c;
}
.flower-card .photo .season-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  background: rgba(216, 238, 178, 0.95);
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ---------- Status tag (poison) ---------- */
.flower-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  line-height: 1.3;
  vertical-align: middle;
}
.flower-tag--poison {
  background: #ffe8e0;
  color: #7a2a18;
  border: 1px solid #f1a48a;
}
.flower-card .photo .flower-tag,
.flower-detail .photo .flower-tag {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  background: rgba(255, 232, 224, 0.95);
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.flower-link-list .flower-tag {
  margin-left: 0.4rem;
  font-size: 0.65rem;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 1rem 0;
  font-size: 0.9rem;
}
.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: #555;
}
.breadcrumb li + li::before {
  content: "›";
  margin-right: 0.4rem;
  color: #999;
}
.breadcrumb a { color: #1d6fb8; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: #2d3142; font-weight: 700; }

/* ---------- Static SSR fallback content (crawler-friendly) ---------- */
.flower-link-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.4rem 1rem;
}
.flower-link-list li {
  background: #fff7e8;
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font-size: 0.95rem;
}
.flower-link-list a {
  color: #2c5e1a;
  text-decoration: none;
}
.flower-link-list a:hover { text-decoration: underline; }
.flower-link-list em { color: #777; font-size: 0.85rem; }

.related-flowers-static, .flower-spots-static {
  grid-column: 1 / -1;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #d6cdb8;
}
.related-flowers-static h2, .flower-spots-static h2 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  color: #b35a00;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.noscript-fallback {
  background: #fff;
  border: 2px dashed #c8e6a0;
  border-radius: 16px;
  padding: 1.2rem;
  margin-top: 2rem;
}
.noscript-fallback h2 { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .flower-detail { grid-template-columns: 1fr; }
  .flower-detail h1 { font-size: 1.5rem; }
  .quiz-options { grid-template-columns: 1fr; }
  .main-nav { order: 3; width: 100%; }
  .lang-picker { margin-left: auto; }
  .flower-link-list { grid-template-columns: 1fr; }
}
