:root {
    --bg: #fafaf9; --card: #ffffff; --border: #e7e5e4;
    --text: #1c1917; --text-mut: #78716c;
    --terracotta: #c2410c; --emerald: #15803d; --amber: #d97706; --crimson: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; padding: 1.5rem 1rem; background-image: radial-gradient(circle at 10% 10%, rgba(194,65,12,0.04) 0%, transparent 40%), radial-gradient(circle at 90% 90%, rgba(21,128,61,0.04) 0%, transparent 40%); display: flex; justify-content: center; }
main { width: 100%; max-width: 950px; display: flex; flex-direction: column; gap: 1.2rem; }
header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border); padding-bottom: 0.8rem; }
.lg h1 { font-size: 1.4rem; font-weight: 800; color: var(--terracotta); }
.lg p { font-size: 0.75rem; color: var(--text-mut); font-weight: 600; }

.grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 768px) { .grid { grid-template-columns: 320px 1fr; } }

.card { background: var(--card); border: 1.5px solid var(--border); border-radius: 10px; padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.03); animation: slideDown 0.3s ease-out; }
.card-title { font-size: 0.9rem; font-weight: 800; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; text-transform: uppercase; color: var(--terracotta); display: flex; justify-content: space-between; align-items: center; }

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

.ig { display: flex; flex-direction: column; gap: 0.4rem; }
.il { font-size: 0.7rem; color: var(--text-mut); font-weight: 700; text-transform: uppercase; }
.iw { display: flex; align-items: center; background: #f5f5f4; border: 1.5px solid var(--border); border-radius: 6px; padding: 0.3rem 0.6rem; width: 100%; transition: border-color 0.2s; }
.iw:focus-within { border-color: var(--terracotta); }
.iw input { background: transparent; border: none; color: var(--text); width: 100%; font-size: 0.9rem; font-weight: 700; outline: none; }

.unit-bar { display: flex; gap: 0.3rem; background: #f5f5f4; border: 1px solid var(--border); border-radius: 99px; padding: 0.2rem; width: fit-content; }
.btn-unit { background: transparent; border: none; padding: 0.35rem 0.75rem; font-size: 0.7rem; font-weight: 700; color: var(--text-mut); border-radius: 99px; cursor: pointer; transition: all 0.2s ease; }
.btn-unit.active { background: var(--terracotta); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.preset-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.btn-preset { background: #f5f5f4; border: 1px solid var(--border); color: var(--text); padding: 0.25rem 0.5rem; font-size: 0.7rem; font-weight: 700; border-radius: 99px; cursor: pointer; transition: all 0.2s; }
.btn-preset:hover { background: var(--terracotta); color: #fff; }

.btn { border: none; border-radius: 6px; padding: 0.65rem 1rem; color: #fff; font-size: 0.85rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; transition: transform 0.15s, opacity 0.2s; }
.btn-primary { background: var(--terracotta); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-fresh { background: transparent; border: 1px solid var(--border); color: var(--text-mut); padding: 0.35rem 0.7rem; font-size: 0.75rem; border-radius: 6px; }
.btn-fresh:hover { background: #f5f5f4; color: var(--crimson); }

/* Proportional Circles Visualizer */
.visualizer-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.2rem; background: #fafaf9; border: 1.5px dashed var(--border); border-radius: 8px; }
.circles-container { display: flex; align-items: center; justify-content: center; gap: 2rem; min-height: 140px; width: 100%; position: relative; }
.circle-wrapper { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }

.pot-circle { width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; color: #fff; transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 10px rgba(0,0,0,0.06); }
.circle-old-pot { background: linear-gradient(135deg, #ea580c, #c2410c); transform: scale(0.75); }
.circle-new-pot { background: linear-gradient(135deg, #16a34a, #15803d); transform: scale(1); }

.circle-label { font-size: 0.7rem; font-weight: 700; color: var(--text-mut); text-transform: uppercase; }

/* Outputs & Tip */
.output-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.metric-box { background: #f5f5f4; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; text-align: center; }
.metric-val { font-size: 1.3rem; font-weight: 800; color: var(--emerald); }
.metric-lbl { font-size: 0.65rem; color: var(--text-mut); font-weight: 700; text-transform: uppercase; margin-top: 0.1rem; }

.tip-card { background: rgba(21,128,61,0.06); border: 1px solid rgba(21,128,61,0.2); border-radius: 8px; padding: 0.8rem; font-size: 0.8rem; color: #166534; line-height: 1.4; display: flex; gap: 0.5rem; align-items: flex-start; }

.field-error { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 6px; padding: 0.4rem 0.6rem; font-size: 0.7rem; color: var(--crimson); font-weight: 700; display: none; }
.recalc-spinner { font-size: 0.8rem; opacity: 0; transition: opacity 0.2s; }
.recalc-spinner.active { opacity: 1; }

/* In-Browser Test Widget - ALWAYS VISIBLE BY DEFAULT */
.test-widget { position: fixed; bottom: 1rem; right: 1rem; background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; padding: 0.75rem; max-width: 250px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); z-index: 1000; font-size: 0.7rem; display: block; }
.test-title { font-weight: 800; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; margin-bottom: 0.4rem; color: var(--text); display: flex; justify-content: space-between; }
.test-line { display: flex; justify-content: space-between; margin-bottom: 0.2rem; }
.test-ok { color: var(--emerald); font-weight: 700; }
.test-fail { color: var(--crimson); font-weight: 700; }
footer { font-size: 0.65rem; color: var(--text-mut); border-top: 1.5px solid var(--border); padding-top: 0.6rem; display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
