:root {
  --bg: #f3f1ec;
  --paper: #fffefa;
  --ink: #11110f;
  --muted: #6f706b;
  --line: #d9d6ce;
  --line-dark: #343531;
  --acid: #caff31;
  --blue: #c9ddf0;
  --sidebar: #151613;
  --sans: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  --serif: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  color: inherit;
}

a {
  text-decoration: none;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 24px 20px;
  color: #f5f3ed;
  background: var(--sidebar);
}

.admin-brand {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: start;
  margin-bottom: 70px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.admin-brand sup {
  margin: -2px 0 0 4px;
  font-size: 8px;
  letter-spacing: 0;
}

.admin-brand small {
  justify-self: end;
  margin-top: 4px;
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.13em;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  width: 100%;
  padding: 13px 12px;
  color: #c8c9c4;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: color 180ms ease, background 180ms ease;
}

.nav-item span {
  font-size: 8px;
  letter-spacing: 0.1em;
}

.nav-item:hover,
.nav-item.is-active {
  color: white;
  background: #2a2c26;
}

.sidebar-note {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line-dark);
}

.sidebar-note > span,
.eyebrow {
  font-size: 8px;
  letter-spacing: 0.15em;
}

.sidebar-note p {
  color: #9b9d96;
  font-size: 10px;
  line-height: 1.7;
}

.sidebar-note code {
  color: var(--acid);
  font-family: inherit;
}

.admin-main {
  min-height: 100vh;
  margin-left: 248px;
  padding: 22px 30px 80px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-topbar h1 {
  margin: 5px 0 0;
  font-size: 18px;
  font-weight: 500;
}

.cloud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
}

.cloud-status i {
  display: block;
  width: 7px;
  height: 7px;
  background: #e4a834;
  border-radius: 50%;
}

.cloud-status.is-online i {
  background: #6ab66a;
}

.admin-panel {
  display: none;
}

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

.panel-intro {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 50px;
  align-items: end;
  padding: 65px 0 55px;
}

.panel-intro h2 {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4vw, 62px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1.02;
}

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

.map-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 20px;
  min-height: 248px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.map-card-hero {
  grid-column: 1 / -1;
  min-height: 290px;
  color: white;
  background: linear-gradient(120deg, rgba(0,0,0,.35), rgba(0,0,0,.78)), url('/assets/mattress-play-landscape.png') center/cover;
}

.map-card-dark { color: white; background: #171815; }
.map-card-acid { background: var(--acid); }
.map-number { font-size: 10px; letter-spacing: .12em; }
.map-card h3 { margin: 10px 0 8px; font-size: 28px; letter-spacing: -.055em; }
.map-card div > span { font-size: 8px; letter-spacing: .15em; }
.map-card p { max-width: 430px; margin: 0; color: currentColor; opacity: .64; font-size: 10px; line-height: 1.8; }
.map-actions { grid-column: 2; align-self: end; display: flex; flex-wrap: wrap; gap: 7px; }
.map-actions button { padding: 9px 12px; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 999px; cursor: pointer; font-size: 9px; opacity: .8; }
.map-actions button:hover { color: #111; background: var(--acid); border-color: var(--acid); opacity: 1; }
.map-card-acid .map-actions button:hover { color: white; background: #111; border-color: #111; }

.slot-thumb { position: relative; display: block; }
.slot-thumb b { position: absolute; right: 3px; bottom: 3px; padding: 3px 4px; color: white; background: rgba(0,0,0,.7); border-radius: 3px; font-size: 6px; letter-spacing: .08em; }
.slot-kind { display: inline-flex; margin-bottom: 8px; padding: 4px 7px; color: #34500a; background: var(--acid); border-radius: 999px; font-size: 7px; letter-spacing: .1em; }
.crop-stage video { display: none; width: 100%; max-height: 540px; object-fit: contain; }
.video-help { display: none; padding: 14px 16px; margin: 0 0 14px; color: #e7e7e2; background: #242520; border-radius: 7px; }
.video-help strong { font-size: 10px; }
.video-help p { margin: 5px 0 0; color: #aaa; font-size: 9px; line-height: 1.6; }
.crop-panel.is-video .crop-stage { min-height: 420px; cursor: default; }
.crop-panel.is-video canvas,.crop-panel.is-video [data-image-controls] { display: none; }
.crop-panel.is-video .crop-stage video,.crop-panel.is-video .video-help { display: block; }
.crop-panel.is-video .crop-toolbar { justify-content: flex-end; }
.crop-panel.is-video .crop-stage-hint { display: none; }

.panel-intro > p {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.media-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.36fr) minmax(520px, 1fr);
  gap: 14px;
  align-items: start;
}

.slot-panel,
.crop-panel,
.content-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.slot-panel {
  padding: 18px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title-row h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.panel-title-row > span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.slot-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease;
}

.slot-item:hover,
.slot-item.is-active {
  background: #f0f2e9;
  border-color: #c8d29d;
}

.slot-item img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: #ddd;
}

.slot-copy {
  min-width: 0;
}

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

.slot-copy strong {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
}

.slot-copy small {
  color: var(--muted);
  font-size: 8px;
}

.slot-ratio {
  color: var(--muted);
  font-size: 8px;
}

.ghost-button,
.replace-button,
.toolbar-link,
.secondary-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.ghost-button {
  width: 100%;
  padding: 10px;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 10px;
}

.crop-panel {
  padding: 18px;
}

.crop-title-row {
  align-items: flex-start;
}

.crop-title-row p {
  max-width: 460px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.replace-button {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: white;
  background: var(--ink);
  border-radius: 6px;
  font-size: 9px;
}

.crop-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 460px;
  margin: 14px 0;
  background:
    linear-gradient(45deg, #292a26 25%, transparent 25%),
    linear-gradient(-45deg, #292a26 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #292a26 75%),
    linear-gradient(-45deg, transparent 75%, #292a26 75%),
    #242521;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border-radius: 7px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.crop-stage.is-dragging {
  cursor: grabbing;
}

.crop-stage canvas {
  width: 100%;
  height: auto;
}

.crop-stage-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  color: white;
  background: rgba(0, 0, 0, 0.56);
  border-radius: 20px;
  font-size: 8px;
  pointer-events: none;
}

.ratio-controls {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: center;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-label span,
.control-label small {
  display: block;
}

.control-label span {
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 600;
}

.control-label small {
  color: var(--muted);
  font-size: 8px;
}

.ratio-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(54px, 1fr));
  gap: 5px;
}

.ratio-buttons button {
  padding: 9px 5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-size: 9px;
}

.ratio-buttons button:hover,
.ratio-buttons button.is-active {
  color: var(--ink);
  background: var(--acid);
  border-color: #b3d84a;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-top: 15px;
}

.zoom-control {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 42px;
  align-items: center;
  gap: 12px;
  flex: 1;
  font-size: 9px;
}

.zoom-control input {
  width: 100%;
  accent-color: #7f982d;
}

.zoom-control output {
  color: var(--muted);
  text-align: right;
}

.toolbar-link {
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.primary-button,
.secondary-button {
  padding: 11px 17px;
  border-radius: 6px;
  font-size: 10px;
}

.primary-button {
  color: var(--ink);
  background: var(--acid);
}

.secondary-button {
  color: white;
  background: var(--ink);
}

.save-feedback {
  min-height: 20px;
  padding-top: 10px;
  color: #57701a;
  font-size: 9px;
}

.save-feedback.is-error {
  color: #a24c3d;
}

.project-intro { padding-bottom: 35px; }
.project-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:8px; padding:14px; margin-bottom:12px; background:var(--paper); border:1px solid var(--line); border-radius:10px; }
.project-toolbar>div { display:flex; flex-direction:column; gap:4px; margin-right:auto; }
.project-toolbar strong { font-size:11px; }
.project-toolbar span { color:var(--muted); font-size:8px; }
.project-workspace { display:grid; grid-template-columns:300px minmax(0,1fr); gap:12px; align-items:start; }
.project-list-panel,.project-editor { background:var(--paper); border:1px solid var(--line); border-radius:10px; }
.project-list-panel { position:sticky; top:18px; padding:14px; }
.project-filter { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; margin-bottom:12px; }
.project-filter button { padding:8px 4px; color:var(--muted); background:var(--bg); border:1px solid var(--line); border-radius:5px; cursor:pointer; font-size:8px; }
.project-filter button.is-active { color:var(--ink); background:var(--acid); border-color:#b3d84a; }
.project-list { display:flex; flex-direction:column; gap:5px; max-height:70vh; overflow:auto; }
.project-list-item { display:grid; grid-template-columns:56px minmax(0,1fr) auto; gap:10px; align-items:center; width:100%; padding:7px; color:var(--ink); background:transparent; border:1px solid transparent; border-radius:7px; cursor:pointer; text-align:left; }
.project-list-item:hover,.project-list-item.is-active { background:#f0f2e9; border-color:#c8d29d; }
.project-list-item img { width:56px; height:44px; object-fit:cover; border-radius:4px; background:#ddd; }
.project-list-item strong,.project-list-item small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-list-item strong { margin-bottom:4px; font-size:10px; font-weight:600; }
.project-list-item small { color:var(--muted); font-size:8px; }
.project-list-item b { padding:4px 6px; color:#46610c; background:#ddf2a2; border-radius:999px; font-size:6px; letter-spacing:.08em; }
.project-list-item.is-draft b { color:#7d6650; background:#eee1d2; }
.project-editor { padding:22px; }
.project-editor-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.project-editor-head h3 { margin:7px 0 0; font-size:28px; letter-spacing:-.055em; }
.project-head-actions { display:flex; align-items:center; gap:7px; }
.danger-button { padding:9px 12px; color:#9d3e35; background:#fff4f1; border:1px solid #ead2cc; border-radius:6px; cursor:pointer; font-size:9px; }
.project-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; padding:24px 0; }
.project-form-grid label { display:flex; flex-direction:column; gap:7px; }
.project-form-grid label>span,.focal-controls label>span { font-size:9px; font-weight:600; }
.project-form-grid input,.project-form-grid select,.project-form-grid textarea { width:100%; padding:11px 12px; color:var(--ink); background:var(--bg); border:1px solid var(--line); border-radius:5px; outline:0; resize:vertical; }
.project-form-grid input:focus,.project-form-grid select:focus,.project-form-grid textarea:focus { border-color:#89975d; box-shadow:0 0 0 3px rgba(137,151,93,.12); }
.project-summary { grid-column:1/-1; }
.publish-switch { grid-column:1/-1; display:grid!important; grid-template-columns:auto 1fr; align-items:center; justify-content:start; padding:12px; background:#f0f2e9; border-radius:6px; }
.publish-switch input { grid-row:1/3; width:auto; accent-color:#6c8124; }
.publish-switch small { color:var(--muted); font-size:8px; }
.project-cover-section,.project-gallery-section { padding:24px 0; border-top:1px solid var(--line); }
.project-section-title { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:15px; }
.project-section-title>div { display:flex; align-items:center; gap:10px; }
.project-section-title>div>span { display:grid; place-items:center; width:24px; height:24px; border:1px solid var(--line); border-radius:50%; font-size:7px; }
.project-section-title h4 { margin:0; font-size:12px; }
.project-cover-layout { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(220px,.6fr); gap:18px; }
.project-cover-preview { position:relative; min-height:360px; margin:0; overflow:hidden; background:#222; border-radius:7px; }
.project-cover-preview img,.project-cover-preview video { width:100%; height:100%; min-height:360px; object-fit:cover; }
.project-cover-preview video { display:none; }
.project-cover-preview.is-video img { display:none; }
.project-cover-preview.is-video video { display:block; }
.project-cover-preview figcaption { position:absolute; right:10px; bottom:10px; left:10px; display:flex; justify-content:space-between; padding:8px 10px; color:white; background:rgba(0,0,0,.58); border-radius:4px; font-size:7px; letter-spacing:.1em; }
.focal-controls { align-self:end; padding:18px; background:var(--bg); border-radius:7px; }
.focal-controls>p { margin:0 0 22px; color:var(--muted); font-size:9px; line-height:1.7; }
.focal-controls label { display:grid; grid-template-columns:1fr 42px; gap:7px; align-items:center; margin-top:15px; }
.focal-controls input { grid-column:1/-1; width:100%; accent-color:#758a2c; }
.focal-controls output { justify-self:end; color:var(--muted); font-size:8px; }
.gallery-help { margin:-5px 0 16px; color:var(--muted); font-size:8px; }
.project-media-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.project-media-item { overflow:hidden; background:var(--bg); border:1px solid var(--line); border-radius:7px; }
.project-media-visual { position:relative; aspect-ratio:4/3; overflow:hidden; background:#222; }
.project-media-visual img,.project-media-visual video { width:100%; height:100%; object-fit:cover; }
.project-media-visual video { display:none; }
.project-media-item.is-video img { display:none; }
.project-media-item.is-video video { display:block; }
.project-media-visual span { position:absolute; top:7px; left:7px; padding:4px 6px; color:white; background:rgba(0,0,0,.68); border-radius:3px; font-size:6px; }
.project-media-actions { display:grid; grid-template-columns:auto 1fr auto auto; gap:3px; padding:5px; }
.project-media-actions button { padding:7px 5px; color:var(--muted); background:var(--paper); border:1px solid var(--line); border-radius:4px; cursor:pointer; font-size:7px; }
.project-media-actions [data-media-remove] { color:#9d3e35; }
.project-save-bar { position:sticky; bottom:0; display:flex; align-items:center; justify-content:flex-end; gap:18px; padding:14px 0 0; background:linear-gradient(transparent,var(--paper) 24%); }
.project-save-bar p { min-height:18px; margin:0 auto 0 0; color:#57701a; font-size:9px; }
.project-empty { padding:50px 20px; color:var(--muted); border:1px dashed var(--line); border-radius:7px; font-size:10px; text-align:center; }

.content-form {
  padding: 28px;
}

.content-form fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 0 0 45px;
  margin: 0 0 40px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.content-form legend {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 15px;
  font-family: var(--serif);
  font-size: 24px;
}

.content-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.content-form label > span {
  font-size: 10px;
  font-weight: 600;
}

.content-form label small {
  color: var(--muted);
  font-size: 8px;
}

.content-form input,
.content-form textarea {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
  resize: vertical;
}

.content-form input:focus,
.content-form textarea:focus {
  border-color: #89975d;
  box-shadow: 0 0 0 3px rgba(137, 151, 93, 0.12);
}

.content-form .full-field {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions p {
  max-width: 440px;
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 1100px) {
  .admin-sidebar {
    position: static;
    width: 100%;
    padding: 16px;
  }

  .admin-brand {
    margin-bottom: 18px;
  }

  .admin-sidebar nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .nav-item {
    min-width: 150px;
  }

  .sidebar-note {
    display: none;
  }

  .admin-main {
    margin-left: 0;
    padding: 18px;
  }

  .media-workspace {
    grid-template-columns: 1fr;
  }

  .project-workspace { grid-template-columns:1fr; }
  .project-list-panel { position:static; }
  .project-list { display:grid; grid-template-columns:repeat(2,1fr); max-height:none; }

  .slot-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .page-map { grid-template-columns: 1fr; }
  .map-card-hero { grid-column: auto; }
  .panel-intro {
    grid-template-columns: 1fr;
  }

  .crop-stage {
    min-height: 300px;
  }

  .ratio-controls {
    grid-template-columns: 1fr;
  }

  .ratio-buttons {
    grid-template-columns: repeat(4, 1fr);
  }

  .crop-toolbar {
    flex-wrap: wrap;
  }

  .zoom-control {
    flex-basis: 100%;
  }

  .content-form {
    padding: 18px;
  }

  .content-form fieldset {
    grid-template-columns: 1fr;
  }

  .content-form .full-field {
    grid-column: auto;
  }

  .project-toolbar,.project-editor-head { align-items:stretch; flex-direction:column; }
  .project-head-actions { flex-wrap:wrap; }
  .project-form-grid,.project-cover-layout { grid-template-columns:1fr; }
  .project-summary,.publish-switch { grid-column:auto; }
  .project-media-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions p {
    flex-basis: 100%;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .admin-topbar,
  .panel-title-row {
    align-items: flex-start;
  }

  .cloud-status {
    display: none;
  }

  .slot-list {
    grid-template-columns: 1fr;
  }
}
