:root {
  --bg: #f5f3ec;
  --paper: #fffef9;
  --ink: #303b32;
  --muted: #8a8f80;
  --line: #e3e4d8;
  --green: #3e5949;
  --mint: #e7eddf;
  --orange: #bb6848;
  --serif: Georgia, "Times New Roman", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    13px/1.5 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  border-radius: 7px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #e8ebdf;
}
button:active {
  transform: translateY(1px);
}
button:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 2px solid #ba684a;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
button.primary {
  background: var(--green);
  color: #fff;
  padding: 11px 19px;
}
button.primary:hover {
  background: #294433;
}
.outline {
  border-color: #d5d9ca;
  background: #fffdf7;
  padding: 9px 14px;
}
.quiet {
  padding: 10px 14px;
}
.round {
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 32px;
  height: 32px;
}
.topbar {
  height: 79px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: #faf9f3;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 750;
  font-size: 27px;
  letter-spacing: -1.4px;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 37px;
  font-weight: 900;
  line-height: 1;
  position: relative;
  padding-right: 5px;
}
.brand-mark > span {
  position: absolute;
  right: -2px;
  top: -5px;
  font: 15px system-ui;
  color: var(--orange);
}
.brand .beta {
  font: 8px system-ui;
  letter-spacing: 1.7px;
  background: #ebeede;
  padding: 4px 6px;
  margin: 6px 0 0 5px;
  border-radius: 4px;
}
.top-note {
  color: #8a8e80;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
}
.topbar nav {
  display: flex;
  gap: 13px;
}
main {
  max-width: 1800px;
  margin: auto;
  padding: 30px 32px 16px;
}
.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
}
.eyebrow {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.7px;
  color: #858c79;
}
.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
#world-name {
  font-family: var(--serif);
  font-size: 31px;
  color: var(--ink);
  border: 0;
  background: transparent;
  max-width: 310px;
  width: 230px;
  outline-offset: 0;
}
.name-pencil {
  color: #9a9d8d;
}
.save-status {
  font-size: 10px;
  color: #8a917e;
  white-space: nowrap;
}
.heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.studio {
  display: grid;
  grid-template-columns: 216px minmax(300px, 1fr) 236px;
  gap: 18px;
  min-height: 650px;
}
.tool-panel,
.world-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 19px 17px;
  display: flex;
  flex-direction: column;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-bottom: 23px;
}
.tiny {
  color: #91a183;
}
.section-label {
  display: flex;
  gap: 8px;
  font-size: 9px;
  color: #9a9e8c;
  letter-spacing: 0.3px;
  margin-bottom: 11px;
}
.section-label > span {
  font-size: 11px;
  color: #5d6858;
  font-weight: 650;
}
.era-tabs {
  display: flex;
  background: #f1f2e9;
  border-radius: 8px;
  padding: 4px;
  gap: 2px;
  margin-bottom: 23px;
}
.era-tabs button {
  width: 33.33%;
  padding: 5px 0;
  font-size: 20px;
  color: #909980;
}
.era-tabs button span {
  display: block;
  font-size: 9px;
}
.era-tabs button.active {
  background: #fffef9;
  color: var(--green);
  box-shadow: 0 1px 4px #37442c12;
}
.terrain-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.terrain-tools button {
  border: 1px solid #e6e7dd;
  padding: 7px;
  text-align: left;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.terrain-tools button.active,
.building-tools button.active,
.utility-tools button.active {
  border-color: #8ea27c;
  background: #edf2e5;
  box-shadow: inset 0 0 0 1px #a8b49a30;
}
.swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 5px;
  border: 1px solid #0000000a;
  font-size: 16px;
}
.brush-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  color: #878e7d;
  padding: 14px 0 23px;
}
.brush-size input {
  width: 64px;
  accent-color: #697f53;
  height: 3px;
}
.brush-size output {
  background: #f0f1e9;
  padding: 1px 5px;
  border-radius: 3px;
}
.building-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.building-tools button {
  padding: 4px 0;
  font-size: 9px;
  border: 1px solid transparent;
}
.building-tools canvas {
  width: 38px;
  height: 35px;
  display: block;
  margin: 0 auto 2px;
}
.utility-tools {
  display: flex;
  border-top: 1px solid var(--line);
  margin-top: 15px;
  padding-top: 12px;
  gap: 7px;
}
.utility-tools button {
  font-size: 10px;
  border: 1px solid var(--line);
  padding: 6px;
  flex: 1;
}
.tool-tip {
  background: #f4f2e9;
  border-radius: 7px;
  padding: 11px 9px;
  display: flex;
  gap: 8px;
  margin-top: 17px;
  color: #969c82;
}
.tool-tip > span {
  font-size: 20px;
  line-height: 1.2;
}
.tool-tip p {
  font-size: 10px;
  margin: 0;
  line-height: 1.65;
  color: #7b826d;
}
.local-note {
  margin-top: auto;
  padding-top: 23px;
  font-size: 9px;
  color: #77816c;
}
.local-note > span {
  color: #aaa998;
  padding-left: 12px;
}
.map-panel {
  border: 1px solid #d6ddcb;
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #dbe4c9;
  min-width: 0;
}
.map-toolbar {
  height: 54px;
  background: #fafbf5;
  border-bottom: 1px solid #dce2d2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  flex-shrink: 0;
}
.mode-switch {
  background: #eef0e6;
  border-radius: 6px;
  display: flex;
  padding: 3px;
  gap: 3px;
}
.mode-switch button {
  font-size: 11px;
  padding: 5px 12px;
  color: #8f9786;
}
.mode-switch button.active {
  background: #fffef9;
  box-shadow: 0 1px 3px #00000010;
  color: #3e5949;
}
.map-toolbar-right {
  display: flex;
  align-items: center;
  gap: 5px;
}
.map-toolbar-right > span {
  font-size: 9px;
  color: #8c9582;
  margin-right: 12px;
}
.map-toolbar-right button {
  font-size: 20px;
  padding: 1px 7px;
}
.map-toolbar-right button[aria-pressed="true"] {
  background: #dfe9d4;
}
.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 510px;
  overflow: hidden;
  background: #d8e1c7;
}
#map {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
}
.map-stamp {
  position: absolute;
  left: 21px;
  top: 20px;
  pointer-events: none;
  color: #4e6748aa;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 7px;
  letter-spacing: 1.3px;
}
.stamp-icon {
  font-size: 25px;
}
.zoom-control {
  position: absolute;
  left: 18px;
  bottom: 19px;
  background: #fffff4ec;
  border: 1px solid #c9d2bc;
  border-radius: 7px;
  display: flex;
  box-shadow: 0 2px 7px #334d2912;
}
.zoom-control button {
  padding: 6px 11px;
  font-size: 13px;
}
.zoom-control button:nth-child(2) {
  font-size: 9px;
  min-width: 44px;
  border-right: 1px solid #e2e5d8;
  border-left: 1px solid #e2e5d8;
  border-radius: 0;
}
.compass {
  position: absolute;
  right: 24px;
  bottom: 19px;
  text-align: center;
  font-family: var(--serif);
  font-size: 10px;
  color: #58704ca1;
  pointer-events: none;
}
.compass span {
  font-size: 40px;
  line-height: 1;
}
.map-footer {
  height: 41px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f9faf1;
  padding: 0 15px;
  font-size: 9px;
  flex-shrink: 0;
}
.muted {
  color: #929984;
  margin-left: 5px;
}
.footer-right {
  color: #9b9e8a;
  font-family: var(--serif);
  font-style: italic;
}
.footer-right > span {
  color: #899575;
  margin-left: 8px;
}
.world-panel .panel-title {
  margin-bottom: 14px;
}
.world-card {
  background: #f4f4eb;
  border: 1px solid #e8e8dc;
  border-radius: 8px;
  padding: 0 13px 14px;
  overflow: hidden;
  text-align: center;
}
.world-card-art {
  height: 90px;
  position: relative;
  margin: 0 -13px 13px;
  overflow: hidden;
  background: #e9eddf;
}
.sun {
  position: absolute;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  right: 36px;
  top: 12px;
  background: #e6cfa0;
}
.hill {
  position: absolute;
  border-radius: 50% 50% 0 0;
  width: 180px;
  height: 85px;
  background: #bfcfac;
  bottom: -45px;
  left: -30px;
  transform: rotate(10deg);
}
.h2 {
  left: 65px;
  bottom: -30px;
  background: #a4ba93;
  transform: rotate(-15deg);
}
.mini-house {
  position: absolute;
  left: 74px;
  top: 19px;
  font-size: 53px;
  color: #8a7456;
  text-shadow: 1px 2px #fff9;
}
.mini-tree {
  position: absolute;
  left: 30px;
  top: 40px;
  color: #739368;
  font-size: 38px;
  line-height: 1;
}
.world-card .eyebrow {
  font-size: 7px;
  letter-spacing: 1px;
  color: #9a9b86;
}
.world-card h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  margin: 6px 0 5px;
  overflow-wrap: anywhere;
}
.world-card p {
  font-size: 10px;
  color: #91927e;
  margin: 0 0 16px;
}
.world-stats {
  display: flex;
  padding-top: 11px;
  border-top: 1px solid #e1e3d3;
}
.world-stats > div {
  width: 50%;
}
.world-stats > div + div {
  border-left: 1px solid #dee2cf;
}
.world-stats strong {
  display: block;
  font-size: 17px;
  font-weight: 500;
}
.world-stats span {
  font-size: 9px;
  color: #949981;
}
.world-panel > .section-label {
  margin-top: 23px;
}
.checklist {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.checklist > div {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 10px;
  color: #8e9581;
}
.checklist b {
  font-weight: 500;
  display: block;
  color: #64715b;
  margin-bottom: 2px;
}
.check-icon {
  border-radius: 50%;
  border: 1px solid #d3dccc;
  width: 18px;
  height: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 16px;
}
.check-icon.done {
  background: #e7eeda;
  color: #6b8559;
  border: 0;
}
.checklist small {
  font-size: 9px;
}
.journal {
  background: #f6f0e3;
  padding: 13px;
  border-radius: 7px;
  margin-top: 22px;
  border: 1px solid #eee7d7;
}
.journal-heading {
  font-size: 8px;
  color: #9d8763;
  font-weight: 600;
  letter-spacing: 1px;
}
.journal p {
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.6;
  font-style: italic;
  color: #8f846b;
  margin: 8px 0 0;
}
.journal p + p {
  font-size: 10px;
  opacity: 0.75;
  border-top: 1px solid #e7dfcd;
  padding-top: 6px;
}
.reroll {
  margin-top: auto;
  padding: 18px 0 0;
  text-align: left;
  color: #8b9580;
  font-size: 10px;
}
.bottom-note {
  display: flex;
  justify-content: space-between;
  padding-top: 19px;
  color: #999c8b;
  font-size: 9px;
}
.bottom-note > span:last-child {
  font-size: 7px;
  letter-spacing: 1.7px;
}
.sim-overlay {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  border: 1px solid #bed3b1;
  background: #f8fff0ed;
  color: #526849;
  border-radius: 20px;
  font-size: 8px;
  letter-spacing: 1px;
  padding: 9px 13px;
  white-space: nowrap;
  pointer-events: none;
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #759d50;
  margin-right: 5px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
.simulation-panel {
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.sim-title {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}
.sim-title > span {
  color: #919985;
}
.sim-stats {
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
}
.sim-stats strong {
  font-size: 18px;
  display: block;
  font-weight: 500;
}
.sim-stats span {
  display: block;
  font-size: 8px;
  color: #89957d;
}
.sim-controls {
  display: flex;
  gap: 3px;
}
.sim-controls button {
  padding: 4px 6px;
  border: 1px solid var(--line);
  font-size: 10px;
}
.sim-controls .active {
  background: #e3edd8;
}
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #344938;
  color: #fff;
  padding: 13px 23px;
  border-radius: 8px;
  box-shadow: 0 4px 25px #0002;
  z-index: 5;
  max-width: 90vw;
  font-size: 12px;
}
dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 80px #25351c33;
  width: 490px;
  max-width: calc(100vw - 30px);
  padding: 25px;
}
dialog::backdrop {
  background: #25351c66;
  backdrop-filter: blur(4px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
}
.modal-head h2 {
  font: 27px var(--serif);
  margin: 0;
}
.modal-copy {
  color: #7d8573;
  font-size: 12px;
  line-height: 1.8;
}
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 17px 0;
}
.modal-grid button {
  padding: 18px;
  border: 1px solid var(--line);
  text-align: left;
  background: #f2f4e9;
}
.modal-grid strong {
  display: block;
  margin-bottom: 5px;
}
.modal-grid span {
  font-size: 11px;
  color: #8a9380;
}
.form-field {
  display: block;
  margin: 15px 0;
}
.form-field input,
.form-field select {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #d7decc;
  border-radius: 6px;
  background: #fffef9;
  color: var(--ink);
  margin-top: 6px;
}
.library-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.library-item .load-world {
  flex: 1;
  text-align: left;
  padding: 6px;
}
.library-item strong {
  display: block;
}
.library-item small {
  font-size: 10px;
  color: #8e9781;
}
.danger {
  color: #b46549;
}
.help-list {
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.9;
  color: #65715d;
}
.import-label {
  display: inline-block;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 14px;
  margin-top: 10px;
}
.import-label input {
  display: none;
}
[hidden] {
  display: none !important;
}
body.live .tool-panel {
  opacity: 0.65;
}
body.live .canvas-wrap {
  background: #c9d9bb;
}
@media (min-width: 1500px) {
  .studio {
    grid-template-columns: 230px minmax(300px, 1fr) 255px;
    min-height: calc(100vh - 237px);
  }
}
@media (max-width: 1200px) {
  main {
    padding: 23px 20px;
  }
  .studio {
    grid-template-columns: 190px minmax(280px, 1fr) 200px;
    gap: 12px;
  }
  .tool-panel,
  .world-panel {
    padding: 16px 12px;
  }
  .topbar {
    padding: 0 23px;
  }
  .top-note {
    display: none;
  }
  .footer-right {
    display: none;
  }
  .save-status {
    font-size: 9px;
  }
  #world-name {
    width: 190px;
  }
  .heading-actions {
    gap: 7px;
  }
}
@media (max-width: 980px) {
  .studio {
    grid-template-columns: 180px 1fr;
  }
  .world-panel {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
  }
  .world-panel .panel-title,
  .world-panel > .section-label {
    display: none;
  }
  .world-card {
    grid-row: span 2;
  }
  .checklist {
    padding-top: 5px;
  }
  .journal {
    margin: 0;
  }
  .reroll {
    padding: 0;
  }
  .simulation-panel {
    margin: 0;
  }
  .world-card-art {
    height: 65px;
  }
  .world-card p {
    margin-bottom: 9px;
  }
  .world-card h2 {
    font-size: 21px;
  }
  .canvas-wrap {
    min-height: 535px;
  }
  .bottom-note > span:last-child {
    display: none;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 65px;
    padding: 0 16px;
  }
  .brand {
    font-size: 23px;
  }
  .brand .beta {
    display: none;
  }
  .topbar nav {
    gap: 3px;
  }
  .topbar nav .quiet {
    font-size: 12px;
    padding: 7px;
  }
  .topbar nav .outline {
    font-size: 11px;
    padding: 7px;
  }
  main {
    padding: 19px 12px;
  }
  .workspace-heading {
    flex-wrap: wrap;
    margin-bottom: 17px;
    gap: 12px;
  }
  .workspace-heading > .heading-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .eyebrow {
    font-size: 7px;
  }
  .name-row {
    gap: 6px;
  }
  #world-name {
    font-size: 29px;
    width: 190px;
  }
  .heading-actions .primary {
    padding: 8px 14px;
  }
  .heading-actions .outline {
    padding: 7px 12px;
  }
  .heading-actions .round {
    margin-right: auto;
  }
  .studio {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .tool-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }
  .tool-panel .panel-title,
  .tool-panel .section-label,
  .tool-tip,
  .local-note {
    display: none;
  }
  .era-tabs {
    margin: 0;
    grid-column: 1/-1;
    max-width: 100%;
  }
  .era-tabs button {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }
  .terrain-tools {
    grid-column: 1;
    grid-row: 2/4;
    gap: 4px;
  }
  .terrain-tools button {
    padding: 4px;
    font-size: 9px;
  }
  .swatch {
    width: 19px;
    height: 19px;
  }
  .building-tools {
    grid-column: 2;
    grid-row: 2/4;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
  }
  .building-tools canvas {
    width: 28px;
    height: 27px;
  }
  .building-tools button {
    font-size: 8px;
  }
  .brush-size {
    padding: 6px 0;
    margin: 0;
    justify-content: space-between;
  }
  .utility-tools {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .map-panel {
    min-height: 470px;
  }
  .canvas-wrap {
    min-height: 375px;
  }
  .map-toolbar {
    padding: 0 8px;
  }
  .map-toolbar-right {
    gap: 1px;
  }
  .map-toolbar-right > span {
    margin-right: 5px;
    font-size: 8px;
  }
  .world-panel {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    gap: 12px;
  }
  .world-card {
    grid-row: span 2;
  }
  .journal {
    grid-column: 1/-1;
  }
  .bottom-note {
    font-size: 8px;
    line-height: 1.7;
  }
  .map-stamp {
    top: 12px;
    left: 12px;
    font-size: 6px;
  }
  .sim-overlay {
    top: 47px;
  }
  .world-panel .simulation-panel {
    grid-column: 2;
    grid-row: 2;
  }
  .world-panel .reroll {
    grid-column: 1/-1;
    text-align: center;
  }
  .sim-controls button {
    padding: 4px;
  }
  .save-status {
    font-size: 8px;
  }
}

.swatch-grass {
  background: #b6c997;
}
.swatch-water {
  background: #88bac3;
}
.swatch-sand {
  background: #e4d4a7;
}
.swatch-forest {
  background: #83a478;
}
.swatch-mountain {
  background: #b9bbac;
}
.swatch-road {
  background: #d9c8a5;
}
