:root { --hud-unit: min(calc(100vw / 1133), calc(100dvh / 682), 1.26px); }
.topbar {
  position: absolute;
  z-index: 9;
  inset: 0 0 auto;
  height: auto;
  gap: 8px;
  padding-block: 11px;
  border: 0;
  background: none;
  pointer-events: none;
}
.topbar .brand { max-width: 48vw; color: #fff9e6; text-shadow: 0 1px 4px #162315; }
.topbar .brand-subtitle { color: #f0efd9; }
.topbar .brand-mark { background: #314036bd; }
.header-actions {
  background: #303d33d9;
  padding: 5px;
  border-radius: 13px;
  color: #fffaf0;
  gap: 5px;
  box-shadow: 0 2px 10px #17261830;
  pointer-events: auto;
}
.topbar .history { padding-right: 3px; border-color: #e9e0cd30; }
.topbar .icon-button:hover:not(:disabled), #scene-menu-toggle[aria-expanded="true"] { background: #faf4dd29; }
.topbar .primary { background: #a88e59; color: #161d15; }
.topbar .primary:hover:not(:disabled) { background: #c3a86e; }
.scene-save { white-space: nowrap; }
.scene-save .save-format { display: none; }
.settings-glyph { filter: brightness(0) invert(1); }
.catalog {
  left: 47.8%;
  transform: translateX(-50%);
  bottom: calc(150 * var(--hud-unit));
  width: min(810px, 84vw);
  max-width: 100%;
  padding: 8px 12px;
  border: 0;
  box-shadow: none;
  background: #333d308a;
  color: #fffbe9;
  backdrop-filter: blur(6px);
}
.catalog-top { gap: 11px; margin-bottom: 6px; }
.catalog h2 { font-size: 14px; }
.catalog-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 7px; }
.catalog-filters > .downloaded-model-filters, .catalog-filters > .sbs-floor-filter { margin: 0; flex-wrap: wrap; }
.asset-search {
  display: flex;
  align-items: center;
  flex: 0 1 212px;
  min-width: min(172px, 100%);
  border-radius: 6px;
  background: #394739;
  color: #fff9e6;
}
.asset-search:focus-within { outline: 2px solid #e5d9a6; }
.asset-search input {
  min-width: 0;
  flex: 1;
  height: 29px;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 6px;
  outline: 0;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
}
.asset-search input::placeholder { color: #e6dfc9; opacity: 1; }
.asset-search input::-webkit-search-cancel-button { display: none; }
.asset-search button { width: 28px; height: 29px; border-radius: 6px; color: inherit; font-size: 19px; }
.asset-search button:hover, .asset-search button:focus-visible { background: #fcf8e42b; }
.asset-search-empty { margin: 0; padding: 6px 1px 9px; font-size: 12px; color: #fff9e6; }
.asset-pages { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.asset-pages button { border-radius: 6px; width: 29px; height: 29px; color: inherit; background: #394739; }
.asset-pages button:hover:not(:disabled) { background: #52624d; }
.asset-pages button:focus-visible { outline: 2px solid #e5d9a6; }
.asset-pages button:disabled { opacity: .45; }
.asset-pages output { font-variant-numeric: tabular-nums; }
.asset-source { display: block; margin-top: 3px; color: #fff4c8; font-size: 10px; font-weight: 500; }
.categories button { color: #fff9e6; }
.categories button:hover, .categories button[aria-pressed="true"] { color: #fffdf1; background: #ad8e56bb; }
.asset-choice { color: #fffcef; background: #303c33a6; flex-basis: clamp(62px, 7vw, 94px); grid-template-rows: minmax(0,65px) auto; }
.asset-choice:hover { background: #485844bc; }
.asset-choice[aria-pressed="true"] { border-color: #e5d9a6; background: #9f824fd1; }
.inspector { top: 73px; right: 79px; background: #303f34e8; color: #fff8e5; border-color: #f4edcf2b; }
.inspector p, .inspector .field-label output { color: #efe9cc; }
.inspector .segment { background: #222f26b3; }
.inspector .segment button:hover { background: #56614d; }
.inspector .segment button[aria-pressed="true"], .inspector .small-button { background: #b19863; color: #172016; }
.inspector select { color: #fffbe8; background: #263829; border-color: #ffffff3b; }
.inspector input[type="range"] { accent-color: #e6d7a2; }
.view-buttons { top: 50%; bottom: auto; transform: translateY(-50%); background: #303f34c2; color: #fff8e8; border: 0; }
.view-buttons .icon-button:hover { background: #f3e7c931; }
#viewport[data-tool="water"], #viewport[data-tool="animals"] { cursor: crosshair; }
#spring-placement-hint {
  --spring-tile: clamp(56px, calc(97 * var(--hud-unit)), 100px);
  display: none;
  position: absolute;
  z-index: 4;
  top: clamp(64px, 12.5dvh, 110px);
  left: clamp(10px, 2.6vw, 35px);
  min-width: calc(var(--spring-tile) + 28px);
  justify-items: center;
  gap: clamp(8px, calc(16 * var(--hud-unit)), 16px);
  color: #fffdf4;
  font-size: clamp(14px, calc(22 * var(--hud-unit)), 22px);
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 4px #1a291c;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
}
#spring-placement-hint:disabled { cursor: default; }
#spring-placement-hint:disabled span { opacity: .66; }
#spring-placement-hint:not(:disabled):hover span,
#spring-placement-hint:focus-visible span { background: #aa884b; }
#spring-placement-hint span {
  display: grid;
  place-items: center;
  width: var(--spring-tile);
  height: var(--spring-tile);
  border-radius: 34%;
  background: #303a40;
}
#spring-placement-hint img {
  width: 41%;
  height: 52%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
#tools[data-active-tool="water"][data-active-water-tool="spring"] ~ #spring-placement-hint {
  display: grid;
}
.viewport-footer { background: none; text-shadow: 0 1px 4px #1a2917; }
#toast { z-index: 8; top: 73px; }
#loading { z-index: 14; }
@media (max-width: 720px) {
  .topbar { padding: 8px; }
  .topbar .brand { gap: 5px; }
  .topbar .brand h1 { font-size: 16px; }
  .topbar .brand-mark { width: 26px; height: 26px; }
  .topbar .brand-mark svg { width: 18px; height: 18px; }
  .brand-subtitle { display: none; }
  .header-actions { gap: 3px; padding: 3px; }
  .header-actions button { min-height: 32px; }
  .header-actions .primary { padding-inline: 6px; }
  .header-actions .primary svg { width: 16px; }
  .catalog { width: 93vw; padding: 6px; }
  .catalog h2 { font-size: 12px; }
  .asset-choice { grid-template-rows: 49px auto; }
  .inspector { top: 58px; right: 50px; width: min(193px, 58vw); }
  .view-buttons { right: 7px; }
}
@media (orientation: landscape) and (pointer: coarse) and (max-height: 520px) {
  .topbar { padding: 6px 10px; }
  .inspector { top: 52px; right: 50px; max-height: calc(100% - 194px); width: 182px; }
  .view-buttons { right: 8px; width: auto; display: grid; top: 50%; }
  .view-buttons .icon-button { width: 33px; height: 32px; }
  .catalog { bottom: calc(150 * var(--hud-unit)); width: min(70vw, 590px); }
}
@media (max-width: 540px) {
  .topbar .brand, .topbar .brand > div { min-width: 0; }
  .topbar .brand-mark, .header-actions { flex: none; }
  .topbar .brand h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions .scene-save { gap: 4px; }
  .scene-save .save-label { display: none; }
  .scene-save .save-format { display: inline; }
}
@media (max-width: 360px) {
  .header-actions .scene-save svg { display: none; }
}

#inspector:is(.river-settings, :has(> .river-settings)) {
  --river-panel-unit: var(--hud-unit);
  --river-panel-center: 50%;
  --river-panel-gap: clamp(12px, calc((100dvh - 620px) * .38), 92px);
  --river-panel-bottom: calc(max(calc(25 * var(--river-panel-unit)), env(safe-area-inset-bottom)) + 223 * var(--river-panel-unit) + var(--river-panel-gap));
  --river-panel-height: max(72px, calc(100dvh - var(--river-panel-bottom) - max(60px, env(safe-area-inset-top) + 48px)));
  --river-stack-gap: clamp(5px, .9dvh, 10px);
  --river-row-size: clamp(36px, calc((var(--river-panel-height) - 62px) / 8), 51px);
  --river-column-gap: clamp(8px, 2.1vw, 23px);
  --river-value-width: clamp(36px, 8vw, 72px);
  --river-thumb-size: clamp(20px, calc(var(--river-row-size) * .73), 38px);
  --river-track-size: clamp(3px, calc(var(--river-row-size) * .10), 5px);
  --river-slate: #304149;
  --river-white: #fffdf7;
  --river-active: #f0b928;
  --river-active-text: #302509;
  top: auto;
  right: auto;
  bottom: var(--river-panel-bottom);
  left: var(--river-panel-center);
  z-index: 5;
  width: min(804px, calc(100vw - 44px));
  max-height: var(--river-panel-height);
  padding: 2px 5px 2px 2px;
  border: 0;
  border-radius: 0;
  color: var(--river-white);
  background: none;
  box-shadow: none;
  transform: translateX(-50%);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d7e0df82 transparent;
  scroll-padding-block: 5px;
}

.river-settings {
  display: grid;
  gap: var(--river-stack-gap);
}

.river-settings__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--river-value-width) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--river-column-gap);
  min-height: var(--river-row-size);
  padding: 0 clamp(8px, 1.35vw, 16px);
  border-radius: 999px;
  color: var(--river-white);
  background: var(--river-slate);
  box-shadow: 0 1px 1px #20302f35;
  font-size: clamp(13px, calc(var(--river-row-size) * .46), 23px);
  font-weight: 700;
  line-height: 1.2;
}

.river-settings__row--active:first-child {
  margin-bottom: clamp(5px, 1.2dvh, 10px);
}

.river-settings__row--active,
.river-settings__row[data-active="true"],
.river-settings__row:focus-within {
  color: var(--river-active-text);
  background: var(--river-active);
}

@media (hover: hover) {
  .river-settings__row:hover {
    color: var(--river-active-text);
    background: var(--river-active);
  }
}

.river-settings__label {
  --river-symbol-size: clamp(12px, calc(var(--river-row-size) * .48), 24px);
  position: relative;
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  padding: 2px 0 2px calc(var(--river-symbol-size) + clamp(6px, 1.45vw, 16px));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.river-settings__label::before,
.river-settings__label::after {
  content: "";
  position: absolute;
  top: 50%;
  border: clamp(1.5px, .26vw, 2.6px) solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: #77939d;
  transform: translateY(-50%) rotate(50deg);
}

.river-settings__label::before {
  left: 0;
  width: var(--river-symbol-size);
  height: var(--river-symbol-size);
}

.river-settings__label::after {
  left: calc(var(--river-symbol-size) * .36);
  width: calc(var(--river-symbol-size) * .43);
  height: calc(var(--river-symbol-size) * .43);
  transform: translateY(-36%) rotate(135deg);
}

.river-settings__row--active .river-settings__label::before,
.river-settings__row--active .river-settings__label::after,
.river-settings__row[data-active="true"] .river-settings__label::before,
.river-settings__row[data-active="true"] .river-settings__label::after,
.river-settings__row:focus-within .river-settings__label::before,
.river-settings__row:focus-within .river-settings__label::after {
  color: #73551a;
}

.river-settings__value {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  padding: 4px 3px;
  border: 1px solid #9eafb72c;
  border-radius: 9px;
  background: #2532392a;
  color: inherit;
  font-size: .84em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.river-settings__control,
.river-settings__row > :is(select, input) {
  grid-column: 3;
  min-width: 0;
}

.river-settings__row select {
  width: 100%;
  min-height: calc(var(--river-row-size) - 8px);
  padding: 3px 24px 3px 8px;
  border: 1px solid #9aabb364;
  border-radius: 6px;
  color: var(--river-white);
  background-color: #3b4c53;
  font: inherit;
  text-align: center;
  text-align-last: center;
}

.river-settings__row input[type="range"] {
  display: block;
  width: 100%;
  min-height: var(--river-thumb-size);
  margin: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
  touch-action: pan-y;
}

.river-settings__row input[type="range"]::-webkit-slider-runnable-track {
  height: var(--river-track-size);
  border-radius: 999px;
  background: #f9faf7;
  box-shadow: 0 1px 1px #14242c4a;
}

.river-settings__row input[type="range"]::-moz-range-track {
  height: var(--river-track-size);
  border-radius: 999px;
  background: #f9faf7;
  box-shadow: 0 1px 1px #14242c4a;
}

.river-settings__row input[type="range"]::-webkit-slider-thumb {
  width: var(--river-thumb-size);
  height: var(--river-thumb-size);
  margin-top: calc((var(--river-track-size) - var(--river-thumb-size)) / 2);
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px #13262d48;
  appearance: none;
}

.river-settings__row input[type="range"]::-moz-range-thumb {
  width: var(--river-thumb-size);
  height: var(--river-thumb-size);
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px #13262d48;
}

.river-settings__row--toggle .river-settings__label {
  grid-column: 1 / 3;
}

.river-settings__row--toggle .river-settings__control,
.river-settings__row--toggle > input {
  justify-self: end;
}

.river-settings__row--toggle input[type="checkbox"] {
  display: block;
  position: relative;
  width: clamp(49px, calc(var(--river-row-size) * 1.55), 80px);
  height: calc(var(--river-row-size) * .74);
  margin: 0;
  border: 1px solid #26363c;
  border-radius: 999px;
  background: #223238;
  appearance: none;
  cursor: pointer;
}

.river-settings__row--toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  inset: 2px auto 2px 2px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
}

.river-settings__row--toggle input[type="checkbox"]:checked {
  background: #91b810;
}

.river-settings__row--toggle input[type="checkbox"]:checked::before {
  inset-inline: auto 2px;
}

.river-settings__row :is(input, select):focus-visible,
.river-settings__advanced summary:focus-visible {
  outline: 2px solid #fff5d0;
  outline-offset: 3px;
}

.river-settings__advanced {
  border-radius: 13px;
  color: var(--river-white);
  background: #304149f4;
  font-size: clamp(13px, 1.5vw, 16px);
}

.river-settings__advanced summary {
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
}

.river-settings__advanced[open] summary {
  color: var(--river-active-text);
  background: var(--river-active);
}

.river-settings__advanced > .controls {
  padding: 12px 16px;
}

@media (orientation: portrait) and (pointer: coarse) {
  #inspector:is(.river-settings, :has(> .river-settings)) {
    --river-panel-unit: min(calc(100vw / 980), calc(100dvh / 682), 1.26px);
  }
}

@media (max-width: 540px) {
  #inspector:is(.river-settings, :has(> .river-settings)) {
    --river-panel-gap: clamp(12px, 3dvh, 30px);
    --river-row-size: clamp(39px, calc((var(--river-panel-height) - 52px) / 8), 44px);
    width: calc(100vw - 20px);
  }
}
#editor[data-house-editing="true"] #tools {
  display: none;
}

.house-edit-toolbar {
  --house-tile-size: clamp(42px, calc(97 * var(--hud-unit)), 84px);
  --house-tile-gap: clamp(5px, calc(23 * var(--hud-unit)), 21px);
  position: absolute;
  z-index: 7;
  left: 49.25%;
  bottom: max(calc(28 * var(--hud-unit)), env(safe-area-inset-bottom));
  display: grid;
  grid-auto-flow: column;
  gap: var(--house-tile-gap);
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.house-edit-toolbar__button {
  display: grid;
  place-items: center;
  width: var(--house-tile-size);
  height: var(--house-tile-size);
  padding: 0;
  border-radius: clamp(10px, calc(var(--house-tile-size) * .18), 16px);
  color: #fffefa;
  background: #2f3441;
  box-shadow: 0 1px 2px #24312c2e;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.house-edit-toolbar__button:is([aria-pressed="true"], [aria-selected="true"], [data-active="true"]) {
  background: #ffc730;
}

.house-edit-toolbar__button[data-house-action="close"] {
  background: #bb7459;
}

.house-edit-toolbar__button :is(svg, img) {
  width: 58%;
  height: 58%;
  object-fit: contain;
  pointer-events: none;
}

.house-edit-toolbar__button[data-house-tab="foliage"] {
  color: #b7d246;
}

.house-edit-toolbar__button[data-house-tab="foliage"] img {
  filter: brightness(0) saturate(100%) invert(74%) sepia(83%) saturate(380%) hue-rotate(20deg);
}

.house-edit-toolbar__button[data-house-action="close"] img {
  filter: brightness(0) invert(1);
}

@media (hover: hover) {
  .house-edit-toolbar__button:hover:not(:disabled) {
    filter: brightness(1.12);
  }
}

.house-edit-toolbar__button:focus-visible,
.house-transform__handle:focus-visible {
  outline: 2px solid #fff8c9;
  outline-offset: 4px;
}

.house-transform {
  --house-handle-size: clamp(38px, calc(84 * var(--hud-unit)), 90px);
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.house-transform__ring {
  position: absolute;
  border: clamp(2px, calc(4 * var(--hud-unit)), 6px) solid #fdf6c852;
  border-radius: 50%;
  background: none;
  box-shadow: 0 0 3px #fffae331;
  transform: translate(-50%, -50%) rotate(var(--house-transform-angle, 0deg));
  pointer-events: none;
}

.house-transform__handle {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--house-handle-size);
  height: var(--house-handle-size);
  padding: 0;
  border-radius: 50%;
  color: #fffae3;
  opacity: .86;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.house-transform__handle[data-house-handle="move"] { cursor: move; }
.house-transform__handle[data-house-handle="rotate"] { cursor: grab; }
.house-transform__handle[data-house-handle="rotate"]:active { cursor: grabbing; }
.house-transform__handle[data-house-handle="width"] { cursor: ew-resize; }
.house-transform__handle[data-house-handle="length"] { cursor: nwse-resize; }
.house-transform__handle:is([data-house-handle="height"], [data-house-handle="roof"]) { cursor: ns-resize; }

.house-transform__handle :is(svg, img) {
  width: 85%;
  height: 85%;
  overflow: visible;
  object-fit: contain;
  filter: drop-shadow(0 0 2px #2330225c);
  pointer-events: none;
}

.house-transform__handle[data-house-handle="rotate"] :is(svg, img) {
  width: 63%;
  height: 63%;
}

.house-transform__handle:is([data-house-handle="width"], [data-house-handle="length"]) :is(svg, img) {
  transform: rotate(var(--house-handle-angle, 0deg));
}

.house-transform__handle:is(:hover, :focus-visible, :active, [data-active="true"]) {
  color: #fffdf6;
  opacity: 1;
  background: #fff8d12b;
}

#inspector:is(.house-edit-panel, :has(> .house-edit-panel)) {
  z-index: 5;
  top: clamp(59px, 10.7dvh, 82px);
  right: clamp(52px, 6vw, 84px);
  width: min(275px, 36vw);
  max-height: calc(100% - 184px);
  border-color: #ddd8c333;
  background: #2f373fe8;
  color: #fff9e9;
  overscroll-behavior: contain;
}

.house-edit-panel__heading {
  margin-bottom: 12px;
  color: #fff9e8;
}

.house-edit-panel .field-label output {
  color: #ffe9a3;
}

.house-edit-panel .segment,
.house-edit-panel select {
  color: #fff9e7;
  background: #232b31;
  border-color: #d8dfdf40;
}

.house-edit-panel input[type="range"] {
  accent-color: #ffd374;
}

@media (max-width: 540px) {
  .house-edit-toolbar {
    left: 50%;
  }
  #inspector:is(.house-edit-panel, :has(> .house-edit-panel)) {
    inset: auto 12px max(72px, calc(env(safe-area-inset-bottom) + 63px));
    width: auto;
    max-height: min(185px, 40dvh);
    padding: 11px;
  }
}
