/* ================================
 * NicheWorks Base (smartphone-first tools)
 * ================================ */

:root{
  --bg:#ffffff;
  --bg-soft:#f9fafb;
  --border:#e5e7eb;
  --text:#111827;
  --muted:#6b7280;
  --muted2:#9ca3af;
  --accent:#111827;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:var(--bg);
  line-height:1.5;
}

.nw-header{
  padding:14px 12px 6px;
  border-bottom:1px solid var(--border);
  text-align:center;
}
.nw-title{
  margin:0;
  font-size:18px;
  letter-spacing:.2px;
}
.nw-lead{
  margin:6px 0 0;
  font-size:12px;
  color:var(--muted);
}

.nw-lang-switch{
  text-align:center;
  margin:6px 0 0;
  font-size:11px;
  color:var(--muted);
}
.nw-lang-switch button{
  border:none;
  background:transparent;
  padding:0 2px;
  cursor:pointer;
  font-size:11px;
  color:#4b5563;
}
.nw-lang-switch button.active{
  font-weight:600;
  text-decoration:underline;
}

.nw-main{
  max-width:600px; /* smartphone-first tools allowed by spec */
  margin:0 auto;
  padding:10px 12px 18px;
}

.ad-slot{
  margin:12px 0 16px;
  padding:8px;
  border:1px dashed #d4d4d4;
  font-size:11px;
  color:var(--muted2);
  text-align:center;
  min-height:60px;
}
.ad-top{ margin-top:4px; }
.ad-bottom{ margin-bottom:8px; }

.nw-note{
  margin:0 0 10px;
  padding:8px 10px;
  border:1px solid var(--border);
  background:var(--bg-soft);
  border-radius:10px;
  font-size:12px;
  color:var(--muted);
}

.card{
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  overflow:hidden;
  box-shadow:0 1px 0 rgba(0,0,0,.03);
  margin:10px 0 14px;
}
.card-hd{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:var(--bg-soft);
}
.card-title{
  margin:0;
  font-size:13px;
}
.card-bd{
  padding:12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:10px 0;
}
.label{
  font-size:12px;
  color:var(--muted);
}
.input, .textarea, .select{
  width:100%;
  padding:10px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:14px;
  outline:none;
}
.textarea{ min-height:110px; resize:vertical; }

.row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:10px;
  cursor:pointer;
  font-size:13px;
  transition:transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover{
  background:var(--bg-soft);
  transform:translateY(-1px);
  box-shadow:0 1px 4px rgba(0,0,0,.08);
}
.btn.primary{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}
.btn.primary:hover{ background:#000; }

.out{
  width:100%;
  padding:10px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--bg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  white-space:pre-wrap;
  word-break:break-word;
}
.out.status-output{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:#fff;
  white-space:normal;
}
.status-card{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--bg-soft);
}
.status-card.status-loading{
  border-color:#bfdbfe;
  background:#eff6ff;
}
.status-card.status-success{
  border-color:#bbf7d0;
  background:#f0fdf4;
}
.status-card.status-error{
  border-color:#fecaca;
  background:#fef2f2;
}
.status-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:11px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.status-state{
  font-weight:600;
}
.status-body{
  font-size:13px;
  color:var(--text);
}
.status-hint{
  font-size:12px;
  color:var(--muted);
}
.status-detail{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--text);
}
.status-title{
  font-weight:600;
}
.status-code{
  align-self:flex-start;
  padding:2px 8px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
  font-size:11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.status-preview{
  margin-top:6px;
  padding:10px;
  border-radius:10px;
  border:1px dashed var(--border);
  background:#fff;
  font-size:12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space:pre-wrap;
  word-break:break-word;
}

.compare-output{
  margin-top:12px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.compare-title{
  margin:0 0 6px;
  font-size:13px;
}
.compare-note{
  margin:0 0 8px;
  font-size:12px;
  color:var(--muted);
}
.compare-metrics{
  margin:0;
  display:grid;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.compare-metrics dt{
  font-weight:600;
  color:var(--text);
}
.compare-metrics dd{
  margin:0;
}
.compare-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  gap:12px;
}
.compare-card{
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px;
  background:var(--bg-soft);
}
.compare-card-title{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.compare-card canvas{
  width:100%;
  height:auto;
  display:block;
  background:#fff;
  border-radius:8px;
  border:1px solid var(--border);
}
.compare-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.storm-replay{
  margin-top:12px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.storm-status{
  font-size:12px;
  color:var(--muted);
}
.storm-status strong{
  color:var(--text);
}
.storm-toolbar{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.storm-controls{
  display:flex;
  gap:8px;
  align-items:center;
}
.storm-slider{
  flex:1;
}
.storm-meta{
  font-size:12px;
  color:var(--muted);
}
.storm-label{
  margin-right:4px;
}
.storm-toggle{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.storm-canvases{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:12px;
}
.storm-panel{
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px;
  background:var(--bg-soft);
}
.storm-panel-title{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.storm-panel canvas{
  width:100%;
  height:auto;
  display:block;
  background:#fff;
  border-radius:8px;
  border:1px solid var(--border);
}
.storm-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.card-map-picker{
  width:100%;
  height:auto;
  border-radius:10px;
  border:1px solid var(--border);
  background:linear-gradient(180deg, #e0f2fe 0%, #fef3c7 100%);
  cursor:crosshair;
}

.card-output{
  margin-top:12px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.card-output-header{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.card-output-title{
  margin:0;
  font-size:13px;
}
.card-output-note{
  margin:0;
  font-size:12px;
  color:var(--muted);
}
.card-output-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:12px;
}
.card-output-panel{
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px;
  background:var(--bg-soft);
  display:flex;
  flex-direction:column;
  gap:6px;
}
.card-output-label{
  font-size:12px;
  color:var(--muted);
}
.card-output-panel canvas{
  width:100%;
  height:auto;
  display:block;
  border-radius:8px;
  border:1px solid var(--border);
  background:#fff;
}
.card-output-meta{
  font-size:12px;
  color:var(--muted);
}
.card-summary{
  margin:0;
  display:grid;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}
.card-summary dt{
  font-weight:600;
  color:var(--text);
}
.card-summary dd{
  margin:0;
}
.card-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.bullet{
  margin:0;
  padding-left:18px;
  font-size:12px;
  color:var(--muted);
}
.bullet li{ margin:4px 0; }

.step-list{
  margin:0;
  padding-left:18px;
  font-size:12px;
  color:var(--muted);
}
.step-list li{ margin:6px 0; }

.table-wrap{
  overflow-x:auto;
}
.limit-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
  color:var(--muted);
  min-width:360px;
}
.limit-table th,
.limit-table td{
  border:1px solid var(--border);
  padding:8px;
  text-align:left;
  vertical-align:top;
}
.limit-table th{
  background:var(--bg-soft);
  color:var(--text);
  font-weight:600;
}

.example-grid{
  display:grid;
  gap:10px;
}
.example-card{
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px;
  background:var(--bg-soft);
}
.example-title{
  margin:0 0 6px;
  font-size:12px;
  color:var(--text);
}
.example-code{
  margin:0;
  font-size:12px;
  color:var(--muted);
  white-space:pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.hint{
  margin:10px 0 0;
  font-size:12px;
  color:var(--muted);
}

.faq{
  margin:0;
  font-size:12px;
  color:var(--muted);
}
.faq dt{
  font-weight:600;
  margin-top:8px;
  color:var(--text);
}
.faq dd{
  margin:4px 0 0;
}

.nw-link{
  color:#2563eb;
  text-decoration:underline;
}

.nw-donate{
  text-align:center;
  margin:16px 0 8px;
  padding:8px 0;
  font-size:12px;
  color:var(--muted);
}
.nw-donate-text{ margin:4px 0; font-size:12px; }
.nw-donate-links{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
}
.nw-donate-links a{
  display:inline-block;
  padding:8px 14px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#fff;
  font-size:13px;
  color:var(--text);
  text-decoration:none;
}

.nw-other{
  margin:10px 0 0;
  padding:10px 0 0;
  border-top:1px solid var(--border);
  text-align:center;
}
.nw-other-title{
  margin:0 0 8px;
  font-size:12px;
  color:var(--muted);
}
.nw-other-links{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px;
}
.nw-other-links a{
  font-size:12px;
  color:#4b5563;
  text-decoration:underline;
}

.nw-footer{
  margin-top:24px;
  padding:16px 8px 12px;
  border-top:1px solid var(--border);
  font-size:11px;
  color:var(--muted);
  text-align:center;
  line-height:1.6;
}
.nw-footer-line{ margin:2px 0; }
.nw-footer a{ color:var(--muted); text-decoration:underline; }

/* Responsive transform: <=480px */
@media (max-width:480px){
  .nw-main{ padding:10px 10px 18px; }
  .row{ flex-direction:column; align-items:stretch; }
  .btn{ width:100%; }
}
