:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #66717a;
  --soft: #f3f6f8;
  --panel: #ffffff;
  --line: #d5dce2;
  --line-dark: #35414a;
  --chrome: #151c21;
  --chrome-2: #222b32;
  --chrome-3: #2c3740;
  --blue: #3858e9;
  --blue-soft: #edf1ff;
  --green: #18a67a;
  --yellow: #f5c84b;
  --red: #bd342b;
  --plum: #6d3c8d;
  --shadow: 0 18px 48px rgba(12, 20, 28, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #dfe5ea;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #9eabb6;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.danger {
  border-color: #f0c9c6;
  background: #fff5f4;
  color: var(--red);
  font-weight: 700;
}

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

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 336px;
  grid-template-rows: 54px auto auto;
  gap: 1px;
  background: #c7d0d7;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 248px minmax(280px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--chrome);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark,
.site-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: #05080a;
  color: #fff;
  font-weight: 800;
}

.brand small,
.eyebrow,
.saved-row small,
.start-list span,
.session-card p,
.card-body p {
  color: var(--muted);
}

.brand small {
  display: block;
  color: #aeb8c1;
  font-size: 12px;
}

.pathbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.pathbar button,
.top-actions button {
  border-color: var(--line-dark);
  background: var(--chrome-2);
  color: #f3f6f8;
}

.pathbar label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding-left: 10px;
  background: var(--chrome-2);
}

.pathbar label span {
  color: #aeb8c1;
  font-size: 12px;
}

.pathbar input {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #eef2f5;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status {
  white-space: nowrap;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 700;
}

.catalog-rail,
.session-panel,
.manager,
.marketplace {
  min-width: 0;
}

.catalog-rail {
  grid-row: 2 / 4;
  padding: 14px;
  background: var(--chrome);
  color: #eef2f5;
}

.rail-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.rail-nav button,
.category-list button,
.start-list button {
  text-align: left;
  border-color: var(--line-dark);
  background: var(--chrome-2);
  color: #dce4ea;
}

.rail-nav button.is-active,
.category-list button.is-active {
  border-color: #7890ff;
  background: #26315e;
  color: #fff;
}

.rail-section + .rail-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-dark);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 800;
}

.section-title strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 24px;
  border-radius: 999px;
  background: #34404a;
  color: #cfd8df;
  font-size: 12px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-list button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
}

.start-list {
  display: grid;
  gap: 8px;
}

.start-list button {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.start-list strong {
  font-size: 14px;
}

.marketplace {
  padding: 20px;
  background: #f7f9fb;
}

.market-header {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 420px);
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.eyebrow {
  margin-bottom: 5px;
  color: #73808a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.market-header h1 {
  max-width: 560px;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.04;
  letter-spacing: 0;
}

.searchbox span,
.modal label span,
.settings-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.featured-runner {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(48, 61, 75, 0.09);
}

.runner-preview,
.card-image {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background-size: cover;
  background-position: center;
}

.runner-preview::before,
.card-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 15, 18, 0.08), rgba(12, 15, 18, 0.1)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 14px);
}

.fake-admin {
  position: absolute;
  top: 9px;
  left: 10px;
  right: 10px;
  z-index: 1;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  padding: 4px 7px;
  background: rgba(10, 14, 18, 0.76);
  color: #d7e1e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.preview-title {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 1;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.preview-coffee {
  background:
    linear-gradient(135deg, rgba(65, 30, 88, 0.94), rgba(103, 54, 18, 0.42)),
    radial-gradient(circle at 82% 32%, #f4b767 0 10%, transparent 11%),
    linear-gradient(180deg, #6d3c8d 0 36%, #f3a84f 36% 70%, #533120 70%);
}

.preview-art {
  background:
    linear-gradient(90deg, rgba(37, 69, 67, 0.45), transparent),
    linear-gradient(90deg, #245351 0 28%, #d9c991 28% 55%, #b77c54 55% 76%, #4e6f52 76%);
}

.preview-feed {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0 52%, rgba(235, 243, 255, 0.9) 52%),
    repeating-linear-gradient(0deg, #dce7ff 0 18px, #ffffff 18px 36px);
}

.preview-game {
  background:
    linear-gradient(90deg, #080b0d 0 42%, rgba(255, 255, 255, 0.86) 42%),
    radial-gradient(circle at 24% 72%, #d35a27 0 18%, transparent 19%),
    linear-gradient(135deg, #221018, #7b160d);
}

.preview-nonprofit {
  background:
    linear-gradient(90deg, rgba(50, 25, 8, 0.88), rgba(50, 25, 8, 0.1)),
    radial-gradient(circle at 72% 62%, #d19363 0 18%, transparent 19%),
    linear-gradient(135deg, #412410, #b67645);
}

.preview-blog {
  background:
    linear-gradient(90deg, rgba(84, 9, 48, 0.94), rgba(84, 9, 48, 0.78)),
    radial-gradient(circle at 24% 58%, #d7d1ca 0 16%, transparent 17%),
    linear-gradient(135deg, #5b0f3b, #12050b);
}

.runner-copy {
  display: grid;
  align-content: center;
  gap: 10px;
}

.pill,
.tags span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--blue-soft);
  color: #2e48bd;
  font-size: 12px;
  font-weight: 800;
}

.runner-copy h2 {
  font-size: 26px;
  line-height: 1.08;
}

.runner-copy p {
  color: #4f5b64;
  line-height: 1.5;
}

.runner-actions,
.button-row,
.session-actions,
.toolstrip,
.modal footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.runner-actions button,
.session-actions button,
.manager-actions button,
.toolstrip button,
.button-row button,
.modal footer button {
  padding-inline: 12px;
}

.runner-meta {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 112px;
}

.runner-meta span {
  display: grid;
  gap: 2px;
  border-radius: 8px;
  padding: 10px;
  background: #f3f6f8;
  color: var(--muted);
  font-size: 12px;
}

.runner-meta strong {
  color: var(--ink);
  font-size: 16px;
}

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

.blueprint-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(33, 43, 53, 0.07);
}

.blueprint-card.is-hidden {
  display: none;
}

.blueprint-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(56, 88, 233, 0.14), 0 10px 26px rgba(33, 43, 53, 0.08);
}

.card-image {
  min-height: 150px;
  border: 0;
  border-radius: 0;
}

.card-body {
  display: grid;
  grid-template-rows: minmax(98px, auto) auto auto;
  gap: 10px;
  padding: 12px;
}

.card-body h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.card-body p {
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tags span {
  background: #eef1f4;
  color: #56626c;
  font-weight: 700;
}

.card-body button {
  width: 100%;
  border-color: #c7d1da;
  background: #f8fafb;
  font-weight: 800;
}

.quick-starts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quick-starts button {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
  text-align: left;
  background: #151c21;
  color: #fff;
}

.quick-starts span {
  color: #aeb8c1;
  font-size: 12px;
}

.quick-starts strong {
  overflow-wrap: anywhere;
}

.session-panel {
  grid-column: 3;
  grid-row: 2;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
  background: #eef2f5;
}

.session-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.session-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mini-browser {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-browser-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--chrome-2);
  color: #dfe7ee;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.mini-page {
  min-height: 180px;
  padding: 18px;
  background:
    radial-gradient(circle at 96% 54%, rgba(43, 223, 115, 0.82) 0 28%, transparent 29%),
    #fff;
}

.mini-page h3 {
  max-width: 190px;
  margin: 52px 0 10px;
  color: #3154ef;
  font-size: 25px;
  font-family: Georgia, serif;
  line-height: 1.08;
}

.mini-page p {
  max-width: 230px;
  color: #111;
  line-height: 1.38;
}

.session-actions {
  margin-top: 12px;
}

.save-state .section-title,
.session-card .section-title {
  margin-bottom: 12px;
}

.section-title button {
  min-height: 30px;
  padding-inline: 9px;
  color: #2854c7;
}

.radio-row,
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: #34404a;
}

.radio-row input,
.check input {
  width: auto;
  min-height: auto;
}

.progress {
  overflow: hidden;
  height: 9px;
  margin: 12px 0 8px;
  border-radius: 999px;
  background: #e5ebf0;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.saved-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.saved-row:first-of-type {
  border-top: 0;
}

.site-icon {
  width: 32px;
  height: 32px;
  border-color: #c5d0d8;
}

.site-icon.blue {
  background: #2d4e9e;
}

.saved-row strong,
.saved-row small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.manager {
  grid-column: 2 / 4;
  grid-row: 3;
  padding: 20px 24px 26px;
  background: #fff;
}

.manager-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.manager-header h2 {
  font-size: 24px;
  line-height: 1.15;
}

.manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manager-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.manager-tabs {
  display: grid;
  align-content: start;
  background: #f2f5f7;
}

.manager-tabs button {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.manager-tabs button.is-active {
  background: #fff;
  box-shadow: inset 4px 0 0 var(--blue);
}

.tab-panel {
  display: none;
  min-width: 0;
  padding: 18px;
}

.tab-panel.is-active {
  display: block;
}

.notice {
  margin-bottom: 16px;
  border-left: 4px solid #0e86c6;
  padding: 14px;
  background: #f0f5ff;
  color: #34404a;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.settings-grid .check {
  align-self: end;
  min-height: 38px;
  margin: 0;
}

.toolstrip {
  margin-bottom: 12px;
}

.code-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.file-tree {
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #f5f7f9;
  border-right: 1px solid var(--line);
}

.file-tree li {
  padding: 8px 10px;
  border-radius: 5px;
  color: #303a42;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.file-tree .selected {
  background: #e5edff;
  color: #1d3bb2;
  font-weight: 800;
}

.code-pane {
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: #12181d;
  color: #d7e1e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
}

.database-card {
  max-width: 840px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: #f8fafb;
}

.database-card h3 {
  margin-bottom: 10px;
}

.database-card p {
  margin-bottom: 14px;
  color: #4d5962;
  line-height: 1.5;
}

dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0 0 16px;
}

dt {
  font-weight: 800;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.logs-grid article {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #f8fafb;
}

.logs-grid h3 {
  margin-bottom: 10px;
}

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 30;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 6px;
  background: rgba(21, 28, 33, 0.96);
  box-shadow: var(--shadow);
}

.bottom-nav button {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  color: #c7d1da;
  font-size: 13px;
  font-weight: 800;
}

.bottom-nav button.is-active {
  background: #fff;
  color: var(--ink);
}

.modal {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(11, 15, 18, 0.58);
}

.modal form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal header button {
  min-height: 30px;
  padding-inline: 9px;
}

.modal p {
  color: #4d5962;
  line-height: 1.5;
}

.modal small {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .session-panel {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manager {
    grid-column: 1 / -1;
    grid-row: 4;
  }

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

  .quick-starts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-runner {
    grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1fr);
  }

  .runner-meta {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  body {
    padding-bottom: 74px;
  }

  .app-shell {
    display: block;
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .top-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .catalog-rail {
    padding: 12px;
  }

  .rail-nav {
    display: none;
  }

  .category-list,
  .start-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .category-list button {
    white-space: nowrap;
  }

  .start-list button {
    min-width: 180px;
  }

  .marketplace,
  .manager {
    padding: 16px;
  }

  .market-header,
  .featured-runner,
  .settings-grid,
  .manager-layout,
  .code-workspace,
  .logs-grid,
  .session-panel {
    grid-template-columns: 1fr;
  }

  .market-header h1 {
    font-size: 34px;
  }

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

  .quick-starts {
    grid-template-columns: 1fr;
  }

  .session-panel {
    padding: 16px;
  }

  .manager-header {
    display: grid;
  }

  .manager-tabs {
    display: flex;
    overflow-x: auto;
  }

  .manager-tabs button {
    min-width: max-content;
    border-right: 1px solid var(--line);
  }

  .file-tree {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .bottom-nav {
    display: grid;
  }
}

@media (max-width: 520px) {
  .pathbar {
    grid-template-columns: 1fr;
  }

  .pathbar label {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 7px 10px;
  }

  .pathbar input {
    padding: 0;
  }

  .market-header h1 {
    font-size: 29px;
  }

  .runner-copy h2 {
    font-size: 24px;
  }

  .card-image {
    min-height: 148px;
  }

  .saved-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .saved-row button {
    grid-column: 1 / -1;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
