:root {
  color-scheme: dark;
  --bg: #080b0d;
  --panel: #101417;
  --panel-soft: #141b1e;
  --line: #253034;
  --text: #e9f0ed;
  --muted: #91a19a;
  --accent: #b9dfcf;
  --accent-strong: #6fe0bb;
  --warning: #d6a348;
  --danger: #f06f6f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(64, 133, 117, 0.2), transparent 34rem),
    linear-gradient(145deg, #060708, #101418 58%, #070a0c);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  background: rgba(16, 20, 23, 0.88);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 32px;
}

.login-card h1 {
  margin: 0 0 28px;
  font-size: 34px;
  line-height: 1.1;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0e10;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(111, 224, 187, 0.62);
  box-shadow: 0 0 0 3px rgba(111, 224, 187, 0.11);
}

.login-card button,
.primary,
.primary-action {
  border: 0;
  border-radius: 8px;
  color: #06110d;
  background: linear-gradient(135deg, #dceee6, #78e4c0);
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
}

.login-card button {
  width: 100%;
  margin-top: 18px;
}

.secondary,
.ghost-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1113;
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
}

.form-message {
  min-height: 20px;
  color: var(--danger);
}

.studio-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: rgba(8, 11, 13, 0.88);
  padding: 22px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #17352e;
  color: var(--accent-strong);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

#projectList {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.project-item {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 12px;
}

.project-item.active {
  border-color: rgba(111, 224, 187, 0.72);
  background: #11201c;
}

.project-item strong,
.project-item span {
  display: block;
}

.project-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
}

.publish-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 23, 0.84);
  box-shadow: var(--shadow);
}

.template-panel {
  padding: 18px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.template-card {
  min-height: 150px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1012;
  color: var(--text);
  padding: 14px;
}

.template-card.active {
  border-color: rgba(111, 224, 187, 0.72);
  background: #11201c;
}

.template-card strong,
.template-card small,
.template-card span {
  display: block;
}

.template-card small {
  margin: 6px 0 12px;
  color: var(--accent);
}

.template-card span {
  color: var(--muted);
  line-height: 1.5;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}

.editor-panel,
.publish-panel {
  padding: 18px;
}

.button-row {
  display: flex;
  gap: 10px;
}

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

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

.section-editor {
  margin-top: 24px;
}

.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#sectionsEditor {
  display: grid;
  gap: 12px;
}

.content-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.content-section .section-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.image-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.thumb {
  width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #070a0c;
}

.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb button {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 6px;
}

.raw-json {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.raw-json textarea {
  min-height: 260px;
  margin-top: 12px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
}

.publish-panel {
  position: sticky;
  top: 28px;
  align-self: start;
}

dl {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 18px 0;
}

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

dd {
  margin: 0;
  word-break: break-all;
}

.preview-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: #18231f;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
}

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

.log-box {
  min-height: 72px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080c0e;
  color: var(--muted);
  padding: 10px;
  line-height: 1.6;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .template-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .content-section .section-form,
  .url-row,
  .form-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}
