/* FortranFlow — deep-space theme (dark navy + plasma green), mobile-first */
:root {
  --bg: #0b1220;
  --bg-card: #111a2e;
  --bg-input: #0d1526;
  --line: #22304d;
  --text: #e8eef9;
  --muted: #8fa3c4;
  --accent: #3ddc84;
  --accent-2: #ffb454;
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  background: linear-gradient(180deg, #101a30, #0b1220);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, #1f8f5f, #14532d);
  color: #eafff3; font-weight: 700; font-size: 18px;
}
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: .3px; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 8px; }
.engine-badge {
  font-family: Consolas, monospace; font-size: 11px;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.engine-badge.js { color: var(--accent-2); border-color: var(--accent-2); }

select, input[type="number"], textarea {
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 15px;
  width: 100%;
}
textarea.num-area { font-family: Consolas, monospace; resize: vertical; min-height: 74px; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

main#app { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.hero h2 { margin: 0 0 6px; font-size: 20px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.tab {
  flex: 0 0 auto;
  background: var(--bg-card); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 13.5px; cursor: pointer;
}
.tab.active { color: #06130c; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.mode h3 { margin: 0 0 4px; font-size: 17px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.btn {
  border-radius: 10px; border: 1px solid var(--line);
  background: #16223b; color: var(--text);
  padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06130c; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.sample { border-style: dashed; color: var(--muted); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid2 label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.grid2 label.wide { grid-column: 1 / -1; }

.mat-grid { display: grid; gap: 8px; max-width: 420px; margin-top: 8px; }
.mat-grid input { text-align: center; font-family: Consolas, monospace; }
.mat-row-head { color: var(--muted); font-size: 12px; margin-top: 10px; }

.result { margin-top: 12px; font-size: 15px; }
.result table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.result th, .result td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); font-size: 14px; }
.result td.v { font-family: Consolas, monospace; color: var(--accent); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.kv b { font-family: Consolas, monospace; color: var(--accent); font-weight: 600; word-break: break-all; text-align: right; }
.error-text { color: var(--danger); font-size: 14px; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  padding: 9px 2px; border-bottom: 1px dashed var(--line);
  font-size: 13.5px; color: var(--muted);
  display: flex; justify-content: space-between; gap: 10px;
}
.history li b { color: var(--text); font-weight: 500; }

.history-head { display: flex; justify-content: space-between; align-items: center; }
.history-head h3 { margin: 0; font-size: 16px; }

.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 26px; }
.foot-lang { opacity: .75; }

@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  main#app { padding: 12px 10px 32px; }
}
