:root {
  --black: #050505;
  --paper: #f5f2ea;
  --muted: rgba(245, 242, 234, 0.68);
  --line: rgba(245, 242, 234, 0.2);
  --hot: #ff168c;
  --cyan: #00e7ff;
  --acid: #baff00;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(90deg, rgba(255, 22, 140, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(0, 231, 255, 0.07) 0 1px, transparent 1px 100%),
    var(--black);
  background-size: 42px 42px;
  font-family: Arial, "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  font-weight: 800;
}

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

button,
select,
input {
  min-height: 42px;
  border: 1px solid rgba(245, 242, 234, 0.24);
  color: var(--paper);
  background: rgba(245, 242, 234, 0.06);
}

button {
  cursor: pointer;
}

button:hover,
button:focus-visible {
  color: var(--black);
  background: var(--acid);
  border-color: var(--acid);
  outline: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.map-header {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(14px, 2.4vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.86);
}

.site-mark {
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--hot);
}

.map-header p,
.map-header h1 {
  margin: 0;
}

.map-header p {
  color: var(--acid);
  font-size: 13px;
  line-height: 1;
}

.map-header h1 {
  margin-top: 4px;
  font-size: clamp(26px, 3vw, 46px);
  line-height: 0.95;
}

.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--black);
  background: var(--hot);
  box-shadow: 5px 5px 0 var(--cyan);
  white-space: nowrap;
}

.map-app {
  min-height: calc(100svh - 78px);
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.map-app.is-viewer {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
}

.map-app.is-viewer .desk {
  cursor: pointer;
}

.circle-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.72);
  overflow-y: auto;
  max-height: calc(100svh - 78px);
}

.circle-panel[hidden] {
  display: none;
}

.circle-panel h2 {
  margin: 0;
  color: var(--cyan);
  font-size: 16px;
  line-height: 1;
}

.circle-panel-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
}

.circle-active {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--acid);
  background: rgba(186, 255, 0, 0.08);
}

.circle-active-cut {
  width: min(100%, 180px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid rgba(245, 242, 234, 0.2);
  background: rgba(245, 242, 234, 0.04);
}

.circle-active strong {
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.circle-active span {
  color: var(--acid);
  font-size: 13px;
}

.circle-active a {
  justify-self: start;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 400;
  border-bottom: 1px solid rgba(0, 231, 255, 0.45);
}

.circle-active a:hover,
.circle-active a:focus-visible {
  color: var(--black);
  background: var(--cyan);
  outline: 0;
}

.circle-panel-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.circle-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  text-align: left;
  font-size: 13px;
}

.circle-panel-list .is-active .circle-row {
  border-color: var(--acid);
  background: rgba(186, 255, 0, 0.12);
}

.circle-row-no {
  color: var(--cyan);
  font-size: 11px;
}

.circle-row:hover .circle-row-no,
.circle-row:focus-visible .circle-row-no {
  color: inherit;
}

.circle-row-name {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.circle-row-desk {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.circle-row:hover .circle-row-desk,
.circle-row:focus-visible .circle-row-desk {
  color: inherit;
}

.tool-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.72);
}

.tool-group {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tool-group h2 {
  margin: 0;
  color: var(--cyan);
  font-size: 16px;
  line-height: 1;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.publish-button {
  grid-column: 1 / -1;
  color: var(--black);
  background: var(--hot);
  border-color: var(--hot);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field select {
  width: 100%;
  padding: 0 10px;
}

.field input {
  width: 100%;
  padding: 0 10px;
}

.field-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  cursor: pointer;
}

.field-check input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--acid);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
}

.inspector {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.inspector div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

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

#layout-json {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 10px;
  color: var(--paper);
  background: rgba(245, 242, 234, 0.06);
}

.canvas-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(14px, 2vw, 24px);
}

.canvas-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--black);
  background: var(--acid);
  padding: 0 14px;
  font-size: 14px;
}

.warning-count {
  color: #b71c00;
}

.map-canvas {
  min-height: 0;
  overflow: auto;
  border: 10px solid var(--paper);
  background: var(--paper);
  box-shadow: 12px 12px 0 var(--hot), -8px -8px 0 var(--cyan);
}

.map-canvas svg {
  display: block;
  width: max(100%, 1100px);
  height: auto;
  touch-action: none;
}

.zone-label,
.desk-label,
.map-meta,
.selection-marquee,
.warning-layer,
.guide-layer {
  pointer-events: none;
  user-select: none;
}

.desk {
  cursor: grab;
}

.desk.is-selected .desk-shape {
  stroke: var(--acid);
  stroke-width: 110;
}

.desk.is-multi-selected .desk-shape {
  stroke: var(--cyan);
}

.desk.is-aisle-warning .desk-shape {
  stroke: #ff8a00;
}

.desk.is-overlap .desk-shape {
  stroke: #ff2f2f;
}

.desk:active {
  cursor: grabbing;
}

@media (max-width: 900px) {
  .map-header {
    grid-template-columns: 1fr auto;
  }

  .site-mark {
    display: none;
  }

  .map-app,
  .map-app.is-viewer {
    grid-template-columns: 1fr;
  }

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

  .circle-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none;
  }

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

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

  .back-link {
    justify-self: start;
  }

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