:root{
  --bg0:#070a10;
  --bg1:#0b1220;
  --card: rgba(14, 20, 34, .72);
  --cardSolid:#121a2a;
  --stroke: rgba(255,255,255,.10);
  --stroke2: rgba(255,255,255,.06);
  --text:#e9f0ff;
  --muted:#9fb0c7;
  --muted2:#7f92ad;
  --accent:#6aa7ff;
  --accent2:#8a5bff;
  --good:#43d19e;
  --bad:#ff6a7a;

  --radius: 18px;
  --radiusSm: 12px;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --shadowSm: 0 10px 30px rgba(0,0,0,.35);

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", Arial, "Apple SD Gothic Neo", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 15% 20%, rgba(106,167,255,.18), transparent 60%),
    radial-gradient(900px 600px at 80% 10%, rgba(138,91,255,.12), transparent 55%),
    radial-gradient(900px 650px at 80% 85%, rgba(67,209,158,.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
  animation: pageIn .35s ease both;
}

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

a{color:inherit;text-decoration:none}
.small{font-size:12.5px;color:var(--muted)}
.mono{font-family:var(--mono)}
.hr{
  border:none;
  height:1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  margin: 14px 0;
}

/* Top header */
.top{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(14px);
  background: rgba(6,10,16,.55);
  border-bottom:1px solid var(--stroke2);
}
.topInner{
  max-width:1100px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:46px;height:46px;border-radius:14px;
  display:grid;place-items:center;
  font-weight:800;
  background:
    radial-gradient(12px 12px at 30% 30%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(135deg, rgba(106,167,255,.85), rgba(138,91,255,.72));
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.brand h1{font-size:18px; margin:0}
.brand p{margin:2px 0 0; color:var(--muted); font-size:12.5px}
.nav{display:flex; gap:8px; flex-wrap:wrap}

/* Layout */
.wrap{max-width:1100px;margin:18px auto;padding:0 16px}
.grid2{display:grid;grid-template-columns: 1.05fr .95fr;gap:16px}
@media (max-width: 980px){
  .grid2{grid-template-columns:1fr}
}

/* Card */
.card{
  border:1px solid var(--stroke);
  background: var(--card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding:18px;
  box-shadow: var(--shadowSm);
  position:relative;
  overflow:hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.18);
  box-shadow: var(--shadow);
}
.card h2{margin:0 0 10px; font-size:16px}
.card p{margin:0; color:var(--muted); line-height:1.55}
.list{margin:10px 0 0; padding-left:18px; color:var(--muted)}
.list b{color:var(--text)}

/* Pills */
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.18);
  color: var(--muted);
  font-size:12px;
}
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(106,167,255,.12);
  border:1px solid rgba(106,167,255,.22);
  color:#cfe1ff;
  font-size:12px;
}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  user-select:none;
  transition: transform .12s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.btn:hover{
  border-color: rgba(255,255,255,.20);
  background: rgba(255,255,255,.06);
  box-shadow: 0 12px 24px rgba(0,0,0,.22);
}
.btn:active{ transform: translateY(1px) scale(.99); }
.btn.primary{
  border-color: rgba(106,167,255,.45);
  background: linear-gradient(135deg, rgba(106,167,255,.22), rgba(138,91,255,.18));
}
.btn.primary:hover{
  border-color: rgba(106,167,255,.75);
}
.btn.ghost{
  background: transparent;
}
.actions{display:flex; flex-wrap:wrap; gap:10px; margin-top:12px}

/* Forms */
.form{display:grid; gap:10px; margin-top:10px}
label{display:grid; gap:6px; font-size:12.5px; color:var(--muted)}
.input, input[type="text"], input[type="number"], textarea, select{
  width:100%;
  padding:11px 12px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea{min-height:120px; resize:vertical}
.input:focus, input:focus, textarea:focus, select:focus{
  border-color: rgba(106,167,255,.65);
  box-shadow: 0 0 0 4px rgba(106,167,255,.12);
}

/* Map layout */
.mapShell{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
  height: calc(100vh - 92px);
  padding: 14px 16px 18px;
}
@media (max-width: 1100px), (pointer: coarse){
  .mapShell{grid-template-columns:1fr; height:auto}
  .side{overflow: visible;}
}
.side{
  border:1px solid var(--stroke);
  background: var(--card);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  padding:14px;
  box-shadow: var(--shadowSm);
  overflow:auto;
}
.panelTitle{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
}
.sectionTitle{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  margin-top:10px;
}
.sectionTitle > div:first-child{display:grid; gap:2px}

.kv{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px;
  border:1px solid var(--stroke2);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  margin-top:10px;
}
.kv b{font-weight:750}

/* Multi-row key/value blocks (map stats) */
.kv.kvList{
  display:grid;
  gap:8px;
  align-items:stretch;
}
.kv.kvList .row{
  display:grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap:10px;
  align-items:center;
  padding:6px 0;
  border-bottom: 1px dashed rgba(255,255,255,.08);
}
.kv.kvList .row:last-child{ border-bottom:none; }
.kv.kvList .key{
  color: var(--muted);
  font-size:12.5px;
  white-space: nowrap;
}
.kv.kvList .val{
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 720px), (pointer: coarse) {
  .kv.kvList .row{ grid-template-columns: 1fr; gap:4px; }
  .kv.kvList .key{ white-space: normal; }
  .kv.kvList .val{ white-space: normal; }
}

/* Lists on map */
.item{
  border:1px solid var(--stroke2);
  background: rgba(0,0,0,.14);
  border-radius: 16px;
  padding:12px;
  margin-top:10px;
  transition: border-color .18s ease, transform .18s ease;
}
.item:hover{ border-color: rgba(255,255,255,.18); transform: translateY(-1px); }
.itemHead{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.itemTitle{font-weight:780}
.itemMeta{color:var(--muted);font-size:12.5px;margin-top:4px}
.iconBtn{
  width:36px;height:36px;border-radius:12px;
  display:grid;place-items:center;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  transition: transform .12s ease, border-color .18s ease, background .18s ease;
}
.iconBtn:hover{border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.06)}
.iconBtn:active{transform: translateY(1px) scale(.99)}
.iconRow{display:flex; gap:8px}

/* Leaflet container */
#map{
  border-radius: var(--radius);
  border:1px solid var(--stroke);
  overflow:hidden;
  box-shadow: var(--shadowSm);
  min-height: 520px;
}

/* AI output */
.aiOut{
  white-space: pre-wrap;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--stroke2);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(10, 14, 20, .78);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show{opacity:1; transform: translateY(0)}
.toast b{display:block; margin-bottom:4px}
.toast .small{margin:0}

/* nicer scrollbars */
*::-webkit-scrollbar{height:10px;width:10px}
*::-webkit-scrollbar-thumb{background: rgba(255,255,255,.10); border-radius:999px}
*::-webkit-scrollbar-track{background: rgba(0,0,0,.18); border-radius:999px}

@media (prefers-reduced-motion: reduce){
  *{animation:none!important; transition:none!important; scroll-behavior:auto!important}
}

/* Back-compat for older markup */
.navlink{display:inline-flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;border:1px solid var(--stroke);background:transparent;font-weight:650;color:var(--text);transition:transform .12s ease,border-color .18s ease,background .18s ease,box-shadow .18s ease}
.navlink:hover{border-color:rgba(255,255,255,.20);background:rgba(255,255,255,.06);box-shadow:0 12px 24px rgba(0,0,0,.22)}
.navlink:active{transform:translateY(1px) scale(.99)}
.notice{margin-top:10px;color:var(--muted);font-size:12.5px;line-height:1.5}
.result{white-space:pre-wrap;background:rgba(0,0,0,.18);border:1px solid var(--stroke2);border-radius:14px;padding:12px;color:var(--muted)}
.itemList{margin-top:8px}
.mapCard{padding:10px}

/* ==========================
   Calculators: tabs & panels
   (scoped so it won't affect
   other pages)
   ========================== */
.calc .tabs, .tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:10px 0 16px;
  padding:6px;
  border-radius:14px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  /* nicer on mobile: stay reachable */
  position: sticky;
  top: 10px;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.calc .tab, .tab{
  appearance:none;
  border:1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding:10px 14px;
  border-radius:12px;
  font-weight:700;
  font-size: 14px;
  letter-spacing:.2px;
  cursor:pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease;
}

/* hover/active */
.calc .tab:hover, .tab:hover{ transform: translateY(-1px); background: rgba(255,255,255,.06); color: rgba(255,255,255,.92); }
.calc .tab:active, .tab:active{ transform: translateY(0px) scale(.99); }

/* active tab */
.calc .tab.is-active, .tab.is-active{
  color:#fff;
  background: linear-gradient(135deg, rgba(146,162,255,.28), rgba(116,224,255,.14));
  border-color: rgba(146,162,255,.35);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

/* panels */
.calc .panel, .panel{ display:none; }
.calc .panel.is-active, .panel.is-active{ display:block; animation: panelIn .18s ease-out both; }

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