:root {
  --white:    #ffffff;
  --bg:       #f7f8fa;
  --bg2:      #eef0f4;
  --bg3:      #e4e7ed;
  --txt:      #111827;
  --txt2:     #374151;
  --txt3:     #6b7280;
  --txt4:     #9ca3af;
  --navy:     #1a3a6b;
  --navy2:    #1e4585;
  --navy3:    #e8f0fc;
  --amber:    #e8920a;
  --amber2:   #fef3dc;
  --green:    #15803d;
  --red:      #dc2626;
  --border:   #e5e7eb;
  --border2:  #d1d5db;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow2:  0 4px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --r:        8px;
  --r2:       12px;
  --font:     'DM Sans', sans-serif;
  --mono:     'DM Mono', monospace;
  --display:  'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* HEADER */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
}
.hdr-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--navy);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.logo-name { font-family: var(--font); font-size: .95rem; font-weight: 700; color: var(--txt); }
.logo-name span { color: var(--navy); }
.hdr-sep { flex: 1; }
.hdr-link {
  font-size: .78rem;
  font-weight: 500;
  color: var(--txt3);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all .15s;
}
.hdr-link:hover { background: var(--navy3); color: var(--navy); }

/* WRAP */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 80px; }

/* HERO */
.hero {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 500;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
}
h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--txt);
  margin-bottom: 12px;
}
h1 .accent { color: var(--navy); }
.hero-sub {
  font-size: 1rem;
  color: var(--txt3);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 20px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--txt3);
  background: var(--white);
}
.tag.hi { border-color: rgba(26,58,107,.2); color: var(--navy); background: var(--navy3); }

/* MAIN GRID */
.main-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* CARD */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-hd {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
}
.card-hd-bar { width: 3px; height: 18px; border-radius: 2px; flex-shrink: 0; }
.card-hd-bar.navy  { background: var(--navy); }
.card-hd-bar.amber { background: var(--amber); }
.card-ttl {
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 700;
  color: var(--txt);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.card-sub { margin-left: auto; font-family: var(--mono); font-size: .58rem; color: var(--txt4); }
.card-bd { padding: 18px; }

/* MODE TOGGLE */
.mode-tog {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg);
}
.mbtn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  color: var(--txt3);
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .2px;
}
.mbtn.on { background: var(--navy); color: #fff; border-radius: calc(var(--r) - 1px); }
.mbtn:hover:not(.on) { background: var(--bg2); color: var(--txt); }

/* FORM */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.flbl {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.inp-row { display: flex; gap: 6px; align-items: stretch; }
.inp {
  flex: 1;
  padding: 10px 13px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 500;
  color: var(--txt);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.inp:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,58,107,.1);
}
.inp::placeholder { color: var(--txt4); font-weight: 400; }
.sel {
  width: 100%;
  padding: 10px 32px 10px 13px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 500;
  color: var(--txt);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .15s;
}
.sel:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,58,107,.1);
}
.unit-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: var(--navy3);
  border: 1.5px solid rgba(26,58,107,.2);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  min-width: 46px;
  flex-shrink: 0;
}
.hint { font-size: .68rem; color: var(--txt4); margin-top: 5px; line-height: 1.5; }

/* TEMPERATURE SLIDER */
.temp-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.tslider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--navy) var(--pct, 13%), var(--bg3) var(--pct, 13%));
  outline: none;
}
.tslider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--navy);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.tslider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--navy);
  cursor: pointer;
}
.tbadge {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--navy);
  min-width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* FLUID META CHIPS */
.fmeta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.fmc {
  padding: 8px 11px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--border);
}
.fmc .lbl {
  font-size: .55rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--txt4);
  display: block;
}
.fmc .val {
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 600;
  color: var(--txt);
  margin-top: 1px;
}

/* CONVERT BUTTON */
.btn-calc {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--r);
  background: var(--navy);
  color: #fff;
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .4px;
  cursor: pointer;
  transition: all .18s;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-calc:hover { background: var(--navy2); box-shadow: var(--shadow2); transform: translateY(-1px); }
.btn-calc:active { transform: translateY(0); }

/* RESULTS */
.results-panel { display: none; }
.results-panel.show { display: block; }

.big-readout {
  background: var(--navy);
  border-radius: var(--r2);
  padding: 24px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.big-readout::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle at top right, rgba(255,255,255,.06), transparent 70%);
  pointer-events: none;
}
.br-lbl {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.br-val {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1;
  letter-spacing: -1px;
}
.br-unit { font-family: var(--font); font-size: .85rem; font-weight: 500; color: rgba(255,255,255,.65); margin-top: 6px; }
.br-formula {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-family: var(--mono);
  font-size: .68rem;
  color: rgba(255,255,255,.5);
  line-height: 2;
}
.br-formula .hi { color: rgba(255,255,255,.9); font-weight: 600; }
.br-formula .eq { color: #fbbf24; }

/* UNIT GRID */
.units-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 500px) { .units-grid { grid-template-columns: repeat(2, 1fr); } }
.uc {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 10px 11px;
  cursor: pointer;
  transition: all .15s;
}
.uc:hover { border-color: var(--navy); background: var(--navy3); }
.uc.p { border-color: var(--navy); background: var(--navy3); position: relative; }
.uc.p::after { content: '★'; position: absolute; top: 4px; right: 6px; font-size: .42rem; color: var(--navy); }
.uc-lbl { font-size: .52rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .8px; color: var(--txt4); margin-bottom: 2px; }
.uc-val { font-family: var(--mono); font-size: .88rem; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-unit { font-size: .58rem; font-family: var(--mono); color: var(--txt4); margin-top: 1px; }



/* PLACEHOLDER */
#placeholder { padding: 48px 24px; text-align: center; }
.ph-eq { font-family: var(--display); font-size: 3rem; font-weight: 800; color: var(--bg3); line-height: 1; margin-bottom: 12px; }
.ph-sub { font-family: var(--mono); font-size: .62rem; color: var(--txt4); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 24px; }
.ph-examples { display: flex; flex-direction: column; gap: 6px; max-width: 300px; margin: 0 auto; text-align: left; }
.ph-ex { font-family: var(--mono); font-size: .65rem; color: var(--txt4); padding: 8px 12px; background: var(--bg); border-radius: 6px; border: 1px solid var(--border); line-height: 1.6; }
.ph-ex strong { color: var(--txt2); }

/* EDUCATION SECTION */
.section-ttl { font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--txt); margin-bottom: 4px; }
.section-sub { font-size: .88rem; color: var(--txt3); margin-bottom: 20px; }

.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 640px) { .edu-grid { grid-template-columns: 1fr; } }
.edu-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.edu-card:hover { border-color: rgba(26,58,107,.2); box-shadow: var(--shadow2); }
.edu-card-hd {
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.edu-num {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  color: var(--navy);
  border: 1.5px solid rgba(26,58,107,.25);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.edu-ttl { font-family: var(--font); font-size: .82rem; font-weight: 700; color: var(--txt); }
.edu-bd { padding: 16px; font-size: .88rem; color: var(--txt2); line-height: 1.8; }
.edu-bd strong { color: var(--txt); font-weight: 600; }
.eqb {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--navy);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 10px 14px;
  margin: 10px 0;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--txt);
  line-height: 2;
}
.eqb .kw { color: var(--navy); font-weight: 600; }
.eqb .nt { color: var(--txt4); font-size: .65rem; }
.notebox {
  background: var(--amber2);
  border: 1px solid rgba(232,146,10,.25);
  border-radius: var(--r);
  padding: 10px 13px;
  margin: 10px 0;
  font-family: var(--mono);
  font-size: .7rem;
  color: #92400e;
  line-height: 1.7;
}
.infobox {
  background: var(--navy3);
  border: 1px solid rgba(26,58,107,.15);
  border-radius: var(--r);
  padding: 10px 13px;
  margin: 10px 0;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--navy);
  line-height: 1.7;
}
.edu-bd table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .76rem; font-family: var(--mono); }
.edu-bd table th { background: var(--bg); color: var(--txt3); padding: 6px 9px; font-size: .58rem; text-transform: uppercase; letter-spacing: .6px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600; }
.edu-bd table td { padding: 6px 9px; border-bottom: 1px solid var(--border); color: var(--txt2); }
.edu-bd table td:first-child { color: var(--txt); }
.edu-bd ul { margin: 8px 0 8px 16px; }
.edu-bd ul li { margin-bottom: 4px; }

/* FAQ */
.faq-ttl { font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--txt); margin-bottom: 16px; }
.faq-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px; overflow: hidden; }
.faq-q {
  padding: 14px 18px;
  cursor: pointer;
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 600;
  color: var(--txt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--white);
  transition: background .15s;
  user-select: none;
  border: none;
  width: 100%;
  text-align: left;
}
.faq-q:hover { background: var(--bg); }
.faq-q .arr { transition: transform .25s; font-size: .8rem; color: var(--txt4); flex-shrink: 0; }
.faq-item.open .faq-q { color: var(--navy); background: var(--navy3); }
.faq-item.open .arr { transform: rotate(180deg); color: var(--navy); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; font-size: .88rem; color: var(--txt2); line-height: 1.8; }
.faq-item.open .faq-a { max-height: 500px; }
.faq-ai { padding: 14px 18px; border-top: 1px solid var(--border); }
.faq-ai strong { color: var(--txt); font-weight: 600; }
.faq-ai code { font-family: var(--mono); font-size: .78rem; color: var(--navy); background: var(--navy3); padding: 1px 5px; border-radius: 4px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--txt);
  color: #fff;
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 20px;
  transition: transform .25s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow2);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* FOOTER */
footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 24px 20px; background: var(--white); }
.foot { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot-txt { font-size: .68rem; color: var(--txt4); font-family: var(--mono); }
.foot-links { display: flex; gap: 14px; margin-left: auto; }
.foot-links a { font-size: .68rem; color: var(--txt4); text-decoration: none; font-family: var(--mono); transition: color .15s; }
.foot-links a:hover { color: var(--navy); }

/* ANIMATIONS */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.results-panel.show .big-readout  { animation: fadeUp .28s ease both; }
.results-panel.show .units-grid   { animation: fadeUp .28s .06s ease both; }


/* MOBILE */
@media (max-width: 640px) {
  h1 { font-size: 1.9rem; }
  .hero { padding: 28px 0 24px; margin-bottom: 24px; }
  .card-bd { padding: 14px; }
  .big-readout { padding: 18px; }
  .br-val { font-size: 2.2rem; }
  .hdr-link { display: none; }
  .hdr-link:first-of-type { display: block; }
}
