:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #0b171b;
  color: #ecf3ed;
  --mint: #a6e4c7;
  --line: #314549;
}
#tabs svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.map-tool-toggle,
.editor-sections {
  display: none;
}
#statusDialog {
  color: #e5f3ee;
  background: #192f39;
  border: 1px solid #46656a;
  border-radius: 20px;
  max-width: calc(100vw - 32px);
}
#statusDialog::backdrop {
  background: #07151cbb;
  backdrop-filter: blur(5px);
}
.save-feedback {
  display: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at top left, #183d3d, transparent 60%);
  min-height: 100dvh;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #5b8379;
  border-radius: 12px;
  background: #213d3d;
  color: #f2f7ee;
  cursor: pointer;
}
button:hover,
button[aria-pressed="true"] {
  background: #a6e4c7;
  color: #102222;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
a {
  color: var(--mint);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  color: #fff;
}
.brand img {
  width: 34px;
}
.brand span {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--mint);
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}
.welcome {
  max-width: 650px;
  margin: 5vh auto;
}
.welcome h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: -2px;
}
.welcome p {
  line-height: 1.6;
  color: #b9cccc;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e5bb76 !important;
  margin: 0 0 8px;
}
h1 {
  font-size: 28px;
  margin: 0;
}
h2 {
  font-size: 23px;
  margin-top: 0;
}
label {
  display: block;
  color: #bdd0cf;
  font-size: 14px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #42615e;
  border-radius: 10px;
  background: #0e2027;
  color: #eef8f1;
  padding: 12px;
  margin: 7px 0;
  min-height: 46px;
}
textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}
.welcome button {
  width: 100%;
  background: var(--mint);
  color: #102222;
  font-weight: 700;
  margin-top: 12px;
}
.toolbar,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.toolbar {
  flex-wrap: wrap;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0;
}
.metrics div {
  padding: 17px;
  background: #152b30;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.metrics strong {
  display: block;
  font-size: 25px;
  color: #e9c181;
}
.metrics span {
  font-size: 12px;
  color: #b0c7c6;
}
nav {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 14px;
}
nav button {
  white-space: nowrap;
}
.editor-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
}
aside,
.detail {
  background: #102229e8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  min-width: 0;
}
aside {
  max-height: 75vh;
  overflow: auto;
}
#library {
  display: grid;
  gap: 8px;
}
.entry {
  text-align: left;
  display: block;
  width: 100%;
  background: #193036;
  border-color: #334d50;
}
.entry small {
  display: block;
  color: #b7c5bf;
  font-size: 11px;
  margin-top: 4px;
}
.field {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.field small {
  color: #a5bcb9;
}
.context {
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #b2c5c2;
}
.help {
  line-height: 1.55;
  color: #bdd0cb;
}
.badge {
  color: #edc07e;
  font-size: 12px;
}
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}
.art-card {
  text-align: center;
  padding: 8px;
  background: #1a3438;
  border-radius: 10px;
}
.art-card canvas {
  display: block;
  width: 64px;
  height: 64px;
  margin: auto;
  image-rendering: pixelated;
}
.art-card small {
  display: block;
  color: #c4d3cf;
}
.map-canvas {
  width: 100%;
  height: 55vh;
  min-height: 280px;
  border-radius: 12px;
  background: #081418;
  touch-action: none;
}
.map-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 14px;
}
.map-tools label {
  min-width: 90px;
  flex: 1;
}
.notice {
  padding: 14px;
  border: 1px solid #8b744e;
  border-radius: 10px;
  color: #e9d1a1;
  line-height: 1.5;
}
#status {
  position: sticky;
  bottom: 8px;
  border: 1px solid #466661;
  background: #18312ff5;
  color: #d9ece0;
  border-radius: 12px;
  padding: 14px;
  z-index: 3;
  box-shadow: 0 8px 32px #0008;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #edc07e;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  main {
    padding: 16px 12px;
  }
  .brand span {
    display: none;
  }
  header {
    padding: 12px;
  }
  .toolbar h1 {
    font-size: 23px;
  }
  .actions {
    width: 100%;
  }
  .actions button {
    flex: 1;
    padding: 10px 7px;
    font-size: 13px;
  }
  .metrics {
    gap: 6px;
  }
  .metrics div {
    padding: 10px;
  }
  .metrics strong {
    font-size: 21px;
  }
  .metrics span {
    font-size: 10px;
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
  aside {
    max-height: 230px;
    padding: 12px;
  }
  #library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .entry {
    font-size: 12px;
    padding: 10px;
    overflow-wrap: anywhere;
  }
  .detail {
    padding: 14px;
  }
  nav button {
    padding: 9px 12px;
    font-size: 13px;
  }
  .map-canvas {
    height: 48vh;
  }
  .context {
    font-size: 11px;
  }
  .welcome {
    margin: 4vh auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

.detail:fullscreen {
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: auto;
}
.detail:fullscreen .map-canvas {
  flex: 1;
  min-height: 180px;
  height: auto;
}

/* A content browser followed by one focused editor on phones. */
:root {
  --mint: #9aefd4;
  --line: #2b4148;
}
body {
  background:
    radial-gradient(ellipse at top right, #234550 0, transparent 48%), #101b24;
}
header {
  background: #101b24cc;
}
button {
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:active {
  background: #47756b;
}
input,
select,
textarea {
  font-size: 16px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
.metrics {
  display: flex;
  gap: 18px;
  margin: 16px 0;
}
.metrics div {
  padding: 0;
  background: none;
  border: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.metrics strong {
  font-size: 17px;
  color: var(--mint);
}
.metrics span {
  font-size: 12px;
}
#status {
  position: static;
  box-shadow: none;
  background: #162a32;
  border-color: #30454c;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.back-button {
  display: none;
}
.coordinate-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}
.coordinate-fields label + label {
  margin-top: 0;
}
.form-section,
.offer-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
  background: #152b34;
}
summary {
  cursor: pointer;
  min-height: 44px;
  align-content: center;
  color: #e4f6ee;
  font-weight: 650;
}
details[open] > summary {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.offer-card summary {
  color: #d6eddf;
}
.form-section h3 {
  margin: 0 0 18px;
  color: #9aefd4;
}
.form-section label + label {
  margin-top: 14px;
}
.entry {
  padding: 16px;
  min-height: 64px;
  border-radius: 14px;
}
.entry small {
  font-size: 12px;
  line-height: 1.4;
}
.help,
.notice {
  font-size: 14px;
}
#saveDraft {
  background: var(--mint);
  color: #102222;
  border-color: var(--mint);
  font-weight: 750;
}
#tabs {
  scrollbar-width: thin;
}
@media (max-width: 700px) {
  body {
    padding-bottom: calc(124px + env(safe-area-inset-bottom));
  }
  header {
    padding: 12px 16px;
  }
  main {
    padding: 16px;
  }
  .toolbar .eyebrow {
    display: none;
  }
  .toolbar h1 {
    font-size: 26px;
    letter-spacing: -0.8px;
  }
  .metrics {
    flex-wrap: wrap;
    gap: 5px 14px;
    margin: 12px 0 18px;
  }
  .metrics div:nth-child(-n + 2) {
    display: none;
  }
  .actions {
    position: fixed;
    flex-wrap: wrap;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    background: #102229f5;
    border-top: 1px solid #39515a;
    z-index: 10;
    box-shadow: 0 -8px 28px #0003;
  }
  .actions button {
    font-size: 13px;
    min-height: 48px;
    border-radius: 12px;
  }
  .actions .save-feedback {
    display: block;
    flex: 0 0 100%;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b9d7cd;
    font-size: 12px;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    margin-bottom: 16px;
    padding: 0;
  }
  #tabs button {
    min-width: 0;
    white-space: normal;
    font-size: 12px;
    padding: 8px 3px;
    line-height: 1.3;
    border-color: transparent;
    background: #1b303a;
    color: #b9cbce;
  }
  #tabs button[aria-pressed="true"] {
    color: #102222;
    background: var(--mint);
    font-weight: 750;
  }
  aside {
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    background: none;
  }
  #search {
    margin: 8px 0 16px;
    background: #172b34;
  }
  #library {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .entry {
    font-size: 15px;
    padding: 16px;
    background: linear-gradient(115deg, #1c3540, #192d35);
  }
  .entry small {
    font-size: 12px;
  }
  .detail {
    display: none;
    border: 0;
    background: none;
    padding: 0;
  }
  .detail-open .detail {
    display: block;
  }
  .detail-open aside {
    display: none;
  }
  .detail-open .back-button {
    display: block;
    margin: 0 0 18px;
    background: none;
    border: 0;
    padding: 0;
    color: var(--mint);
  }
  .detail-open[data-section="art"] aside {
    display: block;
  }
  .detail-open[data-section="art"] #library {
    display: none;
  }
  .detail h2 {
    font-size: 24px;
    letter-spacing: -0.6px;
    overflow-wrap: anywhere;
  }
  .detail > label {
    margin: 18px 0;
  }
  .form-section,
  .offer-card {
    padding: 14px;
  }
  .notice {
    background: #273331;
    border-color: #596447;
    padding: 12px;
    font-size: 13px;
  }
  .map-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .map-tools > * {
    min-width: 0 !important;
  }
  .map-tools button {
    padding: 8px;
    font-size: 13px;
  }
  .map-canvas {
    height: 56dvh;
    min-height: 280px;
  }
  #status {
    margin: 20px 0 0;
    padding: 12px;
  }
}
/* Screen-sized phone workbench. Only the content panes scroll. */
@media (max-width: 700px), (max-height: 500px) and (max-width: 1000px) {
  body.studio-ready {
    height: 100dvh;
    overflow: hidden;
    padding: 0;
  }
  .studio-ready > header {
    height: 48px;
    padding: 8px 12px;
  }
  .studio-ready > header .brand {
    font-size: 14px;
  }
  .studio-ready > header img {
    width: 28px;
  }
  .studio-ready > header > a:last-child {
    font-size: 12px;
  }
  .studio-ready main {
    height: calc(100dvh - 48px);
    padding: 8px 12px calc(112px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .studio-ready #workspace {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 8px;
  }
  .studio-ready .toolbar {
    display: contents;
  }
  .studio-ready .toolbar > div:first-child,
  .studio-ready .metrics {
    display: none;
  }
  .studio-ready .actions {
    gap: 6px;
  }
  .studio-ready #tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    flex: none;
    gap: 4px;
    margin: 0;
    padding: 0 0 3px;
    scrollbar-width: none;
  }
  .studio-ready #tabs button {
    flex: 0 0 66px;
    flex-direction: column;
    gap: 5px;
    min-height: 64px;
    font-size: 10px;
    line-height: 1.1;
    padding: 6px 2px;
    border-radius: 12px;
  }
  .studio-ready #tabs button[aria-pressed="true"] {
    box-shadow: inset 0 -3px #d8eebc;
  }
  .studio-ready .back-button {
    flex: none;
    min-height: 32px;
    margin: 0;
    font-size: 13px;
  }
  .studio-ready .editor-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
  }
  .studio-ready aside {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    padding: 0;
    background: none;
  }
  .studio-ready #searchLabel {
    flex: none;
    font-size: 12px;
  }
  .studio-ready #search {
    margin: 5px 0 10px;
    min-height: 44px;
    padding: 10px 12px;
  }
  .studio-ready #library {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .studio-ready #library .entry {
    flex: none;
  }
  .studio-ready .detail {
    display: none;
    min-height: 0;
    width: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding: 12px;
    padding: 0 2px 16px;
  }
  .studio-ready.detail-open aside {
    display: none;
  }
  .studio-ready.detail-open .detail {
    display: block;
  }
  .studio-ready.detail-open[data-section="art"] .editor-layout {
    flex-direction: column;
  }
  .studio-ready.detail-open[data-section="art"] aside {
    height: auto;
    flex: none;
  }
  .studio-ready.detail-open[data-section="art"] .detail {
    flex: 1;
  }
  .studio-ready #status {
    display: none;
  }
  .studio-ready .detail h2 {
    font-size: 20px;
    margin: 0 0 10px;
  }
  .studio-ready .detail > .eyebrow,
  .studio-ready .sectioned-editor > .help {
    display: none;
  }
  .studio-ready .sectioned-editor {
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
  }
  .studio-ready:not(.detail-open) .sectioned-editor {
    display: none !important;
  }
  .studio-ready .editor-sections {
    display: flex;
    flex: none;
    gap: 5px;
    overflow-x: auto;
    padding: 0 0 8px;
    margin: 0;
  }
  .studio-ready .editor-sections button {
    flex: 1;
    min-width: 68px;
    min-height: 42px;
    padding: 6px;
    font-size: 12px;
    border-radius: 10px;
  }
  .studio-ready .editor-section-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }
  .studio-ready .editor-section {
    display: none;
    margin: 0;
  }
  .studio-ready .editor-section[data-active="true"] {
    display: block;
  }
  .studio-ready .editor-section > summary {
    display: none;
  }
  .studio-ready .sectioned-editor > button {
    flex: none;
    min-height: 38px;
    font-size: 12px;
    margin: 5px 0;
    color: #edb5ab;
    background: transparent;
  }
  .studio-ready.detail-open .map-view {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: 0;
    gap: 6px;
  }
  .studio-ready .map-view h2 {
    flex: none;
    font-size: 14px;
    margin: 0;
  }
  .studio-ready .map-tool-toggle {
    display: block;
    flex: none;
    min-height: 40px;
    padding: 6px 12px;
    text-align: left;
    background: #244b51;
    color: #bcf4df;
  }
  .studio-ready .map-canvas {
    flex: 1;
    min-height: 80px;
    height: 0;
    border: 1px solid #52756d;
  }
  .studio-ready .map-view .map-tools {
    display: none;
    position: absolute;
    top: 66px;
    left: 6px;
    right: 6px;
    z-index: 4;
    max-height: 65%;
    overflow: auto;
    padding: 12px;
    background: #152f39f5;
    border: 1px solid #638c86;
    border-radius: 16px;
    box-shadow: 0 12px 32px #0008;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .studio-ready .map-view.tools-open .map-tools {
    display: grid;
  }
  .studio-ready .map-palette {
    position: absolute;
    inset: 65px 6px 6px;
    z-index: 5;
    background: #142c35;
    border: 1px solid #638c86;
    border-radius: 16px;
    padding: 10px;
    overflow: auto;
  }
  .studio-ready .map-palette .art-grid {
    max-height: none !important;
  }
  .studio-ready .map-view:fullscreen {
    padding: 12px;
  }
  .studio-ready .map-view:fullscreen .map-canvas {
    min-height: 0;
  }
}
@media (max-height: 500px) and (max-width: 1000px) {
  .studio-ready > header {
    display: none;
  }
  .studio-ready main {
    height: 100dvh;
    padding: 6px 12px 82px;
  }
  .studio-ready #tabs button {
    flex-direction: row;
    flex-basis: auto;
    min-height: 40px;
    padding: 5px 10px;
  }
  .studio-ready #tabs svg {
    width: 20px;
    height: 20px;
  }
  .studio-ready #tabs {
    gap: 4px;
  }
  .studio-ready .actions {
    padding: 5px 12px;
  }
  .studio-ready .actions button {
    min-height: 40px;
  }
  .studio-ready .actions .save-feedback {
    min-height: 18px;
  }
}
@media (max-width: 700px), (max-height: 500px) and (max-width: 1000px) {
  .studio-ready .coordinate-fields > label + label {
    margin-top: 0;
  }
  .studio-ready .sectioned-editor .offer-card {
    margin: 10px 0;
  }
}
.map-quick-tools {
  display: none;
}
@media (max-width: 700px), (max-height: 500px) and (max-width: 1000px) {
  .map-quick-tools {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 5px;
    background: #102b35ed;
    border: 1px solid #527b79;
    border-radius: 16px;
    box-shadow: 0 6px 24px #0007;
  }
  .map-quick-tools button {
    min-width: 46px;
    min-height: 44px;
    padding: 9px;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
  }
  .map-quick-tools button[aria-pressed="true"] {
    background: #9aefd4;
    color: #102229;
  }
  .map-quick-tools svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}
.map-toolbar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex: none;
  min-width: 0;
}
.choose-map-brush {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  flex: 1;
  text-align: left;
  padding: 4px 10px;
  background: #25473f;
  border-color: #93bca5;
}
.choose-map-brush canvas {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
  flex: none;
}
.choose-map-brush span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.choose-map-brush::after {
  content: "▾";
  margin-left: auto;
  color: #b9efd3;
}
.brush-categories {
  display: flex;
  gap: 6px;
  overflow: visible;
  padding: 8px 0;
}
.brush-categories button {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 8px 5px;
}
@media (max-width: 700px), (max-height: 500px) and (max-width: 1000px) {
  .studio-ready .map-toolbar .map-tool-toggle {
    flex: 0 0 auto;
    text-align: center;
    padding: 6px 10px;
    font-size: 12px;
  }
  .studio-ready .map-toolbar {
    min-height: 44px;
  }
  .studio-ready .map-palette {
    top: 70px;
  }
  .studio-ready .map-palette > button {
    min-height: 40px;
  }
}
.npc-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.npc-live-preview {
  width: 96px;
  height: 80px;
  flex: none;
  image-rendering: pixelated;
  background: radial-gradient(ellipse at bottom, #335b55, #112832);
  border: 1px solid #54746b;
  border-radius: 14px;
}
@media (max-height: 500px) {
  .npc-live-preview {
    width: 67px;
    height: 56px;
  }
}
