:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-input: #1c2128;
  --border: #30363d;
  --text-main: #e6edf3;
  --text-muted: #7d8590;
  --primary: #4493f8;
  --accent-gold: #d4a847;
  --safe: #38a169;
  --radius: 10px;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --border: #d0d7de;
  --text-main: #1f2328;
  --text-muted: #656d76;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.6; padding: 1.5rem 1rem 3rem; }

.tool-wrapper { max-width: 680px; margin: 0 auto; }

/* Header */
.tool-header { text-align: center; margin-bottom: 2rem; }
.tool-header__badge { display: inline-flex; align-items: center; gap: 0.4rem; background: rgba(68,147,248,0.1); border: 1px solid rgba(68,147,248,0.3); color: var(--primary); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.8rem; border-radius: 20px; margin-bottom: 1rem; }
.tool-header h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.5rem; }
.tool-header p { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 0.9rem; }

/* Input card */
.input-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
.form-field { display: flex; flex-direction: column; }
.form-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.input-field { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-size: 0.9rem; padding: 0.55rem 0.75rem; transition: border-color 0.15s; }
.input-field:focus { outline: none; border-color: var(--primary); }
.input-suffix { display: flex; align-items: center; gap: 0; }
.input-suffix .input-field { border-radius: 8px 0 0 8px; flex: 1; }
.input-suffix .suffix-tag { background: var(--bg-input); border: 1px solid var(--border); border-left: none; border-radius: 0 8px 8px 0; padding: 0.55rem 0.75rem; font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.65rem 1.5rem; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s; }
.btn:hover { opacity: 0.88; }
.btn-primary { background: var(--primary); color: #fff; }

/* Preset info card */
#preset-info { margin-bottom: 1.25rem; }
.preset-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.preset-name { font-size: 1rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; }
.preset-desc { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.preset-detail { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.2rem 0; border-bottom: 1px solid var(--border); font-size: 0.83rem; }
.preset-detail:last-of-type { border-bottom: none; }
.detail-lbl { color: var(--text-muted); }
.detail-val { font-weight: 600; color: var(--text-main); }
.preset-gauge-note { margin-top: 0.6rem; font-size: 0.78rem; color: var(--text-muted); background: var(--bg-input); border-radius: 6px; padding: 0.5rem 0.75rem; }

/* Result card */
.result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.result-header { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); background: rgba(68,147,248,0.05); }
.result-icon { font-size: 2rem; line-height: 1; }
.result-title { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.result-sub { font-size: 0.83rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Calculation breakdown */
.calc-breakdown { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); }
.calc-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0; font-size: 0.87rem; }
.calc-lbl { color: var(--text-muted); }
.calc-val { font-weight: 600; color: var(--text-main); font-variant-numeric: tabular-nums; }
.calc-row--total { border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.5rem; font-weight: 700; }
.calc-row--total .calc-lbl { color: var(--text-main); }
.calc-row--total .calc-val { color: var(--primary); font-size: 1rem; }

/* Size options */
.size-options { display: flex; gap: 0.75rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
@media (max-width: 480px) { .size-options { flex-direction: column; } }
.size-option { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.size-option--primary { border-color: var(--primary); background: rgba(68,147,248,0.08); }
.size-val { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.size-option--primary .size-val { color: var(--primary); }
.size-option--alt .size-val { color: var(--text-main); }
.size-lbl { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

/* Gauge note + advice */
.result-gauge-note { padding: 0.9rem 1.5rem; font-size: 0.83rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.result-gauge-note strong { color: var(--text-main); }
.result-advice { padding: 0.9rem 1.5rem; font-size: 0.83rem; color: var(--text-muted); }
.result-advice a { color: var(--primary); }

.err-card { background: rgba(229,62,62,0.08); border: 1px solid rgba(229,62,62,0.3); border-radius: var(--radius); padding: 1rem; color: #fc8181; text-align: center; }

/* Disclaimer */
.disclaimer { background: var(--bg-card); border: 1px solid var(--border); border-top: 3px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; font-size: 0.8rem; color: var(--text-muted); margin-top: 1.5rem; }
.disclaimer strong { color: var(--text-main); }
