/* === Kei-Yuen Chinese Chess — Website Shared Styles === */

:root {
  --red-deep: #8b1a1a;
  --red-primary: #b22222;
  --red-light: #d4453a;
  --gold: #c9a84c;
  --gold-light: #e8d5a3;
  --wood: #d4a76a;
  --wood-light: #f0e0c0;
  --wood-bg: #faf5eb;
  --text: #2c1810;
  --text-secondary: #5a4030;
  --bg: #fdf8f0;
  --surface: #ffffff;
  --border: #e0d0b8;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(44,24,16,0.08);
  --shadow-hover: 0 4px 20px rgba(44,24,16,0.15);
  --font: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* === Language Toggle === */
body[data-lang="zh"] [data-lang-en] { display: none !important; }
body[data-lang="en"] [data-lang-zh] { display: none !important; }

/* === Navigation === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253,248,240,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--red-deep);
  font-weight: 700;
  font-size: 1.15rem;
}
.navbar-brand svg { flex-shrink: 0; }
.lang-switch {
  background: var(--red-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
  font-weight: 500;
}
.lang-switch:hover { background: var(--red-deep); }

/* === Container === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* === Section === */
.section {
  padding: 1.75rem 0;
}
.section + .section {
  border-top: 1px solid var(--border);
}
.section-title {
  font-size: 1.75rem;
  color: var(--red-deep);
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 2rem 2rem 1.5rem;
  background: linear-gradient(180deg, var(--wood-bg) 0%, var(--bg) 100%);
}
.hero-icon {
  width: 110px;
  height: 110px;
  margin: 0 auto 0.75rem;
}
.hero-title {
  font-size: 2.2rem;
  color: var(--red-deep);
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}
.hero-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.hero-link-primary {
  background: var(--red-primary);
  color: #fff;
}
.hero-link-primary:hover {
  background: var(--red-deep);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(178,34,34,0.3);
}
.hero-link-secondary {
  background: var(--surface);
  color: var(--red-deep);
  border: 1px solid var(--border);
}
.hero-link-secondary:hover {
  border-color: var(--red-primary);
  background: #fff5f5;
}

/* === Feature Cards === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
}
.feature-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--gold);
}
.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
.feature-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--red-deep);
  margin-bottom: 0.4rem;
}
.feature-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Screenshots === */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}
.screenshot-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
}
.screenshot-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.screenshot-item img {
  width: 100%;
  display: block;
  transition: transform var(--transition);
}
.screenshot-item:hover img {
  transform: scale(1.03);
}
.screenshot-caption {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* === System Requirements === */
.req-table {
  width: 100%;
  max-width: 600px;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.req-table th,
.req-table td {
  padding: 0.75rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.req-table th {
  background: var(--wood-bg);
  font-weight: 600;
  color: var(--red-deep);
  width: 35%;
}
.req-table tr:last-child td,
.req-table tr:last-child th { border-bottom: none; }

/* === Quick Start Steps === */
.steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 700px;
}
.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 2px;
}
.step-text {
  font-size: 0.95rem;
  line-height: 1.6;
}
.step-text strong { color: var(--red-deep); }

/* === Privacy === */
.privacy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
}
.privacy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.privacy-card h4 {
  font-size: 0.95rem;
  color: var(--red-deep);
  margin-bottom: 0.75rem;
}
.privacy-card ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.privacy-card li { margin-bottom: 0.3rem; }

/* === FAQ === */
.faq-list {
  max-width: 750px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.faq-item.open { border-color: var(--gold); }
.faq-question {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 0.95rem;
  user-select: none;
  transition: background var(--transition);
}
.faq-question:hover { background: var(--wood-bg); }
.faq-arrow {
  font-size: 0.8rem;
  transition: transform var(--transition);
  color: var(--text-secondary);
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}
.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 1.25rem 1rem;
}
.faq-answer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* === Public Welfare Board === */
.welfare-section {
  background: linear-gradient(180deg, var(--wood-bg) 0%, var(--bg) 100%);
}
.welfare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.welfare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
}
.welfare-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--gold);
}
.welfare-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.welfare-card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--red-deep);
  margin: 0;
}
.welfare-card-icon {
  font-size: 1.4rem;
}
.welfare-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.welfare-card ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.welfare-card li { margin-bottom: 0.2rem; }
.welfare-contact {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--wood-bg);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--red-deep);
  font-weight: 500;
}

/* === Donate / Buy Me a Coffee === */
.donate-section {
  background: linear-gradient(180deg, var(--bg) 0%, var(--wood-bg) 100%);
}
.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 720px;
}
.donate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition);
}
.donate-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
  border-color: var(--gold);
}
.donate-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--red-deep);
  margin-bottom: 0.5rem;
}
.donate-card img {
  width: 240px;
  height: 240px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f8f8f8;
}
.donate-placeholder {
  width: 240px;
  height: 240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  background: #fafafa;
}

/* === Footer === */
.footer {
  background: var(--red-deep);
  color: var(--gold-light);
  padding: 2.5rem 2rem;
  text-align: center;
}
.footer a {
  color: var(--gold);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }
.footer-dev {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.footer-contact {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.footer-copy {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 1rem;
}

/* === Lightbox === */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.active {
  display: flex;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* === Responsive === */
@media (max-width: 768px) {
  .hero { padding: 1.5rem 1.25rem 1.25rem; }
  .hero-title { font-size: 1.8rem; }
  .hero-desc { font-size: 1rem; }
  .section { padding: 1.5rem 0; }
  .section-title { font-size: 1.4rem; }
  .container { padding: 0 1.25rem; }
  .navbar { padding: 0 1.25rem; }
  .features-grid,
  .screenshots-grid,
  .welfare-grid { grid-template-columns: 1fr; }
  .donate-grid { grid-template-columns: 1fr; }
  .donate-card img,
  .donate-placeholder { width: 200px; height: 200px; }
  .md-content {
    padding: 1rem;
    font-size: 0.9rem;
  }
  .md-content th,
  .md-content td {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
  }
  .md-content pre {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.5rem; }
  .hero-links { flex-direction: column; align-items: center; }
  .navbar-brand span { font-size: 0.95rem; }
}

/* === App Icon Styles === */
.navbar-logo {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.hero-icon img {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(139,26,26,0.15);
}

/* === Markdown Content (download page) === */
.md-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  line-height: 1.8;
}
.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4 {
  color: var(--red-deep);
  margin: 1.25em 0 0.5em;
  line-height: 1.3;
}
.md-content h1 { font-size: 1.5rem; }
.md-content h2 { font-size: 1.3rem; }
.md-content h3 { font-size: 1.15rem; }
.md-content h4 { font-size: 1rem; }
.md-content h3:first-child,
.md-content h2:first-child,
.md-content h1:first-child { margin-top: 0; }
.md-content p { margin: 0.75em 0; font-size: 0.95rem; }
.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.md-content th,
.md-content td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.md-content th {
  background: var(--wood-bg);
  font-weight: 600;
  color: var(--red-deep);
}
.md-content tr:last-child td { border-bottom: none; }
.md-content tr:hover td { background: rgba(250,245,235,0.5); }
.md-content code {
  background: var(--wood-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}
.md-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}
.md-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}
.md-content blockquote {
  border-left: 4px solid var(--gold);
  background: var(--wood-bg);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.md-content blockquote p { margin: 0.25em 0; }
.md-content a {
  color: var(--red-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}
.md-content a:hover { border-bottom-color: var(--red-primary); }
.md-content ul,
.md-content ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}
.md-content li { margin-bottom: 0.3rem; }
.md-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* === Footer Nav (download page) === */
.footer-nav {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}
.footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--red-deep);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.footer-nav a:hover {
  border-color: var(--red-primary);
  background: #fff5f5;
}
