@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../../../assets/fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../../../assets/fonts/AtkinsonHyperlegible-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../../../assets/fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../../../assets/fonts/AtkinsonHyperlegible-BoldItalic.woff2") format("woff2");
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg-color: #121212;
  --panel-bg: #1e1e1e;
  --text-color: #e0e0e0;
  --text-muted: #a0a0a0;
  --border-color: #333333;
  --accent-color: #00e385;
  --accent-hover: #00c774;
}

::-webkit-scrollbar {
  gap: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-left: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
  background: #333;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

::selection {
  background: var(--accent-color);
  color: #000;
}

/* Remove white square from textarea resize handle */
::-webkit-resizer {
  background-color: var(--bg-color);
  border-left: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
}

body {
  margin: 0;
  padding: 0;
  font-family:
    "Atkinson Hyperlegible",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body.modal-open {
  overflow: hidden;
}

code {
  background-color: #2a2a2a;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
  color: var(--accent-color);
}

main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.gui-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  border-right: 1px solid var(--border-color);
}

.preview-container {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.page-intro {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #2d3f37;
  border-left: 4px solid #4c7d68;
  background: linear-gradient(90deg, rgba(34, 58, 49, 0.4) 0%, rgba(21, 21, 21, 0.95) 48%);
}

.page-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
}

.top-reset-btn,
.mdn-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  min-width: 204px;
  font-size: 16px;
  line-height: 1.2;
  border: 1px solid;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.3px;
}

.top-reset-btn {
  background: #2a1616;
  color: #ff9898;
  border-color: #6a3434;
}

.top-reset-btn:hover {
  background: #3a1f1f;
  color: #ffb2b2;
  border-color: #8e4545;
}

.mdn-btn {
  background: #162921;
  color: #95e9c4;
  border-color: #2d5f49;
}

.mdn-btn:hover {
  background: #1d382d;
  border-color: #3a7a5d;
  color: #b6f7d8;
}

.intro-btn-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  fill: currentColor;
  flex: 0 0 auto;
}

.page-title {
  margin: 0;
  color: #d3e7db;
  font-size: 34px;
  line-height: 1.16;
  font-weight: bold;
  letter-spacing: -0.5px;
}

.page-subtitle {
  margin: 0;
  color: #b7c2bc;
  font-size: 17px;
  line-height: 1.45;
  max-width: 60ch;
}

.field-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.section-intro {
  position: relative;
  border: 1px solid #2d3f37;
  border-left: none;
  padding: 14px;
  margin: 0 0 20px 0;
  border-left: 4px solid #4c7d68;
  background: linear-gradient(90deg, rgba(34, 58, 49, 0.4) 0%, rgba(21, 21, 21, 0.95) 48%);
}

.section-intro h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.4;
  color: #d3e7db;
}

.section-intro p {
  margin: 4px 0 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.preview-container h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 28px;
  font-weight: bold;
  line-height: 1.25;
  color: #d3e7db;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 20px;
  background: #181818;
  padding: 18px;
  border: 1px solid var(--border-color);
}

label {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-color);
}

.req-badge {
  color: #ff5555;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 85, 85, 0.1);
  font-weight: normal;
}

.opt-badge {
  color: #888;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font-weight: normal;
}

.adv-badge {
  color: #ffbb66;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 187, 102, 0.12);
  font-weight: normal;
}

.field-legend .req-badge,
.field-legend .opt-badge,
.field-legend .adv-badge {
  margin-left: 0;
}

.description {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  line-height: 1.55;
}

.field-note {
  margin: 0 0 10px 0;
  font-size: 14px;
  line-height: 1.55;
  color: #9fb0a5;
}

.field-note strong {
  color: #cceadb;
}

.path-note code {
  color: #8df2c1;
}

.complex-group {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--border-color);
}

.help-block {
  margin: 12px 0 12px 0;
  border: 1px dashed #2f3d36;
  background: #141414;
  padding: 8px 10px;
}

.complex-group + .help-block {
  margin-top: 14px;
}

.help-block summary {
  cursor: pointer;
  color: var(--accent-color);
  font-size: 15px;
  font-weight: bold;
  line-height: 1.45;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-block summary::-webkit-details-marker {
  display: none;
}

.help-block summary::before {
  content: "▸";
  color: var(--accent-color);
  font-size: 13px;
  line-height: 1;
}

.help-block[open] summary::before {
  content: "▾";
}

.help-block p {
  margin: 8px 0 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

input[type="text"],
input[type="number"],
input[type="color"],
select,
textarea {
  width: 100%;
  padding: 14px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  min-height: 48px;
  box-sizing: border-box;
  transition: border-color 0.2s;
  border-radius: 0;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2300e385' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}

select:hover {
  border-color: #4e5f56;
}

select::-ms-expand {
  display: none;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

textarea {
  resize: vertical;
  min-height: 108px;
  line-height: 1.55;
}

input[type="color"] {
  padding: 2px;
  height: 40px;
  cursor: pointer;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.actions button {
  min-height: 42px;
  border: 1px solid #2f7a59;
  background: #194735;
  color: #dbffed;
  font-size: 16px;
  font-weight: bold;
}

.actions button:hover {
  background: #205c44;
}

.manifest-footer {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.manifest-credit {
  margin: 0;
  color: #a7b8b0;
  font-size: 14px;
  line-height: 1.45;
}

.manifest-credit strong {
  color: #def6e8;
}

.manifest-credit .brand {
  color: #9feeca;
}

.manifest-credit .brand-link {
  color: #9feeca;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.manifest-credit .brand-link:hover {
  color: #c9ffe3;
}

.manifest-credit .heart {
  color: #ff90a4;
}

.pizza-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #3f8363;
  background: linear-gradient(90deg, #17412f, #1d523b);
  color: #dbffea;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1.12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.pizza-btn:hover {
  background: linear-gradient(90deg, #1d523b, #216148);
  border-color: #54a47d;
  color: #f0fff7;
}

button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  background-color: var(--accent-color);
  color: #000;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.2s;
  white-space: nowrap;
}

button.add-btn {
  background-color: #2a2a2a;
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  margin-top: 6px;
  padding: 8px 15px;
  width: 100%;
}

button.add-btn:hover {
  background-color: #333;
}

button:hover {
  background-color: var(--accent-hover);
}

.items-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.items-list:empty {
  display: none;
  margin-top: 0;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #0d0d0d;
  border: 1px solid var(--border-color);
  padding: 10px;
  gap: 10px;
}

.list-item-content {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
  padding-right: 10px;
}

.item-controls {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.item-controls button {
  padding: 4px 8px;
  font-size: 12px;
  background: #2a2a2a;
  color: #fff;
  border: 1px solid var(--border-color);
}

.item-controls button:hover {
  background: #444;
}

.item-controls button.danger {
  color: #ff5555;
}

.item-controls button.danger:hover {
  background: #551111;
  border-color: #ff5555;
  color: #fff;
}

pre {
  margin: 0;
  flex: 1;
  background: var(--panel-bg);
  padding: 18px;
  border: 1px solid var(--border-color);
  overflow: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 15px;
  line-height: 1.5;
  color: var(--accent-color);
}

pre code {
  display: block;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.json-key {
  color: #78c4ff;
}

.json-string {
  color: #c8f59b;
}

.json-number {
  color: #ffd27b;
}

.json-boolean {
  color: #ff9d85;
}

.json-null {
  color: #bea9ff;
}

.json-punc {
  color: #7f8b96;
}

/* Mobile and narrow-pane responsive */
@media (max-width: 980px) {
  body {
    height: auto;
    min-height: 100vh;
  }

  main {
    display: block;
    overflow-y: auto;
  }

  .gui-container {
    overflow: visible;
    padding: 10px;
    border-right: none;
    border-bottom: none;
  }

  .page-intro,
  .section-intro,
  .form-group {
    margin-bottom: 12px;
  }

  .preview-container {
    margin: 10px;
    margin-top: -8px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }

  .preview-container h2 {
    margin-bottom: 12px;
    text-align: center;
    font-size: 30px;
  }

  .page-intro {
    text-align: center;
    justify-items: stretch;
    padding: 12px;
  }

  .page-title {
    font-size: 30px;
  }

  .page-subtitle {
    font-size: 15px;
    max-width: none;
  }

  .page-intro-actions {
    width: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .top-reset-btn,
  .mdn-btn {
    min-width: 0;
    padding: 10px;
    font-size: 16px;
  }

  .field-legend {
    margin-bottom: 12px;
    gap: 6px;
    justify-content: center;
  }

  .section-intro {
    margin: 12px 0;
    padding: 12px;
  }

  .section-intro::before {
    width: 5px;
  }

  .section-intro h3 {
    font-size: 17px;
  }

  .section-intro p {
    font-size: 13px;
  }

  .form-group {
    margin-bottom: 12px;
    padding: 14px;
  }

  label {
    font-size: 18px;
  }

  .description {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .field-note {
    font-size: 13px;
  }

  .complex-group {
    gap: 8px;
    margin-top: 6px;
    padding-left: 8px;
  }

  .help-block summary {
    font-size: 14px;
  }

  .help-block p {
    font-size: 13px;
  }
}

.manifest-footer {
  margin: 12px 0;
  padding: 12px;
  grid-template-columns: 1fr;
  gap: 12px;
  text-align: center;
  align-items: stretch;
}

.manifest-credit {
  font-size: 13px;
}

.pizza-btn {
  max-width: none;
  min-height: 42px;
  font-size: 13px;
  letter-spacing: 0.65px;
}

.actions button {
  min-width: 0;
  max-width: none;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 15px;
}

pre {
  padding: 10px;
  font-size: 13px;
  min-height: 220px;
  max-height: 320px;
  text-align: left;
}
