:root {
  --font: Pretendard, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b0c0f;
  color: #e4e5e8;
  font-family: var(--font);
  touch-action: none;
}

@supports (height: 100dvh) {
  html,
  body {
    height: 100dvh;
    min-height: 100dvh;
  }
}

#stage {
  position: fixed;
  inset: 0;
  background: #0b0c0f;
  touch-action: none;
}

#stage iframe,
.game-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b0c0f;
  touch-action: none;
}

.hud {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
}

#playHudRoot,
#editStudioHeader,
#editStudioThread,
#editStudioComposer,
#editExitSheet,
#recordLayer,
#gen {
  display: contents;
}

.edit-modebar {
  position: fixed;
  z-index: 50;
  top: max(10px, env(safe-area-inset-top));
  right: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  pointer-events: none;
  transition: opacity .35s ease;
}

.edit-modebar[hidden] {
  display: none;
}

[hidden] { display: none !important; }

.sheet {
  position: fixed;
  z-index: 40;
  inset: 0;
  pointer-events: auto;
}

#editSheet {
  --edit-visual-viewport-left: 0px;
  --edit-visual-viewport-top: 0px;
  --edit-visual-viewport-right: 0px;
  --edit-visual-viewport-bottom: 0px;
  --edit-visual-viewport-width: 100vw;
  --edit-visual-viewport-panel-min-height: 42vh;
  --edit-visual-viewport-panel-max-height: 52vh;
  pointer-events: none;
}

.edit-studio-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(30, 30, 30, .88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), inset 1px 0 0 rgba(255, 255, 255, .03), 0 -24px 64px rgba(0, 0, 0, .44);
  -webkit-backdrop-filter: blur(32px) saturate(1);
  backdrop-filter: blur(32px) saturate(1);
  pointer-events: auto;
}

.edit-studio-content {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  margin-top: 52px;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.edit-conversation-panel {
  height: auto;
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 14px 0 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
}

#editStudioComposer {
  flex: 0 0 auto;
}

@media (orientation: landscape) {
  .edit-studio-panel {
    top: var(--edit-visual-viewport-top);
    right: var(--edit-visual-viewport-right);
    bottom: var(--edit-visual-viewport-bottom);
    left: auto;
    width: min(380px, 44vw, calc(var(--edit-visual-viewport-width) - 68px));
    max-width: none;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) 12px;
    border: 0;
    border-radius: 18px 0 0 18px;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, .06), -24px 0 58px rgba(0, 0, 0, .45);
  }
}

@media (orientation: portrait) {
  .edit-studio-panel {
    right: var(--edit-visual-viewport-right);
    bottom: var(--edit-visual-viewport-bottom);
    left: var(--edit-visual-viewport-left);
    width: auto;
    min-height: min(42vh, var(--edit-visual-viewport-panel-min-height));
    max-height: min(360px, 52vh, var(--edit-visual-viewport-panel-max-height));
    padding: 8px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-radius: 18px 18px 0 0;
  }

  .edit-conversation-panel {
    padding: 10px 0 8px;
  }
}

html.lite-glass .edit-studio-panel {
  background: #1e1e1e;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .edit-studio-panel {
    background: rgba(30, 30, 30, .96);
  }
}
