:root {
  --bg: #f3f0e8;
  --bg-accent: #e4ecdf;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-tint: #f6f9f4;
  --text: #1d2a24;
  --muted: #5f6d65;
  --line: rgba(29, 42, 36, 0.12);
  --brand: #1f5c45;
  --brand-strong: #133d2d;
  --brand-soft: rgba(31, 92, 69, 0.1);
  --shadow: 0 20px 60px rgba(23, 37, 30, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Instrument Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(222, 183, 108, 0.18), transparent 28%),
    radial-gradient(circle at right 10% top 20%, rgba(98, 140, 119, 0.18), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #eef4ec 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 75%);
}

.page-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero-card,
.panel {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 2rem;
  padding: 2rem;
  align-items: start;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand);
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.1rem);
  line-height: 0.94;
  max-width: 11ch;
}

h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.intro,
.panel-heading p,
.helper-text,
.status-text {
  color: var(--muted);
}

.intro {
  margin: 1rem 0 1.2rem;
  max-width: 50ch;
  font-size: 1.02rem;
  line-height: 1.6;
}

.section-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.section-menu a {
  text-decoration: none;
  color: var(--brand-strong);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(29, 42, 36, 0.08);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
}

.decoder-form {
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(246, 249, 244, 0.96), rgba(255, 255, 255, 0.9));
  border: 1px solid var(--line);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-block span {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  min-width: 0;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(29, 42, 36, 0.14);
  background: var(--surface-strong);
  color: var(--text);
  text-transform: uppercase;
}

input:focus {
  outline: 2px solid rgba(31, 92, 69, 0.2);
  border-color: var(--brand);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

button {
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-weight: 700;
  padding: 0.95rem 1.2rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 12px 24px rgba(31, 92, 69, 0.2);
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(31, 92, 69, 0.24);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-strong);
  border: 1px solid rgba(29, 42, 36, 0.1);
  box-shadow: none;
}

.helper-text,
.status-text {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.status-text[data-state="error"] {
  color: #8f2f2f;
}

.status-text[data-state="success"] {
  color: var(--brand-strong);
}

.results-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.secondary-grid {
  grid-template-columns: 1fr 1fr;
}

.panel {
  padding: 1.4rem;
}

.panel-highlight {
  background:
    linear-gradient(180deg, rgba(233, 241, 233, 0.92), rgba(255, 255, 255, 0.82));
}

.panel-heading {
  margin-bottom: 1rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.panel-heading p {
  margin: 0.45rem 0 0;
  line-height: 1.55;
}

.summary-cards {
  display: grid;
  gap: 0.8rem;
}

.summary-cards.empty-state,
.feature-card.empty-state {
  min-height: 220px;
  place-items: center;
  text-align: center;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(29, 42, 36, 0.14);
  display: grid;
}

.summary-card,
.feature-card,
.subpanel-block {
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(29, 42, 36, 0.08);
}

.summary-card strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
}

.summary-card span {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
}

.subpanel-block + .subpanel-block {
  margin-top: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.95rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

td {
  line-height: 1.5;
}

.table-empty {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.code-chip,
.feature-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.code-chip {
  min-width: 2.25rem;
  padding: 0.32rem 0.55rem;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.feature-card {
  align-content: start;
  gap: 0.85rem;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.feature-pill {
  padding: 0.48rem 0.7rem;
  background: rgba(31, 92, 69, 0.1);
  color: var(--brand-strong);
}

.feature-pill.off {
  background: rgba(95, 109, 101, 0.12);
  color: var(--muted);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.option-panel {
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(29, 42, 36, 0.08);
}

.option-panel-wide {
  grid-column: 1 / -1;
}

.notes-panel {
  margin-top: 1.25rem;
}

@media (max-width: 980px) {
  .hero-card,
  .results-grid,
  .secondary-grid,
  .options-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 1rem, 1200px);
    padding-top: 0.75rem;
  }

  .hero-card,
  .panel {
    padding: 1rem;
    border-radius: 22px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.8rem;
  }

  td {
    padding: 0.3rem 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
  }

  .table-empty {
    padding: 1rem 0;
    background: transparent;
    border: 0;
  }
}
