:root {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #42594c;
  background: #e9f0e9;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
main { position: relative; width: 100vw; height: 100dvh; }

#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}

#world.dragging { cursor: grabbing; }
#world:focus-visible { outline: 2px solid #78937a; outline-offset: -4px; }

h1 {
  position: absolute;
  top: 28px;
  left: 32px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
  pointer-events: none;
}

h1 span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #7c8c7e;
}

#reset-view {
  position: absolute;
  top: 30px;
  right: 32px;
  padding: 8px 13px;
  border: 1px solid #8a9c8938;
  border-radius: 4px;
  background: #f7faf2a8;
  color: #526b57;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#reset-view:hover { background: #f9fcf5; }
#reset-view:focus-visible { outline: 2px solid #78937a; outline-offset: 3px; }

.instructions {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 12px 19px;
  border-radius: 4px;
  background: #f7faf2d9;
  color: #7a8979;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.status { color: #4f6b51; }
.separator { width: 1px; height: 10px; background: #bac8b6; }

#terrain-toggle {
  position: absolute; top: 30px; right: 130px;
  border: 1px solid #8a9c8955; border-radius: 4px;
  background: #f7faf2; color: #526b57; padding: 8px 13px;
  font: inherit; font-size: 12px; cursor: pointer;
}
#terrain-toggle[aria-expanded="true"] { background: #526b57; color: #f7faf2; }
#terrain-tools[hidden] { display: none; }
#terrain-tools {
  position: absolute; top: 80px; right: 32px; width: 294px;
  max-height: calc(100dvh - 160px); overflow-y: auto;
  padding: 20px; background: #f7faf2f5; border: 1px solid #d2dccd;
  border-radius: 5px; box-shadow: 0 8px 30px #4e674b12; font-size: 12px;
}
.tool-heading h2 { font-size: 16px; margin: 0 0 5px; font-weight: 600; }
.tool-heading > span, .field-hint { font-size: 10px; color: #7c8c7e; }
.edit-switch { display: flex; align-items: center; gap: 7px; margin: 20px 0 14px; }
.edit-switch input { accent-color: #6d8d6b; margin: 0; }
.edit-switch > span { font-size: 10px; margin-left: auto; color: #7c8c7e; }
.material-palette { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.material-palette button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 9px 3px; border: 1px solid transparent; border-radius: 3px;
  background: #edf1e8; color: #647961; font: inherit; font-size: 10px; cursor: pointer;
}
.material-palette button[aria-pressed="true"] { border-color: #789475; background: #e2eadb; }
.material-palette i { display: block; width: 24px; height: 16px; transform: skewY(-12deg); box-shadow: 2px 3px 0 #64705a30; }
.tile-summary { margin: 18px 0 9px; color: #6d7f69; font-size: 11px; }
.tile-layers { margin: 0 0 13px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 5px; }
.tile-layers button { display: flex; align-items: center; gap: 5px; background: #eaf0e4; padding: 4px 6px; font: inherit; font-size: 10px; border: 1px solid transparent; color: #647961; cursor: pointer; }
.tile-layers button[aria-pressed="true"] { border-color: #789475; background: #e2eadb; }
.tile-layers i { width: 8px; height: 8px; }
.height-field { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.height-field > span { font-size: 10px; color: #87917f; }
#terrain-tools input:not([type="checkbox"]), #terrain-tools select {
  min-width: 0; border: 1px solid #cfd9c8; border-radius: 3px;
  padding: 6px 8px; background: #fcfdf8; color: #526b57; font: inherit;
}
#layer-height { width: 53px; }
.tile-actions, .generator-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tile-actions button, .generator-actions button {
  padding: 8px 4px; background: #e4ebdd; border: 0; border-radius: 3px;
  color: #526b57; font: inherit; font-size: 11px; cursor: pointer;
}
.tile-actions button:disabled { opacity: 0.4; cursor: default; }
#terrain-generator { border-top: 1px solid #d8e1d1; margin-top: 20px; padding-top: 16px; }
#terrain-generator h3 { font-size: 12px; font-weight: 600; margin: 0 0 12px; }
#terrain-generator > label { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
#terrain-generator select, #terrain-seed { flex: 1; }
#terrain-height { width: 62px; }
.field-hint { line-height: 1.6; }
.generator-actions button:first-child { background: #647e60; color: #f8faef; }
#terrain-feedback { margin: 14px 0 0; font-size: 10px; line-height: 1.8; color: #7a8a73; overflow-wrap: anywhere; }
#terrain-tools :focus-visible, #terrain-toggle:focus-visible { outline: 2px solid #78937a; outline-offset: 2px; }
