:root {
  --bg: #f6f1dc;
  --panel: rgba(255, 252, 240, 0.84);
  --panel-strong: rgba(255, 252, 240, 0.95);
  --line: rgba(107, 88, 32, 0.18);
  --text: #3f3112;
  --muted: #8c7849;
  --accent: #2f8f83;
  --accent-2: #f39a1f;
  --accent-3: #d85d88;
  --good: #3f9363;
  --warn: #d08a1a;
  --bad: #c65353;
  --shadow: 0 18px 50px rgba(90, 72, 22, 0.14);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 223, 135, 0.6), transparent 28%),
    radial-gradient(circle at top right, rgba(83, 175, 193, 0.35), transparent 24%),
    linear-gradient(180deg, #f8f2d8 0%, #f6ecd4 52%, #f4e8cf 100%);
}

.shell {
  width: min(1520px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.7fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero,
.panel {
  backdrop-filter: blur(12px);
}

.hero > div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero > div:first-child {
  padding: 28px 30px;
}

.hero-card {
  padding: 22px;
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(47, 143, 131, 0.12), rgba(243, 154, 31, 0.12)),
    var(--panel-strong);
}

.hero-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.hero-stat strong {
  font-size: 1.7rem;
}

.hero-stat-label,
.mini-label,
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero h1,
.section-head h2 {
  margin: 4px 0 10px;
  line-height: 1.02;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 4rem);
}

.lede {
  max-width: 820px;
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.55;
}

.layout {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.capture-panel {
  padding-bottom: 22px;
}

.section-head,
.button-row,
.pill-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 1.5rem;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 700;
}

.control-grid,
.calibration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.calibration-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 700;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
}

select,
input[type="range"],
textarea,
button {
  font: inherit;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #7bcdb4);
  color: white;
  box-shadow: 0 12px 24px rgba(47, 143, 131, 0.22);
}

button.secondary {
  background: linear-gradient(135deg, rgba(243, 154, 31, 0.15), rgba(216, 93, 136, 0.12));
  color: var(--text);
  border: 1px solid rgba(140, 120, 73, 0.2);
}

.preview-wrap {
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  display: flex;
  justify-content: center;
}

#previewCanvas {
  display: block;
  width: min(100%, 540px);
  height: auto;
  background: linear-gradient(180deg, rgba(47, 143, 131, 0.07), rgba(243, 154, 31, 0.06));
}

.status-grid,
.summary-cards {
  display: grid;
  gap: 12px;
}

.status-grid {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-cards {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.mini-card,
.summary-card,
.note-block {
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  padding: 14px 16px;
}

.mini-card strong,
.summary-card strong {
  display: block;
  margin: 7px 0 6px;
  font-size: 1.18rem;
}

.mini-card p,
.summary-card p,
.note-block {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.summary-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.summary-card dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-card dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(140, 120, 73, 0.12);
  font-size: 0.94rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(251, 246, 230, 0.96);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.18);
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.state-pill.owned {
  background: rgba(63, 147, 99, 0.18);
  color: var(--good);
}

.state-pill.seen {
  background: rgba(240, 196, 88, 0.22);
  color: #9f6b00;
}

.state-pill.missing {
  background: rgba(216, 93, 136, 0.16);
  color: var(--accent-3);
}

.state-pill.unknown {
  background: rgba(140, 120, 73, 0.12);
  color: var(--muted);
}

.feed-editor {
  min-height: 240px;
  margin: 12px 0 16px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
}

.log-head {
  margin-top: 16px;
}

.log-panel {
  max-height: 260px;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(78, 64, 21, 0.06);
  padding: 10px 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.log-entry {
  padding: 8px 4px;
  border-bottom: 1px solid rgba(140, 120, 73, 0.12);
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry strong {
  color: var(--text);
}

.log-entry span {
  color: var(--muted);
}

@media (max-width: 1200px) {
  .hero,
  .status-grid,
  .summary-cards,
  .control-grid,
  .calibration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 18px, 100%);
    padding-top: 10px;
  }

  .hero,
  .status-grid,
  .summary-cards,
  .control-grid,
  .calibration-grid {
    grid-template-columns: 1fr;
  }

  .hero > div:first-child,
  .hero-card,
  .panel {
    padding-left: 16px;
    padding-right: 16px;
  }
}
