* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    "Noto Sans",
    sans-serif;
  background: #111820;
  color: #e3eaf3;
}
button,
input,
select {
  font: inherit;
}
button {
  border: 1px solid #3b4759;
  background: #253141;
  color: #e3eaf3;
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
}
button:hover {
  background: #36455a;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #83d8ff;
  outline-offset: 2px;
}
button.active,
.accent {
  background: #a7e1ff;
  color: #102131;
  border-color: #a7e1ff;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
.quiet {
  background: transparent;
  color: #a9bbce;
}
.danger {
  color: #ffb5ab;
}
header {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #344052;
  background: #141e2a;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  white-space: nowrap;
}
.brand-mark {
  color: #a7e1ff;
  font-size: 29px;
}
.sub {
  font-size: 13px;
  color: #98acc2;
  border-left: 1px solid #435166;
  padding-left: 12px;
  margin-left: 4px;
}
nav {
  display: flex;
  gap: 7px;
}
main {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  height: calc(100% - 62px);
}
aside {
  overflow: auto;
  background: #17212d;
  scrollbar-width: thin;
  scrollbar-color: #4d5f74 #17212d;
}
#left {
  border-right: 1px solid #344052;
}
#right {
  border-left: 1px solid #344052;
}
section {
  padding: 18px 16px;
  border-bottom: 1px solid #344052;
}
.section-heading {
  font-size: 12px;
  color: #acdfff;
  font-weight: 700;
  letter-spacing: 1.8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.section-heading span {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: #91a5bc;
}
label {
  display: block;
  color: #b8c7d8;
  margin: 9px 0 3px;
}
input[type="number"],
input[type="text"],
select {
  width: 100%;
  height: 34px;
  padding: 5px 7px;
  color: #ecf4fc;
  background: #0f1823;
  border: 1px solid #3e4c60;
  border-radius: 5px;
  min-width: 0;
}
input[type="color"] {
  display: block;
  width: 100%;
  height: 34px;
  padding: 2px;
  background: #0f1823;
  border: 1px solid #3e4c60;
  border-radius: 5px;
}
input[type="range"] {
  display: block;
  width: 100%;
  accent-color: #9fd8ff;
  margin: 9px 0 14px;
}
input[type="checkbox"] {
  accent-color: #9fd8ff;
  width: 15px;
  height: 15px;
  margin: 0 6px 0 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 3px;
}
.room-grid,
.triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.triple label,
.room-grid label {
  font-size: 12px;
}
.pair,
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.wide {
  width: 100%;
  margin-top: 9px;
}
.hint {
  font-size: 12px;
  color: #8fa4bc;
  margin: 8px 0 0;
}
.field-title {
  font-size: 13px;
  color: #dce7f4;
  margin-top: 18px;
  border-top: 1px solid #354356;
  padding-top: 12px;
}
.action-row {
  margin-top: 18px;
}
#empty {
  color: #94a8bf;
  padding: 15px 0;
}
.object-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
  padding: 7px 8px;
  width: 100%;
  background: transparent;
  border-color: transparent;
  text-align: left;
  overflow: hidden;
}
.object-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.object-row.selected {
  background: #29455b;
  border-color: #76bfe9;
}
.object-row .dot {
  width: 7px;
  height: 7px;
  background: #8197b0;
  border-radius: 50%;
  flex-shrink: 0;
}
.object-row.hidden {
  opacity: 0.5;
}
.object-row.selected .dot {
  background: #a7e1ff;
}
#viewport {
  position: relative;
  overflow: hidden;
  background: #202a36;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#viewbar {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 5px;
  z-index: 2;
  flex-wrap: wrap;
  right: 15px;
}
#viewbar button,
#gizmoBar button {
  background: #192434e8;
  backdrop-filter: blur(12px);
  font-size: 13px;
}
#viewbar button.active,
#gizmoBar button.active {
  background: #a7e1ff;
  color: #102131;
}
#gizmoBar {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid #4a5a6a;
  background: #111c2cdd;
  border-radius: 10px;
  z-index: 2;
  white-space: nowrap;
}
.snap {
  font-size: 12px;
  display: flex;
  align-items: center;
  margin: 0 4px;
  color: #c3d3e4;
}
#status {
  position: absolute;
  bottom: 15px;
  left: 16px;
  right: 16px;
  font-size: 12px;
  color: #bdcce1;
  background: #111d2ad9;
  border-radius: 6px;
  padding: 7px 10px;
  pointer-events: none;
}
#toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #d7f0ff;
  color: #152738;
  padding: 10px 16px;
  border-radius: 8px;
  max-width: 90%;
  z-index: 5;
  display: none;
}
#loading,
#webglError {
  position: absolute;
  top: 45%;
  left: 15%;
  right: 15%;
  text-align: center;
  background: #17212df5;
  border-radius: 12px;
  padding: 24px;
  z-index: 4;
}
dialog {
  background: #17212d;
  color: #e2ebf5;
  border: 1px solid #526781;
  border-radius: 14px;
  padding: 28px;
  max-width: 660px;
  width: calc(100% - 30px);
  max-height: 85vh;
}
dialog::backdrop {
  background: #080e17aa;
}
dialog p,
dialog li {
  font-size: 15px;
  line-height: 1.8;
}
dialog li {
  margin: 9px 0;
}
dialog h2 {
  margin-top: 5px;
  font-size: 24px;
}
dialog h3 {
  font-size: 17px;
  margin-top: 25px;
}
.close {
  float: right;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1100px) {
  main {
    grid-template-columns: 210px minmax(0, 1fr) 240px;
  }
  section {
    padding: 14px 12px;
  }
  .sub {
    display: none;
  }
  #gizmoBar {
    bottom: 78px;
  }
  .snap {
    display: none;
  }
  #viewbar {
    top: 10px;
    left: 10px;
  }
}
@media (max-width: 760px) {
  header {
    height: 104px;
    flex-wrap: wrap;
    padding: 9px 12px;
    gap: 3px;
  }
  .brand {
    font-size: 16px;
  }
  nav {
    width: 100%;
    gap: 4px;
    overflow: auto;
  }
  nav button {
    font-size: 12px;
    padding: 5px 8px;
  }
  main {
    height: calc(100% - 104px);
    grid-template-columns: 165px minmax(0, 1fr);
    grid-template-rows: minmax(280px, 1fr) 230px;
  }
  #left {
    grid-row: 1/3;
  }
  #right {
    grid-column: 2;
    grid-row: 2;
    border-top: 1px solid #344052;
    border-left: 0;
  }
  #viewport {
    grid-row: 1;
    grid-column: 2;
  }
  section {
    padding: 12px 9px;
  }
  #viewbar {
    gap: 3px;
  }
  #viewbar button {
    font-size: 12px;
    padding: 4px 6px;
    min-height: 30px;
  }
  #gizmoBar {
    bottom: 60px;
  }
  #gizmoBar button {
    font-size: 12px;
    padding: 4px 6px;
  }
  #status {
    font-size: 11px;
    bottom: 7px;
    left: 7px;
    right: 7px;
  }
  .section-heading {
    letter-spacing: 1px;
    font-size: 11px;
  }
  .button-grid {
    gap: 4px;
  }
  .button-grid button {
    font-size: 12px;
    padding: 5px 4px;
  }
  .triple label {
    font-size: 12px;
  }
  .room-grid {
    grid-template-columns: 1fr;
  }
  .room-grid label {
    margin: 3px 0;
  }
  .room-grid input {
    height: 30px;
  }
}
#loadKotoha, #resizeRoom { white-space: normal; }

#viewbar .history-button { font-size: 14px; min-height: 40px; border-color: #87c7e9; font-weight: 700; }

#collabBar { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; justify-content: flex-end; }
#presence { display: flex; gap: 5px; min-width: 0; overflow: hidden; }
.person { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #dce7f4; background: #1d2938; border: 1px solid #344052; border-radius: 99px; padding: 3px 9px 3px 6px; white-space: nowrap; max-width: 150px; }
.person span:last-child { overflow: hidden; text-overflow: ellipsis; }
.person .swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.collab-status { font-size: 12px; color: #9fe3b8; white-space: nowrap; }
.collab-status.offline { color: #ffcf8a; }
body.shared #collabStart { display: none; }
.collab-form label { margin-top: 12px; }
.collab-form input[type="password"] { width: 100%; height: 34px; padding: 5px 7px; color: #ecf4fc; background: #0f1823; border: 1px solid #3e4c60; border-radius: 5px; }
.unreadable-note { color: #ffb5ab; margin: 0 0 6px; }
.form-error { color: #ffb5ab; min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.share-row { display: flex; gap: 7px; }
.share-row input { flex: 1; }
.remote-label { position: absolute; z-index: 1; transform: translate(-50%, -100%); font-size: 12px; color: #102131; padding: 2px 7px; border-radius: 5px; pointer-events: none; white-space: nowrap; }
@media (max-width: 760px) {
  #collabBar { order: 3; width: 100%; justify-content: flex-start; }
  .person { max-width: 110px; }
  .collab-status { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  body.shared header { height: 142px; }
  body.shared main { height: calc(100% - 142px); }
}
