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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ==================== Top Bar ==================== */
.topbar {
  background: #1a1f2e;
  color: #fff;
  width: 100%;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
  transition: all 0.2s;
}

.topbar-btn:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.lang-select {
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  font-size: 0.82rem;
  cursor: pointer;
}

.lang-select option {
  background: #1a1f2e;
  color: #e2e8f0;
}

@media (max-width: 500px) {
  .topbar-inner { height: 40px; padding: 0 12px; }
  .topbar-btn { font-size: 0.75rem; padding: 4px 10px; }
}

.header {
  background: linear-gradient(135deg, #1a3a5c 0%, #2c5f8a 100%);
  color: #fff;
  padding: 28px 0 22px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header .subtitle {
  font-size: 0.95rem;
  opacity: 0.85;
  margin-top: 6px;
}

.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 16px 20px 0;
  max-width: 1100px;
  margin: 0 auto;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: #e2e8f0;
  color: #555;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: #cbd5e0;
  color: #2d3748;
}

.tab-btn.active {
  background: #fff;
  color: #1a3a5c;
  font-weight: 600;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

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

.calculator {
  display: none;
  background: #fff;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 32px;
  animation: fadein 0.3s ease;
}

.calculator.active {
  display: block;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.calc-title {
  font-size: 1.3rem;
  color: #1a3a5c;
  margin-bottom: 6px;
  font-weight: 700;
}

.calc-desc {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.formula-box {
  background: #f7fafc;
  border-left: 4px solid #2c5f8a;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
  color: #2d3748;
  border-radius: 0 6px 6px 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tabs { gap: 2px; }
  .tab-btn { padding: 8px 14px; font-size: 0.82rem; }
  .calculator { padding: 20px 16px; }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a5568;
}

.input-group label .limit {
  font-weight: 400;
  color: #a0aec0;
  font-size: 0.78rem;
}

.input-group input, .input-group select {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.input-group input:focus, .input-group select:focus {
  outline: none;
  border-color: #2c5f8a;
  box-shadow: 0 0 0 3px rgba(44,95,138,0.15);
}

.btn-calc {
  background: linear-gradient(135deg, #2c5f8a 0%, #1a3a5c 100%);
  color: #fff;
  border: none;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 20px;
}

.btn-calc:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,58,92,0.3);
}

.btn-calc:active {
  transform: translateY(0);
}

.result {
  margin-top: 24px;
  padding: 20px;
  border-radius: 10px;
  display: none;
}

.result.show {
  display: block;
  animation: fadein 0.3s ease;
}

.result.pass {
  background: #f0fff4;
  border: 1px solid #c6f6d5;
}

.result.fail {
  background: #fff5f5;
  border: 1px solid #fed7d7;
}

.result.info {
  background: #ebf8ff;
  border: 1px solid #bee3f8;
}

.result-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.result.pass .result-title { color: #276749; }
.result.fail .result-title { color: #c53030; }
.result.info .result-title { color: #2b6cb0; }

.result-detail {
  font-size: 0.9rem;
  color: #4a5568;
  line-height: 1.7;
}

.result-detail .val {
  font-weight: 600;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.check-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.check-icon.ok { background: #48bb78; }
.check-icon.no { background: #f56565; }

.unit-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.unit-toggle label {
  font-size: 0.85rem;
  color: #718096;
  font-weight: 500;
}

.unit-toggle input[type="radio"] {
  margin-right: 3px;
}

.footer {
  text-align: center;
  padding: 20px;
  color: #a0aec0;
  font-size: 0.8rem;
}
