/* ==========================================================================
   FLaiCMS Mobile Official Website Design System
   Exact visual match with PC Official Portal:
   - Primary: #175448 (Forest Emerald Green)
   - Deep: #173f36 (Deep Pine Green)
   - Gold Accent: #c3a35b (Village Gold)
   - Ink: #253c33 (Deep Forest Ink for Typography)
   - Muted: #60736b (Secondary Muted Green)
   - Mist: #eef4ef (Soft Rural Mist Background)
   - Line: #dce7df (Light Organic Border)
   - White: #ffffff
   ========================================================================== */

:root {
  --green: #175448;
  --green-hover: #124339;
  --deep: #173f36;
  --gold: #c3a35b;
  --gold-light: rgba(195, 163, 91, 0.12);
  --ink: #253c33;
  --muted: #60736b;
  --mist: #eef4ef;
  --mist-light: #f7faf8;
  --line: #dce7df;
  --line-light: #e8f0eb;
  --white: #ffffff;

  /* Surfaces & Backgrounds (Exact Light Aesthetic matching PC) */
  --bg-page: #f7faf8;
  --bg-card: #ffffff;
  --bg-card-solid: #ffffff;
  --bg-card-hover: #f9fcf9;
  --bg-glass: rgba(255, 255, 255, 0.94);
  --bg-input: #ffffff;

  /* Hairlines & Borders */
  --border-color: #dce7df;
  --border-glow: rgba(23, 84, 72, 0.25);

  /* Primary Brand Aliases */
  --primary: var(--green);
  --primary-hover: var(--green-hover);
  --primary-light: rgba(23, 84, 72, 0.08);
  --primary-glow: rgba(23, 84, 72, 0.18);
  --accent-cyan: #175448;
  --accent-blue: #1e5f74;
  --accent-emerald: #175448;
  --accent-amber: #c3a35b;

  /* Typography Colors */
  --text-main: var(--ink);
  --text-deep: var(--deep);
  --text-muted: var(--muted);
  --text-dim: #8b9d95;
  --text-white: #ffffff;

  /* Layout Constants */
  --header-h: 56px;
  --bottom-bar-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(23, 84, 72, 0.05);
  --shadow-card: 0 4px 18px rgba(23, 84, 72, 0.07);
  --shadow-card-hover: 0 8px 26px rgba(23, 84, 72, 0.12);
  --shadow-glow: 0 0 24px -4px rgba(23, 84, 72, 0.2);
  --shadow-dock: 0 -3px 18px rgba(23, 84, 72, 0.08);

  --serif: 'Noto Serif CJK SC', 'Source Han Serif SC', 'Songti SC', SimSun, serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Reset & Mobile Ergonomics */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.65;
  min-height: 100vh;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--bottom-bar-h) + var(--safe-bottom) + 24px);
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse 90% 45% at 50% -10%, rgba(23, 84, 72, 0.06), transparent 75%),
    radial-gradient(circle 350px at 100% 30%, rgba(195, 163, 91, 0.05), transparent 80%),
    radial-gradient(circle 320px at 0% 70%, rgba(23, 84, 72, 0.04), transparent 80%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: none;
}

/* Container */
.m-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ==================== Header ==================== */
.m-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 1000;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 10px rgba(23, 84, 72, 0.04);
}

.m-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0 16px;
}

.m-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.m-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

.m-brand-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--deep);
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.m-brand-title small {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.m-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--mist);
  border: 1px solid var(--line);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m-icon-btn:active {
  background: var(--line);
  transform: scale(0.95);
}

/* ==================== Off-Canvas Drawer ==================== */
.m-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1099;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.m-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.m-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 82%;
  max-width: 340px;
  height: 100%;
  background: #ffffff;
  border-left: 1px solid var(--line);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(23, 84, 72, 0.12);
}

.m-drawer.active {
  transform: translateX(0);
}

.m-drawer-header {
  height: var(--header-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--mist-light);
}

.m-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
}

.m-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.m-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.m-drawer-item svg {
  color: var(--green);
  flex-shrink: 0;
}

.m-drawer-item.active,
.m-drawer-item:active {
  background: var(--mist);
  color: var(--green);
  font-weight: 700;
}

.m-drawer-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.m-drawer-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--mist-light);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ==================== Search Modal ==================== */
.m-search-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1200;
  display: none;
  align-items: flex-start;
  padding: 20px 16px;
}

.m-search-modal.active {
  display: flex;
}

.m-search-card {
  width: 100%;
  max-width: 480px;
  margin: 30px auto 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 16px 40px rgba(23, 84, 72, 0.18);
  animation: mScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.m-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--mist);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.m-search-input-wrap input {
  flex: 1;
  color: var(--ink);
  font-size: 15px;
}

.m-search-input-wrap input::placeholder {
  color: var(--muted);
}

/* ==================== Hero Section ==================== */
.m-hero {
  padding: 28px 16px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(23, 84, 72, 0.08) 0%, rgba(238, 244, 239, 0.5) 100%);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.m-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(23, 84, 72, 0.08);
  border: 1px solid rgba(23, 84, 72, 0.2);
  color: var(--green);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.m-hero-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--deep);
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 6px;
  font-family: var(--serif);
}

.m-hero-tagline {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 12px;
}

.m-hero-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 22px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.m-hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}

.m-hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.m-feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 4px rgba(23, 84, 72, 0.04);
}

.m-feature-tag svg {
  color: var(--green);
}

/* ==================== Buttons ==================== */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.m-btn-primary {
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(23, 84, 72, 0.25);
}

.m-btn-primary:active {
  background: var(--green-hover);
  transform: translateY(1px);
}

.m-btn-secondary {
  background: var(--mist);
  color: var(--green);
  border: 1px solid var(--line);
}

.m-btn-secondary:active {
  background: var(--line);
}

.m-btn-gold {
  background: var(--gold);
  color: #ffffff;
}

.m-btn-block {
  width: 100%;
}

.m-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* ==================== Grid Nav (King Kong 8 Grid) ==================== */
.m-grid-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 10px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.m-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease;
}

.m-grid-item:active {
  transform: scale(0.95);
}

.m-grid-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.m-grid-icon-green { background: linear-gradient(135deg, #175448 0%, #237464 100%); }
.m-grid-icon-gold { background: linear-gradient(135deg, #c3a35b 0%, #d8b874 100%); }
.m-grid-icon-deep { background: linear-gradient(135deg, #173f36 0%, #20574a 100%); }
.m-grid-icon-blue { background: linear-gradient(135deg, #1e5f74 0%, #2b7d99 100%); }
.m-grid-icon-teal { background: linear-gradient(135deg, #146152 0%, #1c7c69 100%); }
.m-grid-icon-amber { background: linear-gradient(135deg, #b8860b 0%, #d4af37 100%); }

.m-grid-label {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

/* ==================== Section Cards & Headers ==================== */
.m-section {
  margin-bottom: 24px;
}

.m-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.m-section-title {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--green);
  border-radius: 2px;
}

.m-section-more {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Card Style */
.m-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.m-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* ==================== Article & News Item ==================== */
.m-article-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.m-article-item:active {
  background: var(--mist-light);
  border-color: var(--green);
}

.m-article-thumb {
  width: 90px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--mist);
}

.m-article-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.m-article-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--deep);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.m-article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ==================== Product / Shop Card ==================== */
.m-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.m-product-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.m-product-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--mist);
}

.m-product-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.m-product-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--deep);
  margin-bottom: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-product-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--green);
  margin-top: 4px;
}

/* ==================== App Store Style Item ==================== */
.m-app-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.m-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--mist);
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.m-app-info {
  flex: 1;
  min-width: 0;
}

.m-app-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--deep);
  margin-bottom: 2px;
}

.m-app-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== Detail Pages Typography ==================== */
.m-detail-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.m-detail-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--deep);
  line-height: 1.35;
  margin-bottom: 8px;
  font-family: var(--serif);
}

.m-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--muted);
}

.m-detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.m-rich-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  word-break: break-word;
}

.m-rich-text p {
  margin-bottom: 16px;
}

.m-rich-text img {
  border-radius: var(--radius-md);
  margin: 16px 0;
  border: 1px solid var(--line);
}

.m-rich-text h2, .m-rich-text h3 {
  font-family: var(--serif);
  color: var(--deep);
  margin: 20px 0 10px;
  font-weight: 700;
}

/* ==================== Form Controls ==================== */
.m-form-group {
  margin-bottom: 16px;
}

.m-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.m-input, .m-textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.m-input:focus, .m-textarea:focus {
  border-color: var(--green);
  outline: none;
  background: var(--mist-light);
}

.m-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ==================== Bottom Native App Dock ==================== */
.m-dock-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: var(--shadow-dock);
}

.m-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  width: 20%;
  height: 100%;
  transition: all 0.15s ease;
}

.m-dock-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.m-dock-item span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.m-dock-item.active {
  color: var(--green);
  font-weight: 700;
}

.m-dock-item.active svg {
  transform: translateY(-2px);
}

/* ==================== Mobile Modals (Download & WeChat) ==================== */
.m-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.m-modal-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 26px 22px;
  box-shadow: 0 20px 50px rgba(23, 84, 72, 0.2);
  text-align: center;
  animation: mModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mModalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.m-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mist);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.m-modal-close:active {
  background: var(--line);
  color: var(--deep);
}

/* Badges */
.m-badge-vip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(195, 163, 91, 0.12);
  color: #b8860b;
  border: 1px solid rgba(195, 163, 91, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

.m-badge-green {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--mist);
  color: var(--green);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

/* Toast Message */
.m-toast {
  position: fixed;
  bottom: calc(var(--bottom-bar-h) + var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--deep);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(23, 84, 72, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 99999;
  white-space: nowrap;
}

.m-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
