html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #10131a;
  color: #e8edf2;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.desktop-only-message {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  box-sizing: border-box;
  padding: 28px;
  text-align: center;
  background: #10131a;
  color: #e8edf2;
}

.desktop-only-message h1,
.desktop-only-message p {
  max-width: 520px;
  margin: 0;
}

.desktop-only-message a {
  justify-self: center;
  color: #9bd7ff;
}

.editor-page {
  background: #008080;
  color: #000;
  font-family: Arial, sans-serif;
}

.editor-page #scene {
  position: fixed;
  inset: 0;
}

#editor-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#editor-shell .window,
#editor-shell button,
#editor-shell input,
#editor-shell select,
#editor-shell a {
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
}

#editor-menu {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 1000;
  pointer-events: auto;
}

#editor-menu .window-body {
  margin: 4px;
}

.menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.menu-row a[role="button"] {
  color: #000;
  text-decoration: none;
  margin-left: auto;
}

#tool-strip {
  display: flex;
  gap: 3px;
  align-items: stretch;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #808080;
  overflow-x: auto;
}

#tool-strip button {
  display: grid;
  grid-template-rows: 18px 1fr;
  justify-items: center;
  align-items: center;
  min-width: 58px;
  min-height: 43px;
  padding: 3px 5px;
  line-height: 1;
  white-space: nowrap;
}

#tool-strip button span:first-child {
  font-family: "Times New Roman", serif;
  font-size: 17px;
  line-height: 17px;
}

#tool-strip button span:last-child {
  font-size: 11px;
}

#tool-strip button.is-selected {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px grey;
  background: #c0c0c0;
  padding: 4px 4px 2px 6px;
}

.editor-window {
  position: fixed;
  z-index: 100;
  max-width: calc(100vw - 24px);
  pointer-events: auto;
}

.editor-window.is-hidden {
  display: none;
}

.editor-window.is-minimized .window-body {
  display: none;
}

.editor-window .title-bar {
  cursor: move;
  user-select: none;
}

.editor-window .window-body {
  max-height: min(520px, calc(100vh - 120px));
  overflow: auto;
}

.editor-window fieldset {
  margin: 8px 0;
}

.editor-window input,
.editor-window select {
  box-sizing: border-box;
  max-width: 100%;
}

.editor-window input[type="file"],
.editor-window input[type="text"],
.editor-window input[type="number"],
.editor-window select {
  width: 100%;
}

#editor-map-list {
  width: 100%;
  margin-top: 6px;
}

.editor-window input[type="color"] {
  width: 64px;
  height: 24px;
  padding: 1px;
}

.editor-window .field-row,
.editor-window .field-row-stacked {
  margin: 7px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

#status-window {
  top: auto;
}

#editor-status,
.editor-page .hint {
  color: #000;
  margin: 4px 0;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .editor-window {
    left: 8px !important;
    right: 8px;
    width: auto !important;
  }

  #tools-window { top: 92px !important; }
  #paint-window { top: 260px !important; }
  #assets-window { top: 430px !important; }
  #portal-window,
  #sound-window,
  #environment-window,
  #library-window,
  #map-window,
  #status-window {
    display: none;
  }

  .menu-row a[role="button"] {
    margin-left: 0;
  }
}

#game,
#scene {
  width: 100vw;
  height: 100vh;
  display: block;
}

#hud,
#auth-panel,
#editor-panel {
  position: fixed;
  z-index: 10;
  background: rgba(12, 16, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

#hud {
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 16px;
}

#hud a,
#editor-panel a {
  color: #9bd7ff;
  margin-left: auto;
}

#hud button {
  color: #f6f8fb;
  background: #1b2432;
  border: 1px solid #334056;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

#quality-control {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #cbd5e1;
  font-size: 13px;
}

#quality-control select {
  color: #f6f8fb;
  background: #1b2432;
  border: 1px solid #334056;
  border-radius: 8px;
  padding: 7px 9px;
}

#auth-panel {
  top: 50%;
  left: 50%;
  width: min(340px, calc(100vw - 48px));
  padding: 20px;
  border-radius: 16px;
  transform: translate(-50%, -50%);
}

#auth-panel h1 {
  margin: 0 0 16px;
  font-size: 24px;
}

#auth-panel label,
#auth-panel input,
#auth-panel button {
  display: block;
  box-sizing: border-box;
  width: 100%;
}

#auth-panel label {
  margin-top: 12px;
}

#auth-panel input,
#auth-panel button {
  margin-top: 6px;
  padding: 10px;
  color: #f6f8fb;
  background: #1b2432;
  border: 1px solid #334056;
  border-radius: 10px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

#auth-panel button {
  cursor: pointer;
  background: #2d7dff;
  border-color: #5796ff;
  font-weight: 700;
}

#auth-status {
  color: #aeb9c9;
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 0;
}

#editor-panel {
  top: 16px;
  bottom: 16px;
  left: 16px;
  width: 260px;
  padding: 18px;
  border-radius: 18px;
  overflow: auto;
}

#editor-panel h1 {
  margin: 0 0 16px;
  font-size: 22px;
}

#editor-panel h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

#editor-panel label,
#editor-panel button,
#editor-panel a {
  display: block;
  margin-top: 14px;
}

#editor-panel select,
#editor-panel input,
#editor-panel button {
  box-sizing: border-box;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  color: #f6f8fb;
  background: #1b2432;
  border: 1px solid #334056;
  border-radius: 10px;
}

.editor-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

#editor-panel input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

#editor-panel button {
  cursor: pointer;
  background: #2d7dff;
  border-color: #5796ff;
  font-weight: 700;
}

.hint {
  color: #aeb9c9;
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 700px) {
  #hud {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  #hud a {
    margin-left: 0;
  }

  #editor-panel {
    right: 16px;
    width: auto;
  }
}
