:root {
  color-scheme: dark;
  --bg: #101317;
  --panel: #171c22;
  --panel-2: #202730;
  --panel-3: #28313b;
  --line: #35414e;
  --line-soft: #28313b;
  --text: #eef2f6;
  --muted: #9ba7b4;
  --blue: #4f7dff;
  --cyan: #20b6d8;
  --green: #41c883;
  --amber: #f5c84c;
  --red: #f06b64;
  --violet: #9c7dff;
  --white: #ffffff;
  --shadow: 0 20px 80px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(79, 125, 255, .08), transparent 260px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

button:hover {
  border-color: #526171;
  background: #26313d;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  font-size: 25px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.22;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(16, 19, 23, .92);
  backdrop-filter: blur(16px);
}

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

.brand > div {
  min-width: 0;
}

.brand span:not(.brand-mark),
.muted {
  color: var(--muted);
}

.brand strong {
  display: block;
}

.brand-mark,
.site-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  color: var(--white);
  background: linear-gradient(135deg, #26313d, #0f1419);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.top-actions,
.identity-actions,
.two-buttons,
.file-actions,
.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary {
  border-color: transparent;
  color: #08111d;
  background: var(--amber);
  font-weight: 700;
}

.primary:hover {
  background: #ffdb72;
}

.secondary {
  border-color: rgba(32, 182, 216, .55);
  color: #dff8ff;
  background: rgba(32, 182, 216, .12);
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.danger {
  border-color: rgba(240, 107, 100, .55);
  color: #ffe6e4;
  background: rgba(240, 107, 100, .15);
}

.wide {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(420px, 1.28fr) minmax(310px, .94fr);
  grid-template-areas:
    "library launch detail"
    "manager manager manager";
  gap: 12px;
  padding: 12px;
}

.panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(23, 28, 34, .96);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.library-panel {
  grid-area: library;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.launch-panel {
  grid-area: launch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.detail-panel {
  grid-area: detail;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.manager-panel {
  grid-area: manager;
}

.panel-head,
.manager-head,
.save-title,
.preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.manager-head {
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.count,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--muted);
}

.status.ok {
  color: #cffff0;
  background: rgba(65, 200, 131, .16);
}

.status.warn {
  color: #ffe6a3;
  background: rgba(245, 200, 76, .16);
}

.search {
  position: relative;
}

.search span {
  position: absolute;
  top: 10px;
  left: 11px;
  color: #6f7b87;
}

.search input {
  padding-left: 72px;
}

.state-strip,
.manager-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip,
.manager-tabs button {
  flex: 0 0 auto;
  min-height: 31px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
}

.chip.active,
.manager-tabs button.active {
  border-color: var(--blue);
  color: var(--white);
  background: var(--blue);
}

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

.site-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px;
  background: #11171d;
}

.site-card.selected {
  border-color: rgba(79, 125, 255, .8);
  background: linear-gradient(90deg, rgba(79, 125, 255, .2), #11171d 44%);
}

.site-card.danger-line {
  border-left: 3px solid var(--amber);
}

.site-card strong {
  display: block;
  margin-bottom: 3px;
}

.site-card .muted {
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.site-icon.dark {
  background: linear-gradient(135deg, #243f69, #11161c);
}

.site-icon.files {
  background: linear-gradient(135deg, #245646, #11161c);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tags span {
  border-radius: 999px;
  padding: 3px 7px;
  color: #c9d3dd;
  background: #26303a;
  font-size: 11px;
}

.library-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

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

.route-card,
.save-option {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 102px;
  padding: 12px;
  text-align: left;
  background: #11171d;
}

.route-card span,
.save-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
}

.route-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(79, 125, 255, .35);
}

.route-detail,
.save-flow,
.identity-card,
.export-card,
.preview-card,
.destructive-box,
.database-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: #11171d;
}

.route-detail {
  display: grid;
  gap: 14px;
}

.route-copy p:not(.eyebrow),
.destructive-box p,
.database-card p,
.blueprint-detail p,
.wp-page p {
  color: var(--muted);
  line-height: 1.48;
}

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

.checkline {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
}

.checkline input {
  width: auto;
  min-height: auto;
}

.save-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.progress-card {
  display: grid;
  gap: 8px;
  border-radius: 7px;
  padding: 10px;
  background: #0f1419;
}

.progress {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #2c3540;
}

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

.notice {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.notice.success {
  color: #bff6d8;
}

.browser-bar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 7px;
}

.preview-card {
  padding: 0;
  overflow: hidden;
}

.preview-toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}

.wp-preview {
  min-height: 255px;
  color: #101317;
  background: #f9fafb;
}

.wp-adminbar {
  padding: 7px 10px;
  color: #e9edf2;
  background: #1d2327;
  font-size: 11px;
}

.wp-page {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 218px;
  padding: 28px;
}

.wp-page strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.1;
  color: #244cff;
}

.wp-page button {
  width: fit-content;
  border: none;
  color: var(--white);
  background: #3858e9;
}

.tab-content {
  display: none;
  padding: 16px;
}

.tab-content.active {
  display: block;
}

.destructive-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.destructive-box p {
  flex-basis: 100%;
}

.ide-grid {
  display: grid;
  grid-template-columns: minmax(210px, .35fr) minmax(0, 1fr);
  min-height: 360px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
}

.file-tree {
  border-right: 1px solid var(--line-soft);
  background: #0f1419;
}

.file-actions {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.file-actions button,
.stack-actions button {
  min-height: 30px;
  font-size: 12px;
}

.file-tree ul {
  list-style: none;
  margin: 0;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.file-tree li {
  border-radius: 5px;
  padding: 7px 8px;
  color: #c9d3dd;
}

.file-tree li.open,
.file-tree li.selected-file {
  color: var(--white);
  background: #202b36;
}

.stack-actions {
  padding: 10px;
  border-top: 1px solid var(--line-soft);
}

.code-pane,
.log-grid pre {
  overflow: auto;
  margin: 0;
  padding: 18px;
  color: #c8e6ff;
  background: #0b0f14;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.code-pane.json {
  color: #ffe7b7;
}

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

dt {
  color: var(--muted);
}

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

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

.log-grid pre {
  min-height: 160px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.gallery-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .35fr);
  gap: 12px;
  margin-bottom: 14px;
}

.blueprint-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
}

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

.blueprint-grid article {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #11171d;
}

.blueprint-grid article.selected {
  border-color: var(--blue);
}

.blueprint-grid strong,
.blueprint-grid span {
  display: block;
  padding: 0 10px;
}

.blueprint-grid strong {
  padding-top: 10px;
  font-size: 13px;
}

.blueprint-grid span {
  padding-top: 5px;
  padding-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
}

.thumb {
  height: 92px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(135deg, #2d3641, #11171d);
}

.thumb.art { background: linear-gradient(135deg, #8b672a, #2b8579 58%, #141a20); }
.thumb.coffee { background: linear-gradient(135deg, #4f2870, #b96b34 60%, #151a20); }
.thumb.feed { background: linear-gradient(135deg, #f5f8ff, #d8e6ff 62%, #566dff); }
.thumb.game { background: linear-gradient(135deg, #111, #922f22 52%, #e8e8e8); }
.thumb.nonprofit { background: linear-gradient(135deg, #5a2e13, #e0844b 62%, #1f242b); }
.thumb.blog { background: linear-gradient(135deg, #661c3c, #b28caf 60%, #11171d); }
.thumb.theme { background: linear-gradient(135deg, #204d64, #c0dede 60%, #112); }
.thumb.experiment { background: linear-gradient(135deg, #243a24, #9c7dff 62%, #11171d); }

.blueprint-detail {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: #11171d;
}

.blueprint-detail button {
  width: 100%;
  margin-top: 8px;
}

dialog {
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .6);
}

dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

dialog p {
  color: var(--muted);
  line-height: 1.45;
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr);
    grid-template-areas:
      "library launch"
      "detail detail"
      "manager manager";
  }

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

@media (max-width: 760px) {
  body {
    padding-bottom: 64px;
  }

  .topbar {
    position: static;
    min-height: 58px;
    padding: 10px 12px;
  }

  .brand span:not(.brand-mark),
  .top-actions .ghost {
    display: none;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .top-actions .primary {
    width: 64px;
    overflow: hidden;
    font-size: 0;
    white-space: nowrap;
  }

  .top-actions .primary::after {
    content: "New";
    font-size: 14px;
  }

  .workspace {
    display: block;
    padding: 8px;
    overflow-x: hidden;
  }

  .panel {
    display: none;
    width: 100%;
    margin-bottom: 8px;
    box-shadow: none;
    overflow: hidden;
  }

  .library-panel > *,
  .launch-panel > *,
  .detail-panel > * {
    min-width: 0;
  }

  .panel.mobile-active {
    display: flex;
  }

  .manager-panel.mobile-active {
    display: block;
  }

  .route-grid,
  .save-options,
  .form-grid,
  .settings-grid,
  .gallery-tools,
  .blueprint-layout,
  .ide-grid,
  .log-grid {
    grid-template-columns: 1fr;
  }

  .route-card,
  .save-option {
    min-height: auto;
  }

  .site-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .site-card .status {
    grid-column: 2;
    width: fit-content;
  }

  .browser-bar {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .browser-bar button:nth-of-type(n+2) {
    grid-column: auto;
  }

  .manager-head {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .code-pane {
    max-height: 330px;
  }

  .database-card dl,
  .blueprint-detail dl {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft);
    background: rgba(16, 19, 23, .96);
    backdrop-filter: blur(16px);
  }

  .bottom-nav button {
    overflow: hidden;
    min-height: 42px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav button.active {
    border-color: var(--blue);
    color: var(--white);
    background: var(--blue);
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: 22px;
  }

  .library-panel,
  .launch-panel,
  .detail-panel,
  .tab-content {
    padding: 12px;
  }

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

  .library-actions,
  .two-buttons {
    grid-template-columns: 1fr;
  }
}
