:root {
  --bg: #f3f7f5;
  --bg-deep: #e4ece8;
  --ink: #17211c;
  --muted: #56635d;
  --line: #d8e2dc;
  --line-soft: #e9f0ec;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: #edf5f1;
  --green: #176b4d;
  --green-dark: #0f4c39;
  --green-deep: #093224;
  --cyan: #0f6f7a;
  --blue: #245aa8;
  --amber: #a45f00;
  --amber-soft: #fff0d8;
  --red: #9f2f36;
  --shadow: 0 18px 45px rgba(28, 46, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(12, 37, 29, 0.48), rgba(243, 247, 245, 0.92) 55%),
    url("https://images.unsplash.com/photo-1565008447742-97f6f38c985c?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-size: cover;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 80ms ease;
}

button:hover {
  border-color: var(--green);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(15, 111, 122, 0.32);
  outline-offset: 2px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 28px;
  align-items: end;
  min-height: 58vh;
  padding: 24px 0;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.36);
}

.hero-copy {
  max-width: 760px;
}

.hero-preview {
  position: relative;
  min-height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 76, 57, 0.84), rgba(15, 111, 122, 0.72)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 54px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 54px);
  box-shadow: 0 22px 60px rgba(6, 23, 17, 0.28);
}

.scanline {
  position: absolute;
  inset: 18% 10% auto;
  height: 3px;
  background: #ffc857;
  box-shadow: 0 0 22px rgba(255, 200, 87, 0.75);
}

.preview-grid {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 8px;
}

.preview-grid span {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.13);
}

.preview-grid .hot {
  background: rgba(255, 200, 87, 0.38);
}

.preview-grid .active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.72);
}

.eyebrow {
  margin: 0 0 10px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: 52px;
  line-height: 1.04;
  letter-spacing: 0;
}

.hero p {
  max-width: 650px;
  margin-bottom: 24px;
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-link,
.secondary-link,
.tool-actions a,
.tool-actions span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.secondary-link,
.tool-actions a + a,
.tool-actions span {
  color: var(--green);
  background: #fff;
}

.tools-section {
  padding: 26px;
  border: 1px solid rgba(216, 226, 220, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  color: var(--green);
}

.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  display: grid;
  gap: 20px;
  align-content: space-between;
  min-height: 280px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tool-status {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #0f4c39;
  background: #dff2e8;
  font-size: 12px;
  font-weight: 800;
}

.tool-status.planned {
  color: var(--amber);
  background: var(--amber-soft);
}

.tool-card h3 {
  margin-bottom: 10px;
  font-size: 26px;
  letter-spacing: 0;
}

.tool-card p {
  color: var(--muted);
  line-height: 1.55;
}

.coming-soon {
  background: #f9fbfa;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(246, 249, 246, 0.94), rgba(232, 239, 233, 0.96)),
    url("https://images.unsplash.com/photo-1565008447742-97f6f38c985c?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-size: cover;
}

.workspace {
  max-width: 1380px;
  margin: 0 auto;
}

.site-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.site-nav a {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar .eyebrow {
  color: var(--green-dark);
}

.topbar h1 {
  color: var(--green-deep);
}

.topbar .lede {
  margin: 8px 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.status-pill {
  min-width: 132px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--green-dark);
  white-space: nowrap;
}

.status-pill[data-state="error"] {
  color: var(--red);
  background: #ffe5e7;
  border-color: rgba(159, 47, 54, 0.32);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.results-panel {
  border: 1px solid rgba(217, 225, 219, 0.88);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.control-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.results-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  min-height: 320px;
}

.section-title {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sample-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

select,
input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.drop-zone {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 18px;
  border: 1px dashed #9eb3a8;
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
  justify-items: center;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-active {
  border-color: var(--green);
  background: #e1efe7;
}

.drop-zone-title {
  font-weight: 800;
  color: var(--green-dark);
}

#fileName {
  color: var(--muted);
  font-size: 13px;
}

.static-hint {
  margin: -2px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(15, 111, 122, 0.08);
  color: var(--cyan);
  font-size: 12px;
  line-height: 1.4;
}

.bbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bbox-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-button {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.command-box {
  min-height: 92px;
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d9fbe8;
  background: #10251d;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-band > div {
  min-height: 88px;
  padding: 16px;
  background: #fff;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-band strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.25;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.panel-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.block-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.block-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.block-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.visual-block {
  overflow: hidden;
}

#gridCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 7;
  background: #eef4f0;
}

.result-stack {
  display: grid;
  gap: 1px;
  padding: 14px;
  background: var(--line);
}

.result-stack span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.result-stack b {
  color: var(--green-dark);
}

.signal-list {
  display: grid;
  gap: 8px;
  min-height: 72px;
  margin: 0;
  padding: 14px;
  list-style: none;
}

.signal-list li {
  padding-left: 12px;
  border-left: 3px solid var(--cyan);
  color: var(--ink);
  line-height: 1.4;
}

.cell-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 64px;
  padding: 14px;
}

.cell-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #e9f2ed;
  font-size: 12px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1180px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
  .control-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .app-shell {
    padding: 16px;
  }

  .hero,
  .layout-grid,
  .content-grid,
  .summary-band,
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 52px;
  }

  .hero-preview {
    min-height: 240px;
  }

  .control-panel {
    position: static;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: 38px;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .status-pill {
    align-self: flex-start;
  }
}
