:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --green-soft: #f0fdf4;
  --amber-soft: #fffbeb;
  --red-soft: #fef2f2;
  --good: #166534;
  --warn: #854d0e;
  --bad: #991b1b;
  --grid: #e5e7eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 24px 24px 24px 300px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.sideMenu {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  z-index: 100;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  overflow-y: auto;
  box-shadow: 10px 0 30px rgba(15,23,42,0.06);
}
.sideMenuBrand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 0 8px;
}
.sideMenuLogo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fef3c7, #dcfce7);
  color: #92400e;
  font-weight: 900;
  border: 1px solid #fde68a;
  flex: 0 0 auto;
}
.sideMenuTitle { font-size: 15px; font-weight: 800; line-height: 1.2; }
.sideMenuSubtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sideMenuSection {
  margin: 18px 0 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sideMenuNav { display: grid; gap: 6px; }
.sideMenuNav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.25;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.sideMenuNav a:hover {
  background: #f9fafb;
  color: #111827;
  border-color: var(--border);
  transform: translateX(2px);
}
.sideMenuNav a.active {
  background: var(--accent-soft);
  color: #1d4ed8;
  border-color: #bfdbfe;
  box-shadow: inset 3px 0 0 #2563eb;
  font-weight: 700;
}
.sideMenuBadge {
  font-size: 10px;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}
.sideMenuFooter {
  margin-top: 24px;
  padding: 12px;
  border-radius: 14px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.coffeeButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffdd00;
  color: #111827;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid #facc15;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.coffeeButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(250, 204, 21, 0.35);
}
.wrap { max-width: 1180px; margin: 0 auto; }
.card, .hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(15,23,42,0.04);
}
.hero {
  border-radius: 22px;
  padding: clamp(22px, 4vw, 38px);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(37,99,235,0.10), transparent 62%);
  pointer-events: none;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}
.hero .topbar { margin-bottom: 20px; }
h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.25;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
h5 { margin: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.hero .subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  max-width: 760px;
}
.languageBox { min-width: 160px; margin-top: 2px; position: relative; z-index: 1; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: white;
  min-height: 42px;
}
input:focus, select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--accent);
}
.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}
.controls.six { grid-template-columns: repeat(6, minmax(140px, 1fr)); }
.controls.five { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.controls.secondary {
  padding: 14px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 16px;
}
.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.3;
}
.result {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
  font-size: 14px;
  min-height: 64px;
}
.result strong { display: block; font-size: 18px; margin-top: 3px; }
.result.good { background: var(--green-soft); border-color: #86efac; color: var(--good); }
.result.bad { background: var(--red-soft); border-color: #fca5a5; color: var(--bad); }
.result.warn { background: var(--amber-soft); border-color: #facc15; color: var(--warn); }
.formula, .note {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 16px;
  line-height: 1.55;
}
.warning-panel {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 10px 0 16px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.warning-panel.good { background: var(--green-soft); border-color: #86efac; color: var(--good); }
.warning-panel.warn { background: var(--amber-soft); border-color: #facc15; color: var(--warn); }
.warning-panel.bad { background: var(--red-soft); border-color: #fca5a5; color: var(--bad); }
.tableWrap { overflow-x: auto; }
table {
  border-collapse: collapse;
  margin-top: 16px;
  width: 100%;
  min-width: 780px;
  font-size: 13px;
}
th, td { border-top: 1px solid var(--border); padding: 9px 8px; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; background: #fafafa; }
.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}
.status-pill.good { background: #dcfce7; color: #166534; }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.status-pill.warn { background: #fef3c7; color: #92400e; }
.not-achievable-row { background: #fff7f7; }
.chartBox {
  width: 100%;
  height: 540px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: white;
  position: relative;
}
svg { width: 100%; height: 100%; display: block; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.line { fill: none; stroke-width: 2.2; pointer-events: none; }
.line.custom { stroke-width: 4; }
.dot { stroke: white; stroke-width: 1.5; pointer-events: none; }
.hover-line { stroke: #111827; stroke-width: 1.4; stroke-dasharray: 5 5; opacity: 0.75; pointer-events: none; }
.hover-ring { fill: white; stroke-width: 2.5; pointer-events: none; }
.quote-line { stroke: #111827; stroke-width: 1.8; stroke-dasharray: 8 6; opacity: 0.65; pointer-events: none; }
.quote-label-bg { fill: #111827; opacity: 0.88; pointer-events: none; }
.quote-label { fill: white; font-size: 12px; font-weight: 700; pointer-events: none; }
.achievable-fill { fill: rgba(22, 163, 74, 0.07); pointer-events: none; }
.not-achievable-fill { fill: rgba(220, 38, 38, 0.13); pointer-events: none; }
.zone-label { font-size: 12px; font-weight: 700; pointer-events: none; }
.plot-overlay { fill: transparent; cursor: crosshair; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.94);
  color: white;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  display: none;
  line-height: 1.45;
  max-width: min(460px, calc(100% - 24px));
  z-index: 10;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.tooltip .title { font-weight: 700; margin-bottom: 5px; font-size: 13px; }
.tooltip .row {
  display: grid;
  grid-template-columns: 12px 1fr 170px;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.tooltip .swatch { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }
.tooltip strong { text-align: right; font-weight: 700; }
.tooltip small { display: block; margin-top: 2px; color: #d1d5db; font-weight: 500; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.appCard {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 360px;
  text-decoration: none;
  color: inherit;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15,23,42,0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.appCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(15,23,42,0.10);
  border-color: #bfdbfe;
}
.appImage { height: 150px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.appImage svg { width: 100%; height: 100%; display: block; }
.appContent { padding: 18px; }
.appKicker {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.appCard h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.3; }
.appCard p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.appFooter { padding: 0 18px 18px; color: #2563eb; font-weight: 800; font-size: 14px; }
@media (max-width: 1180px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  body { padding: 16px 16px 16px 292px; }
  .controls, .controls.six, .controls.five { grid-template-columns: 1fr 1fr; }
  .chartBox { height: 500px; }
}
@media (max-width: 860px) {
  body { padding: 86px 12px 12px; }
  .sideMenu {
    right: 0;
    bottom: auto;
    width: auto;
    min-height: 64px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sideMenuBrand { margin: 0; padding: 0; min-width: 165px; }
  .sideMenuSection, .sideMenuFooter { display: none; }
  .sideMenuNav { display: flex; gap: 6px; min-width: max-content; }
  .sideMenuNav a { padding: 9px 10px; white-space: nowrap; }
  .sideMenuNav a:hover { transform: none; }
}
@media (max-width: 680px) {
  .topbar { flex-direction: column; }
  .languageBox { width: 100%; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .controls, .controls.six, .controls.five { grid-template-columns: 1fr; }
  .chartBox { height: 460px; }
}