/* ── Calculator Section Styles ── */
#reverse-engineering {
  /* v2.19.0 · 學費計算器對齊弋果深藍靛色系 */
  --re-dark:    #030F2B;   /* 弋果 primary dark */
  --re-orange:  #C5A47E;   /* 弋果暖金 */
  --re-orange-h:#B08D5F;
  --re-light:   #EEE7DB;   /* 弋果暖米白 */
  --re-white:   #ffffff;
  --re-card:    #192643;   /* 弋果 primary · 卡背景 */
  --re-card2:   #4B5877;   /* 弋果中間藍 · 副卡 */
  --re-text:    #ffffff;
  --re-muted:   #A6B4D4;   /* 弋果低對比周邊色 */
  --re-ok:      #4caf82;
  --re-warn:    #f0b429;
  --re-err:     #e85050;
  --re-radius:  14px;
  --re-shadow:  0 8px 32px rgba(0,0,0,0.28);
  --re-trans:   0.4s cubic-bezier(0.34,1.1,0.64,1);

  background: var(--re-dark);
  padding: clamp(56px, 8vw, 100px) clamp(20px, 5vw, 40px);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  color: var(--re-text);
  overflow: hidden;
  position: relative;
}

/* Decorative background blobs */
#reverse-engineering::before,
#reverse-engineering::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.12;
}
#reverse-engineering::before {
  width: 500px; height: 500px;
  background: var(--re-orange);
  top: -120px; right: -100px;
}
#reverse-engineering::after {
  width: 400px; height: 400px;
  background: #3a6fd4;
  bottom: -80px; left: -80px;
}

.re-container {
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── Section Header ── */
.re-header {
  text-align: center;
  margin-bottom: 48px;
}
.re-label {
  display: inline-block;
  background: rgba(197,164,126,0.15);
  border: 1px solid rgba(197,164,126,0.4);
  color: var(--re-orange);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 6px 16px;
  border-radius: 99px;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.re-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 900;
  color: var(--re-white);
  line-height: 1.3;
  margin: 0 0 14px;
}
.re-title span {
  color: var(--re-orange);
}
.re-subtitle {
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  color: var(--re-muted);
  margin: 0;
  font-weight: 400;
}

/* ── Calculator Card ── */
.re-card {
  background: var(--re-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--re-radius);
  padding: clamp(24px, 5vw, 44px);
  box-shadow: var(--re-shadow);
}

/* ── Form Grid ── */
.re-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.re-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.re-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--re-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.re-field select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--re-card2);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--re-white);
  font-size: 0.97rem;
  font-family: inherit;
  padding: 12px 40px 12px 16px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238fa3cc' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.re-field select:focus {
  border-color: var(--re-orange);
  box-shadow: 0 0 0 3px rgba(197,164,126,0.18);
}
.re-field select option {
  background: #030F2B;
  color: #ffffff;
}

/* ── Calculate Button ── */
.re-btn-calc {
  width: 100%;
  padding: 16px 24px;
  background: var(--re-orange);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(197,164,126,0.35);
}
.re-btn-calc:hover {
  background: var(--re-orange-h);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(197,164,126,0.45);
}
.re-btn-calc:active {
  transform: translateY(0);
}

/* ── Results Panel ── */
.re-results {
  margin-top: 32px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease;
}
.re-results.visible {
  max-height: 2000px;
  opacity: 1;
}

/* ── Result Summary Card ── */
.re-result-main {
  border-radius: var(--re-radius);
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.08);
}
.re-result-main.status-ok   { background: linear-gradient(135deg, #1b3a2e 0%, #1d3547 100%); border-color: rgba(76,175,130,0.3); }
.re-result-main.status-warn { background: linear-gradient(135deg, #3a2e14 0%, #2a2f1d 100%); border-color: rgba(240,180,41,0.3); }
.re-result-main.status-err  { background: linear-gradient(135deg, #3a1b1b 0%, #2a1d2d 100%); border-color: rgba(232,80,80,0.3); }

.re-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.re-stat {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.re-stat-icon { font-size: 1.4rem; margin-bottom: 4px; }
.re-stat-label {
  font-size: 0.72rem;
  color: var(--re-muted);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.re-stat-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--re-white);
}

/* ── Status Banner ── */
.re-status-banner {
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.97rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.re-status-banner.ok   { background: rgba(76,175,130,0.15); color: #5dd4a0; border: 1px solid rgba(76,175,130,0.25); }
.re-status-banner.warn { background: rgba(240,180,41,0.15); color: #f5c842; border: 1px solid rgba(240,180,41,0.25); }
.re-status-banner.err  { background: rgba(232,80,80,0.15);  color: #f07070; border: 1px solid rgba(232,80,80,0.25); }

/* ── Timeline Visual ── */
.re-timeline {
  margin: 28px 0;
}
.re-timeline-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--re-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.re-timeline-bar {
  position: relative;
  height: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}
.re-timeline-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--re-orange) 0%, #f5b56a 100%);
  width: 0;
  transition: width 0.9s cubic-bezier(0.34,1.1,0.64,1) 0.2s;
}
.re-timeline-ages {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--re-muted);
  margin-top: 6px;
}
.re-timeline-marker {
  position: absolute;
  top: -4px;
  width: 18px;
  height: 18px;
  background: var(--re-orange);
  border-radius: 50%;
  border: 2.5px solid var(--re-dark);
  transform: translateX(-50%);
  transition: left 0.9s cubic-bezier(0.34,1.1,0.64,1) 0.2s;
}

/* ── Comparison Table ── */
.re-compare-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--re-white);
  margin: 0 0 14px;
}
.re-table-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
.re-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.re-table th {
  background: var(--re-card2);
  color: var(--re-muted);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.re-table td {
  padding: 13px 14px;
  color: var(--re-text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.re-table tr:last-child td { border-bottom: none; }
.re-table tr.re-row-highlight td {
  background: rgba(197,164,126,0.1);
  color: var(--re-white);
  font-weight: 700;
}
.re-table tr.re-row-highlight td:first-child {
  border-left: 3px solid var(--re-orange);
}
.re-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}
.re-badge-rec  { background: rgba(197,164,126,0.25); color: var(--re-orange); }
.re-badge-ok   { background: rgba(76,175,130,0.2); color: #5dd4a0; }
.re-badge-warn { background: rgba(240,180,41,0.2); color: #f5c842; }
.re-badge-err  { background: rgba(232,80,80,0.2); color: #f07070; }

/* ── CTA Button ── */
.re-cta-wrap {
  text-align: center;
  margin-top: 28px;
}
.re-cta-note {
  font-size: 0.8rem;
  color: var(--re-muted);
  margin: 0 0 14px;
}
.re-btn-cta {
  display: inline-block;
  padding: 16px 36px;
  background: linear-gradient(135deg, var(--re-orange) 0%, #f5a355 100%);
  color: #fff;
  border: none;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 24px rgba(197,164,126,0.4);
}
.re-btn-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(197,164,126,0.52);
}
.re-btn-cta:active { transform: translateY(-1px); }

/* ── Tip line ── */
.re-tip {
  text-align: center;
  font-size: 0.82rem;
  color: var(--re-muted);
  margin-top: 24px;
  line-height: 1.6;
}
.re-tip strong { color: var(--re-orange); }

/* ── Pulse animation on highlight row ── */
@keyframes re-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(197,164,126,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(197,164,126,0); }
  100% { box-shadow: 0 0 0 0 rgba(197,164,126,0); }
}
.re-table tr.re-row-highlight { animation: re-pulse 1.2s ease 0.5s 2; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .re-form { grid-template-columns: 1fr; }
  .re-result-grid { grid-template-columns: repeat(2, 1fr); }
  .re-table th:nth-child(3),
  .re-table td:nth-child(3) { display: none; }
}
