/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --accent: #fbbc04;
  --dark: #0d1117;
  --dark2: #161b22;
  --dark3: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.2rem; font-weight: 700; color: var(--text);
  text-decoration: none;
}
.logo-icon { font-size: 1.4rem; }
.logo strong { color: var(--primary); }
nav { display: flex; gap: 24px; }
nav a {
  color: var(--text-muted); text-decoration: none;
  font-size: .9rem; font-weight: 500;
  transition: color .2s;
}
nav a:hover { color: var(--text); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
  padding: 80px 0 60px;
  min-height: calc(100vh - 60px);
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 70% 50%, rgba(26,115,232,.12), transparent);
  pointer-events: none;
}
.hero-inner { display: flex; flex-direction: column; gap: 32px; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.15; }
.accent { color: var(--primary); }
.hero-sub { font-size: 1.1rem; color: var(--text-muted); max-width: 560px; margin-top: 12px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.badge {
  background: var(--dark3); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px; font-size: .82rem; color: var(--text-muted);
}
.btn-primary {
  display: inline-block; margin-top: 24px;
  background: var(--primary); color: #fff;
  padding: 12px 28px; border-radius: 8px;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: background .2s, transform .15s;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.hero-stats {
  display: flex; gap: 32px; margin-top: 8px;
}
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.5rem; color: var(--text); }
.stat span { font-size: .8rem; color: var(--text-muted); }

/* ===== Calculator Section ===== */
.calc-section { padding: 60px 0; background: var(--dark2); }
.calc-wrapper {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  align-items: start;
}

/* macOS-style chrome */
.calc-chrome {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  background: #1c1c1e;
}
.calc-chrome-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: #2c2c2e;
  border-bottom: 1px solid #3a3a3c;
}
.chrome-dot {
  width: 12px; height: 12px; border-radius: 50%;
}
.chrome-dot.red    { background: #ff5f57; }
.chrome-dot.yellow { background: #febc2e; }
.chrome-dot.green  { background: #28c840; }
.chrome-title {
  margin-left: 8px; font-size: .78rem;
  color: #8e8e93; font-weight: 500;
  flex: 1;
}
/* Fullscreen overlay */
.fs-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; flex-direction: column;
}
.fs-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #2c2c2e;
  font-size: .85rem; color: #8e8e93;
}
.fs-bar button {
  display: flex; align-items: center; gap: 6px;
  background: #ff5f57; border: none; border-radius: 6px;
  color: #fff; font-size: .8rem; font-weight: 600;
  padding: 5px 12px; cursor: pointer;
}
.fs-overlay iframe { flex: 1; width: 100%; border: none; }

/* Language dropdown */
.lang-dropdown { position: relative; }
.lang-toggle {
  display: flex; align-items: center; gap: 6px;
  background: var(--dark3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  font-size: .82rem; font-weight: 600; padding: 6px 10px;
  cursor: pointer; transition: border-color .2s;
  white-space: nowrap;
}
.lang-toggle:hover { border-color: var(--primary); }
.lang-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--dark3); border: 1px solid var(--border);
  border-radius: 10px; list-style: none;
  min-width: 150px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-menu li {
  padding: 10px 16px; font-size: .85rem; cursor: pointer;
  color: var(--text-muted); transition: background .15s, color .15s;
}
.lang-menu li:hover { background: var(--primary); color: #fff; }

/* Floating calc controls (zoom + fullscreen) */
.calc-frame-wrap { position: relative; background: #000; line-height: 0; }
.calc-controls {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; gap: 6px; z-index: 10;
}
.calc-controls button {
  width: 32px; height: 32px;
  background: rgba(28,28,30,.85); border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  transition: background .15s, transform .1s;
}
.calc-controls button:hover { background: var(--primary); transform: scale(1.08); }

/* AdSense banner */
.ad-banner { background: var(--dark2); padding: 8px 0; text-align: center; min-height: 90px; }
.calc-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 750px;
  border: none;
}

/* Tips sidebar */
.calc-tips {
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.calc-tips h3 { font-size: .95rem; margin-bottom: 14px; color: var(--text); }
.calc-tips ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.calc-tips li { font-size: .85rem; color: var(--text-muted); }
kbd {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-size: .78rem;
  color: var(--accent); font-family: monospace;
}

/* ===== Features ===== */
.features-section { padding: 80px 0; }
.features-section h2, .guide-section h2, .faq-section h2, .article-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; text-align: center;
}
.section-sub { text-align: center; color: var(--text-muted); margin-top: 8px; margin-bottom: 40px; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-top: 40px;
}
.feature-card {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color .2s, transform .2s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1rem; margin-bottom: 8px; }
.feature-card p { font-size: .88rem; color: var(--text-muted); }

/* ===== Guide ===== */
.guide-section { padding: 80px 0; background: var(--dark2); }
.guide-steps { display: flex; flex-direction: column; gap: 24px; margin-top: 40px; }
.step {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--dark3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.step-num {
  min-width: 40px; height: 40px;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.step h3 { font-size: 1rem; margin-bottom: 6px; }
.step p { font-size: .88rem; color: var(--text-muted); }
code {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-size: .82rem; color: #79c0ff;
}

/* ===== FAQ ===== */
.faq-section { padding: 80px 0; }
.faq-list { display: flex; flex-direction: column; gap: 12px; margin-top: 40px; }
.faq-item {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.faq-item summary {
  padding: 18px 20px; cursor: pointer;
  font-weight: 600; font-size: .95rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  transition: background .15s;
}
.faq-item summary:hover { background: var(--dark3); }
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--primary); }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 20px 18px; color: var(--text-muted); font-size: .9rem; }

/* ===== Article ===== */
.article-section { padding: 80px 0; background: var(--dark2); }
.article-inner { max-width: 780px; }
article h2 { text-align: left; margin-bottom: 16px; }
article h3 { font-size: 1.1rem; margin: 24px 0 8px; color: var(--text); }
article p { color: var(--text-muted); margin-bottom: 12px; font-size: .95rem; }
article ul { color: var(--text-muted); padding-left: 20px; font-size: .95rem; }
article ul li { margin-bottom: 6px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--dark); border-top: 1px solid var(--border);
  padding: 48px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px; padding-bottom: 40px;
}
.footer-brand p { color: var(--text-muted); font-size: .85rem; margin-top: 8px; max-width: 260px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links h4 { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: .88rem; transition: color .2s; }
.footer-links a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 20px; text-align: center;
  font-size: .78rem; color: var(--text-muted);
}

/* ===== PWA Install Button ===== */
.install-btn {
  display: none;
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border: none; border-radius: 50px;
  color: #fff; font-size: .88rem; font-weight: 600;
  padding: 12px 22px 12px 16px;
  cursor: pointer; box-shadow: 0 6px 20px rgba(26,115,232,.4);
  animation: slideUp .4s ease;
  transition: transform .2s, box-shadow .2s;
}
.install-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,115,232,.5); }
.install-btn img { width: 22px; height: 22px; border-radius: 6px; }
@keyframes slideUp { from { opacity:0; transform: translateY(30px); } to { opacity:1; transform: translateY(0); } }

/* ===== Embed Section ===== */
.embed-section { padding: 60px 0; background: var(--dark2); }
.embed-section h2 { font-size: clamp(1.5rem,3vw,2rem); font-weight:700; text-align:center; margin-bottom: 8px; }
.embed-section p { text-align:center; color: var(--text-muted); margin-bottom: 24px; }
.embed-box {
  background: var(--dark3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; gap: 12px; align-items: center;
  max-width: 780px; margin: 0 auto; overflow: hidden;
}
.embed-box code {
  flex: 1; font-size: .8rem; color: #79c0ff;
  background: none; border: none; padding: 0;
  white-space: nowrap; overflow-x: auto; display: block;
}
.copy-btn {
  background: var(--primary); border: none; border-radius: 6px;
  color: #fff; font-size: .85rem; font-weight: 600;
  padding: 8px 18px; cursor: pointer; white-space: nowrap;
  transition: background .2s;
}
.copy-btn:hover { background: var(--primary-dark); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .calc-wrapper { grid-template-columns: 1fr; }
  .calc-tips { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  nav { gap: 14px; }
  .hero-stats { gap: 20px; }
}
@media (max-width: 480px) {
  nav { display: none; }
  h1 { font-size: 1.8rem; }
  .lang-switcher { gap: 3px; }
  .lang-btn { font-size: .65rem; padding: 2px 5px; }
}
