* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  --preview-checker-light: #f4f6f8;
  --preview-checker-dark: #e2e7ec;
  --preview-checker-size: 14px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  background: #f4f6f8;
  color: #12202f;
  overflow: hidden;
}

.layout {
  height: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: clamp(220px, 20%, 280px) minmax(0, 1fr);
  gap: 0;
}

.panel {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d9e2ea;
  padding: 16px;
}

.sidebar-panel {
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
  border-left: 0;
  border-top: 0;
  border-bottom: 0;
}

.sidebar-main {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -16px;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  flex: 0 0 auto;
  margin: -16px -16px 0;
  padding: 10px 16px;
  border-bottom: 1px solid #d9e2ea;
  background: #ffffff;
}

.sidebar-header h1 {
  margin: 0 0 8px;
}

.sidebar-header .auth-bar {
  margin: 0;
}

.sidebar-footer {
  flex: 0 0 auto;
  margin: 0 -16px -16px;
  padding: 10px 16px;
  border-top: 1px solid #d9e2ea;
  background: #ffffff;
}

.workspace-panel {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.workspace-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid #d9e2ea;
  background: #ecf1f6;
}

.workspace-tab-list {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.workspace-tab-btn {
  border: 0;
  border-radius: 0;
  border-right: 1px solid #d9e2ea;
  min-height: 42px;
  padding: 0 16px;
  background: transparent;
  color: #395067;
  font-weight: 700;
}

.workspace-tab-btn:last-child {
  border-right: 0;
}

.workspace-tab-btn:hover {
  background: #e2ebf4;
}

.workspace-tab-btn.active {
  background: #ffffff;
  color: #0e4b85;
}

.workspace-tab-btn.active:hover {
  background: #ffffff;
}

.workspace-tab-actions {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  min-height: 42px;
  padding: 0 10px;
}

.workspace-tab-actions .actions {
  align-items: stretch;
  align-self: stretch;
  gap: 0;
  height: 100%;
  margin-bottom: 0;
}

.workspace-tab-actions button,
.workspace-tab-actions .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  height: 100%;
  padding: 0 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1f3a55;
  font-weight: 700;
}

.workspace-tab-actions button:hover,
.workspace-tab-actions .link-btn:hover {
  background: transparent;
  color: #0e4b85;
  text-decoration: underline;
}

.workspace-tab-actions .link-btn {
  text-decoration: none;
}

.workspace-tab-actions button.danger-btn {
  color: #9a2c2c;
  border: 0;
  background: transparent;
}

.workspace-tab-actions button.danger-btn:hover {
  border: 0;
  background: transparent;
}

.workspace-view {
  display: grid;
  min-height: 0;
  overflow: hidden;
}

#workspace-assets-view {
  grid-template-rows: minmax(0, 1fr);
}

#workspace-preview-view {
  grid-template-rows: minmax(0, 1fr);
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.workspace-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: 100%;
}

#editor-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  position: relative;
}

#editor-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border: 0;
  border-radius: 0;
}

.editor-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 10px;
  background: #ffffff;
}

#workspace-editor-view > .panel {
  padding: 0;
}

.workspace-panel > .panel {
  border: 0;
  border-radius: 0;
}

.workspace-panel .asset-pane {
  border: 0;
  border-radius: 0;
  min-height: 0;
}

h1,
h2,
h3 {
  margin-top: 0;
}

h3 {
  margin-bottom: 10px;
}

.subtle {
  color: #4b5d6f;
}

.session-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-row .subtle {
  margin: 0;
}

.sidebar-footer .session-row {
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
}

.sidebar-footer #session-info {
  font-size: 12px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-bar {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.auth-bar #auth-info {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-bar .subtle {
  margin: 0;
}

.auth-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.log-panel {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.log-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.log-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0e4b85;
  padding: 0 0 2px 0;
  border-bottom: 1px solid #d0dce8;
}

.log-section-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: #222;
  line-height: 1.55;
}

.settings-panel {
  display: flex;
  flex: 1;
  overflow: auto;
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(14, 75, 133, 0.12), transparent 28%),
    linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
}

.settings-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.settings-copy h2 {
  margin-bottom: 8px;
}

.settings-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0e4b85;
}

.settings-placeholder {
  padding: 24px;
  border: 1px solid #d9e2ea;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #4b5d6f;
  box-shadow: 0 20px 40px rgba(18, 32, 47, 0.08);
}

.settings-placeholder p {
  margin: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select,
input[type="file"],
button {
  font: inherit;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.games-accordion-panel {
  margin-top: 0;
  padding: 0;
  border-top: 0;
}

.games-accordion-label {
  margin: 0;
  font-weight: 600;
}

.games-accordion {
  display: grid;
  gap: 0;
  overflow: visible;
}

.games-accordion-empty {
  margin: 0;
  padding: 8px 0;
}

.game-accordion-item {
  border: 0;
  border-radius: 0;
  background: #f8fafc;
  overflow: hidden;
}

.game-accordion-item.selected {
  border-color: #bad4ed;
  background: #f3f8fd;
}

.game-accordion-header-row {
  display: flex;
  align-items: stretch;
}

.game-accordion-header {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  min-height: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: #1e3348;
  text-align: left;
}

.game-accordion-header:hover {
  background: #edf4fb;
}

.game-accordion-header-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.game-accordion-title {
  font-weight: 700;
  color: #15283a;
}

.game-accordion-id {
  color: #5f7182;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-accordion-marker {
  flex: 0 0 auto;
  color: #4b5d6f;
  font-size: 14px;
  line-height: 1;
}

.game-accordion-content {
  padding: 0;
  border-top: 1px solid #d9e2ea;
}

.game-accordion-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.game-create-edit-inline-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1f3a55;
  min-height: 0;
  padding: 0 12px;
  font-weight: 700;
}

.game-create-edit-inline-btn:hover {
  background: transparent;
  color: #0e4b85;
  text-decoration: underline;
}

.game-create-edit-btn.compact {
  min-width: 38px;
  padding: 0 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.games-accordion-info {
  margin: 2px 2px 4px;
}

.edit-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0;
  min-height: 42px;
}

.edit-actions-hint {
  margin: 0;
  font-weight: 600;
}

.edit-actions-version-info {
  margin: 0 auto 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #8a5a12;
}

.edits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: none;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.edits-list li {
  padding: 0;
  margin: 0;
  border-bottom: 1px solid #e5edf5;
}

.edits-list li:last-child {
  border-bottom: 0;
}

.edits-list-info {
  padding: 8px 12px;
  font-size: 13px;
  color: #4b5d6f;
}

.edit-list-item {
  padding: 0;
}

.edit-list-button {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1e3348;
  text-align: left;
  min-height: 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.edit-list-button:hover {
  background: #eef5fc;
}

.edit-list-button.selected {
  background: #e3effb;
}

.edit-list-button.active .edit-list-title {
  font-weight: 700;
}

.edit-list-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: transparent;
}

.edit-list-button:disabled:hover {
  background: transparent;
}

.edit-actions {
  margin: 0;
}

#edit-actions-controls {
  gap: 0;
}

#edit-actions-controls > button {
  position: relative;
}

#edit-actions-controls > button:not(:disabled) + button:not(:disabled)::before {
  content: "|";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #8ca0b5;
  font-weight: 400;
  pointer-events: none;
}

#preview-actions-bar {
  gap: 0;
}

#preview-actions-bar > * {
  position: relative;
}

.preview-query-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 100%;
  height: 100%;
  padding: 0 10px;
  color: #5f7182;
  font-size: 12px;
  font-weight: 600;
}

.preview-query-prefix {
  flex: 0 0 auto;
  color: #6b7f94;
}

#preview-query-input {
  width: 220px;
  min-height: 28px;
  height: 28px;
  border: 1px solid #cbd9e8;
  border-radius: 0;
  background: #ffffff;
  color: #23384d;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
}

#preview-query-input:focus {
  outline: none;
  border-color: #0e4b85;
}

#preview-query-input:disabled {
  opacity: 0.65;
}

#preview-query-edit-btn {
  padding: 0;
  margin-right: 24px;
  font-size: 16px;
  line-height: 1;
  color: #1f3a55;
}

.preview-query-edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: scale(1.5);
  transform-origin: center;
}

#preview-query-edit-btn:hover {
  color: #0e4b85;
  text-decoration: none;
}

#preview-actions-bar > :is(button:not(:disabled), .link-btn:not(.disabled))
  + :is(button:not(:disabled), .link-btn:not(.disabled))::before {
  content: "|";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #8ca0b5;
  font-weight: 400;
  pointer-events: none;
}

.edit-list-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-left: 0;
}

.edit-list-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-list-branch {
  color: #5f7182;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-list-active {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  color: #24558a;
  background: #e0eefc;
}

.edit-list-status-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.edit-status-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #cbd9e8;
  color: #35516c;
  background: #eef4fb;
  text-transform: uppercase;
}

.edit-status-chip.saved {
  border-color: #98c9a4;
  color: #1f6b34;
  background: #e8f7ec;
}

.edit-status-chip.draft {
  border-color: #e2c47a;
  color: #7a5409;
  background: #fff7e3;
}

.edit-status-chip.finished {
  border-color: #e0b27a;
  color: #8a4e08;
  background: #fff5e8;
}

.edit-status-chip.merged {
  border-color: #c0a0dc;
  color: #5c2d89;
  background: #f2e8fc;
}

.edit-status-chip.completed {
  border-color: #c0a0dc;
  color: #5c2d89;
  background: #f2e8fc;
}

.edit-status-chip.deployed {
  border-color: #98c9a4;
  color: #1f6b34;
  background: #e8f7ec;
}

button {
  border: 1px solid #0e4b85;
  background: #0e4b85;
  color: #ffffff;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: #0b3965;
}

button:disabled {
  display: none !important;
}

button.danger-btn {
  border-color: #9a2c2c;
  background: #9a2c2c;
}

button.danger-btn:hover {
  background: #7d2323;
}

.tiny-btn {
  border: 1px solid #0e4b85;
  background: #ffffff;
  color: #0e4b85;
  border-radius: 6px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
}

.tiny-btn:hover {
  background: #e9f3fc;
}

#view-log-btn,
#auth-logout-btn {
  border: 0;
  background: transparent;
  color: #395067;
  border-radius: 0;
  min-height: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-footer #view-log-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

#view-log-btn:hover,
#auth-logout-btn:hover {
  border: 0;
  background: transparent;
  color: #0e4b85;
  text-decoration: underline;
}

.overlay-view-log-btn {
  border: 0;
  background: transparent;
  color: #395067;
  border-radius: 0;
  min-height: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}

.overlay-view-log-btn:hover {
  border: 0;
  background: transparent;
  color: #0e4b85;
  text-decoration: underline;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #0e4b85;
  background: #ffffff;
  color: #0e4b85;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 600;
}

.link-btn:hover {
  background: #e9f3fc;
}

.link-btn.disabled {
  display: none !important;
}

.asset-browser-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  height: 100%;
}

.asset-pane {
  border: 0;
  border-radius: 8px;
  padding: 0;
  min-height: 420px;
}

.asset-browser-grid > .asset-pane + .asset-pane {
  border-left: 1px solid #d9e2ea;
}

.folders-pane,
.contents-pane,
.detail-pane {
  display: grid;
  align-content: start;
  gap: 10px;
}

.detail-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-height: 0;
  height: 100%;
}

.contents-pane {
  display: flex;
  flex-direction: column;
  align-content: stretch;
  min-height: 0;
  height: 100%;
  gap: 0;
}

.folders-pane {
  display: flex;
  flex-direction: column;
  align-content: stretch;
  min-height: 0;
  height: 100%;
}

.folder-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 620px;
  overflow: auto;
}

.workspace-panel .folder-tree {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  max-height: none;
}

.folder-root,
.folder-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.workspace-panel .folder-tree > .folder-root,
.workspace-panel .folder-tree .folder-children {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.workspace-panel .folder-tree .folder-item:last-child {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace-panel .folder-tree .folder-item:last-child > .folder-children {
  flex: 1 1 auto;
  min-height: 0;
}

.folder-children {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px dashed #cdd9e5;
}

.folder-item {
  margin: 0;
}

.folder-button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #1e3348;
  text-align: left;
  min-height: 42px;
  padding: 10px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.folder-button-main {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.folder-button-folder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex: 0 0 auto;
  color: #577493;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.folder-button:hover {
  background: #f1f6fb;
  border-radius: 0;
}

.folder-button.selected {
  background: #e9f3fc;
  border-color: transparent;
  border-radius: 0;
}

.folder-button-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-button-modified-count {
  flex: 0 0 auto;
  align-self: stretch;
  margin: -10px -8px -10px auto;
  min-width: 42px;
  width: 42px;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: #fff2e0;
  color: #8a4e08;
  border: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.folder-button-modified-count.is-dirty {
  background: #fff2e0;
  color: #8a4e08;
}

.folder-button-modified-count.is-saved {
  background: #e6f4ea;
  color: #1f6b2f;
}

.folder-button-modified-count-text {
  display: inline;
}

.folder-button-modified-reset {
  display: none;
  font-size: 13px;
  line-height: 1;
}

.folder-button-modified-count:hover {
  background: #b42318;
  color: #ffffff;
}

.folder-button-modified-count:hover .folder-button-modified-count-text {
  display: none;
}

.folder-button-modified-count:hover .folder-button-modified-reset {
  display: inline;
}

.drop-zone {
  flex: 0 0 auto;
  margin: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 12px;
  background: #f0f2f4;
  display: block;
  box-shadow: inset 0 -5px 8px -5px rgba(12, 26, 42, 0.32);
  cursor: pointer;
}

.drop-zone-frame {
  width: 100%;
  min-height: 76px;
  border: 1px dashed #7d93a7;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #4b5d6f;
  background: #f8fafc;
  box-shadow: none;
}

.drop-zone:not(.has-pending) .drop-zone-frame {
  height: 76px;
}

.drop-zone.has-pending {
  text-align: left;
}

.drop-zone.has-pending .drop-zone-frame {
  display: block;
  height: auto;
  text-align: left;
}

.drop-zone-hint {
  margin: 0;
  padding: 0 24px;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone-hint[hidden] {
  display: none;
}

.drop-zone-pending {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.drop-zone-pending[hidden] {
  display: none;
}

.drop-zone-pending-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #1e3348;
}

.drop-zone-pending-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  max-height: none;
  overflow: visible;
  color: #395067;
  font-size: 13px;
}

.drop-zone-pending-list li {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid #d4e1ed;
  border-radius: 999px;
  background: #ffffff;
}

.drop-zone-pending-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.drop-zone-pending-remove-btn {
  min-height: 0;
  height: auto;
  width: auto;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #5f7182;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.drop-zone-pending-remove-btn:hover {
  background: transparent;
  color: #1e3348;
}

.drop-zone-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#drop-zone-upload-btn,
#drop-zone-clear-btn {
  min-height: 34px;
  padding: 0 12px;
}

#drop-zone-clear-btn {
  border-color: #8aa0b6;
  background: #ffffff;
  color: #2d4863;
}

#drop-zone-clear-btn:hover {
  background: #eef4fb;
}

.drop-zone.dragging {
  background: transparent;
}

.drop-zone.dragging .drop-zone-frame {
  border-color: #0e4b85;
  background: #e9f3fc;
}

.drop-zone.disabled {
  opacity: 0.65;
  pointer-events: none;
  cursor: not-allowed;
}

.folder-items-grid {
  --asset-list-gap: 0;
  --asset-row-min-height: 76px;
  --asset-thumb-size: 56px;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.folder-empty {
  color: #5f7182;
  border: 1px dashed #d1dce7;
  border-radius: 8px;
  padding: 12px;
}

.folder-items-grid > .folder-empty {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
}

.content-item {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  height: var(--asset-row-min-height);
  min-height: var(--asset-row-min-height);
  min-width: 0;
  color: #1e3348;
  overflow: hidden;
}

button.content-item {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  height: var(--asset-row-min-height);
  min-height: var(--asset-row-min-height);
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.content-item:hover {
  border-color: #a8c4df;
  background: #f7fbff;
}

.content-item.drop-target {
  background: #e9f3fc;
}

.content-item.selected {
  border-color: #6ea6da;
  background: #e9f3fc;
}

.content-item.is-new-dirty {
  background: #fff4cc;
}

.content-item.is-new-dirty .content-name {
  color: #7a5400;
}

.content-item.is-new-saved {
  background: #e6f4ea;
}

.content-item.is-new-saved .content-name {
  color: #1f6b2f;
}

.folder-items-grid > .content-item + .content-item {
  border-top: 1px solid #d9e2ea;
}

.content-thumb,
.content-fallback {
  width: var(--asset-row-min-height);
  flex: 0 0 var(--asset-row-min-height);
  align-self: stretch;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: 0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.content-thumb,
.content-thumb img,
#selected-asset-preview {
  background-color: var(--preview-checker-light);
  background-image: linear-gradient(
      45deg,
      var(--preview-checker-dark) 25%,
      transparent 25%,
      transparent 75%,
      var(--preview-checker-dark) 75%
    ),
    linear-gradient(
      45deg,
      var(--preview-checker-dark) 25%,
      transparent 25%,
      transparent 75%,
      var(--preview-checker-dark) 75%
    );
  background-position: 0 0,
    calc(var(--preview-checker-size) / 2) calc(var(--preview-checker-size) / 2);
  background-size: var(--preview-checker-size) var(--preview-checker-size);
}

.content-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.content-fallback {
  color: #54708a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px;
  text-align: center;
}

.content-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
}

.content-name {
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-size {
  font-size: 12px;
  color: #5f7182;
}

.content-actions {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  height: 100%;
  gap: 0;
  flex: 0 0 auto;
  margin-left: auto;
}

.content-replace-chip {
  flex: 0 0 96px;
  width: 96px;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.92);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 10px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.content-item:hover .content-replace-chip,
.content-item.drop-target .content-replace-chip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.content-replace-chip:hover {
  background: rgba(0, 0, 0, 0.92);
}

.content-modified-chip {
  flex: 0 0 96px;
  width: 96px;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin-left: 0;
  border: 0;
  border-radius: 0;
  background: rgba(248, 235, 216, 0.97);
  color: #8a4e08;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 10px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.content-modified-chip:hover {
  background: rgba(248, 235, 216, 0.97);
}

.content-modified-chip.is-dirty {
  background: rgba(248, 235, 216, 0.97);
  color: #8a4e08;
}

.content-modified-chip.is-saved {
  background: #e6f4ea;
  color: #1f6b2f;
}

.content-modified-chip.is-saved:hover {
  background: #e6f4ea;
}

.asset-version-toggle {
  width: 100%;
  height: 42px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 0;
}

.asset-version-toggle[hidden] {
  display: none;
}

.asset-version-btn {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #ffffff;
  color: #2a435d;
  border-radius: 0;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
}

.asset-version-btn:hover {
  background: #eef4fb;
}

.asset-version-btn.active {
  background: #0e4b85;
  color: #ffffff;
}

.asset-version-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.asset-preview-box {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  background: #f8fafc;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  cursor: default;
  overflow: hidden;
}

.asset-preview-media {
  position: relative;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 0;
}

.asset-preview-media.mode-audio {
  min-height: 400px;
  align-items: center;
  background-color: var(--preview-checker-light);
  background-image: linear-gradient(
      45deg,
      var(--preview-checker-dark) 25%,
      transparent 25%,
      transparent 75%,
      var(--preview-checker-dark) 75%
    ),
    linear-gradient(
      45deg,
      var(--preview-checker-dark) 25%,
      transparent 25%,
      transparent 75%,
      var(--preview-checker-dark) 75%
    );
  background-position: 0 0,
    calc(var(--preview-checker-size) / 2) calc(var(--preview-checker-size) / 2);
  background-size: var(--preview-checker-size) var(--preview-checker-size);
}

.asset-preview-box.clickable {
  cursor: zoom-in;
}

.asset-preview-box.drop-target {
  border-color: #0e4b85;
  background: #e9f3fc;
  box-shadow: inset 0 0 0 1px #8bb4de;
  cursor: copy;
}

.preview-replace-btn,
.preview-reset-btn {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 3;
  min-height: 68px;
  padding: 0 12px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.preview-replace-btn {
  border: 1px solid #0e4b85;
  background: rgba(0, 0, 0, 0.92);
  border-color: #000000;
  color: #ffffff;
}

.preview-reset-btn {
  left: 0;
  right: 0;
  width: 100%;
  z-index: 4;
  border: 0;
  background: rgba(248, 235, 216, 0.97);
  color: #8a4e08;
}

.preview-replace-btn:hover {
  border-color: #000000;
  background: rgba(0, 0, 0, 0.92);
  color: #ffffff;
}

.preview-reset-btn:hover {
  border: 0;
  background: rgba(248, 235, 216, 0.97);
  color: #8a4e08;
}

.asset-preview-box.dual-actions .preview-replace-btn {
  right: auto;
  width: 50%;
}

.asset-preview-box.dual-actions .preview-reset-btn {
  left: 50%;
  right: 0;
  width: 50%;
}

.asset-preview-box:hover .preview-replace-btn,
.asset-preview-box:focus-within .preview-replace-btn,
.asset-preview-box:hover .preview-reset-btn,
.asset-preview-box:focus-within .preview-reset-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#selected-asset-preview,
#selected-asset-audio,
#selected-asset-video,
#selected-asset-text {
  display: none;
}

#selected-asset-preview {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 6px;
}

#selected-asset-audio,
#selected-asset-video {
  width: 100%;
}

.asset-preview-media.mode-audio #selected-asset-audio {
  width: calc(100% - 24px);
  max-width: 720px;
}

#selected-asset-text {
  width: 100%;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  background: #0f1b2a;
  color: #d8e3ef;
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
}

#selected-asset-preview-empty {
  margin: auto;
  text-align: center;
}

#preview-frame {
  display: block;
  width: 100%;
  aspect-ratio: auto;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #000;
}

#assets-panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

#preview-panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  position: relative;
}

#preview-info {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 2;
  margin: 0;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.84);
}

.preview-query-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: grid;
  place-items: center;
  background: rgba(7, 15, 24, 0.52);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.preview-query-overlay[hidden] {
  display: none;
}

.preview-query-overlay-card {
  width: min(560px, 100%);
  background: #ffffff;
  border: 1px solid #d0dce8;
  border-radius: 14px;
  box-shadow: 0 24px 56px rgba(8, 24, 40, 0.22);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preview-query-overlay-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-query-overlay-card h3 {
  margin: 0;
  font-size: 17px;
  color: #0e2238;
}

.preview-query-overlay-subtitle {
  margin: 0;
  font-size: 13px;
}

.preview-query-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-query-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-query-section-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b87a0;
}

.preview-query-toggles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid #dde7f0;
  border-radius: 10px;
  overflow: hidden;
}

.preview-query-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #f7fafd;
  cursor: pointer;
  transition: background 0.12s;
}

.preview-query-toggle-row:not(:last-child) {
  border-bottom: 1px solid #dde7f0;
}

.preview-query-toggle-row:hover {
  background: #eef4fb;
}

.preview-query-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.preview-query-toggle-name {
  font-size: 13px;
  font-weight: 600;
  color: #1b3149;
}

.preview-query-toggle-desc {
  font-size: 11px;
}

.preview-toggle-switch {
  position: relative;
  flex: 0 0 auto;
}

.preview-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.preview-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #c8d6e3;
  position: relative;
  transition: background 0.18s;
}

.preview-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.18s;
}

.preview-toggle-input:checked + .preview-toggle-track {
  background: #0e4b85;
}

.preview-toggle-input:checked + .preview-toggle-track::after {
  transform: translateX(18px);
}

.preview-query-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview-query-option-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-query-option-label {
  font-size: 12px;
  font-weight: 700;
  color: #2b435b;
}

.preview-query-select {
  min-height: 36px;
  border: 1px solid #c8d6e3;
  border-radius: 8px;
  background: #f7fafd;
  color: #1b3149;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.preview-query-select:focus {
  outline: none;
  border-color: #0e4b85;
  background: #ffffff;
}

.preview-query-fileserver-status {
  margin: 0;
  font-size: 11px;
}

.preview-query-advanced {
  border: 1px solid #dde7f0;
  border-radius: 10px;
  overflow: hidden;
}

.preview-query-advanced-summary {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #4a6070;
  background: #f7fafd;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.preview-query-advanced-summary::-webkit-details-marker {
  display: none;
}

.preview-query-advanced-summary::before {
  content: "▶";
  font-size: 9px;
  transition: transform 0.15s;
  color: #6b87a0;
}

.preview-query-advanced[open] .preview-query-advanced-summary::before {
  transform: rotate(90deg);
}

.preview-query-advanced[open] .preview-query-advanced-summary {
  border-bottom: 1px solid #dde7f0;
}

.preview-query-overlay-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 100px;
  border: none;
  border-radius: 0;
  background: #ffffff;
  color: #23384d;
  padding: 12px 14px;
  resize: vertical;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.preview-query-overlay-input:focus {
  outline: none;
}

.preview-query-overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #e8eef4;
}

#preview-query-overlay-cancel-btn {
  border-color: #8aa0b6;
  background: #ffffff;
  color: #2d4863;
}

#preview-query-overlay-cancel-btn:hover {
  background: #eef4fb;
}

.auth-required-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(7, 15, 24, 0.5);
  backdrop-filter: blur(2px);
  padding: 20px;
}

.auth-required-overlay[hidden] {
  display: none;
}

.auth-required-card {
  width: min(520px, 100%);
  background: #ffffff;
  border: 1px solid #d9e2ea;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(8, 24, 40, 0.22);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.auth-required-card h2 {
  margin: 0;
}

.auth-required-card .link-btn {
  justify-self: start;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(7, 15, 24, 0.55);
  backdrop-filter: blur(2px);
  padding: 20px;
}

.upload-overlay[hidden] {
  display: none;
}

.upload-overlay-card {
  width: min(680px, 100%);
  background: #ffffff;
  border: 1px solid #d9e2ea;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(8, 24, 40, 0.28);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.upload-overlay-card h3 {
  margin: 0;
}

#upload-overlay-status {
  white-space: pre-line;
}

.upload-overlay-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #c8d8e8;
  border-top-color: #0e4b85;
  animation: upload-spin 0.85s linear infinite;
}

@keyframes upload-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.upload-overlay-summary {
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.upload-overlay-summary[hidden] {
  display: none;
}

.upload-overlay-group {
  display: grid;
  gap: 6px;
}

.upload-overlay-note {
  margin: 0;
  font-size: 13px;
  color: #4b5d6f;
}

.upload-overlay-group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e3348;
}

.upload-overlay-group-list {
  margin: 0;
  padding-left: 18px;
  color: #2b435b;
  font-size: 13px;
}

.upload-overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.upload-overlay-actions .overlay-view-log-btn {
  margin-right: auto;
}

#upload-overlay-cancel-btn {
  border-color: #8aa0b6;
  background: #ffffff;
  color: #2d4863;
}

#upload-overlay-cancel-btn:hover {
  background: #eef4fb;
}

.git-operation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  background: rgba(7, 15, 24, 0.5);
  backdrop-filter: blur(2px);
  padding: 20px;
}

.git-operation-overlay[hidden] {
  display: none;
}

.git-operation-overlay-card {
  width: min(360px, 100%);
  aspect-ratio: 16 / 10;
  background: #ffffff;
  border: 1px solid #d9e2ea;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(8, 24, 40, 0.28);
  padding: 16px;
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: center;
  text-align: center;
}

#git-operation-overlay-status {
  white-space: pre-line;
  margin: 0;
  text-align: center;
}

.git-operation-overlay-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #c8d8e8;
  border-top-color: #0e4b85;
  animation: upload-spin 0.85s linear infinite;
}

.git-operation-overlay-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.git-operation-overlay-actions .overlay-view-log-btn {
  margin-right: auto;
}

#git-operation-overlay-cancel-btn {
  border-color: #8aa0b6;
  background: #ffffff;
  color: #2d4863;
}

#git-operation-overlay-cancel-btn:hover {
  background: #eef4fb;
}

@media (max-width: 1000px) {
  body {
    overflow: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
    height: auto;
    min-height: 100%;
    padding: 12px;
    gap: 12px;
  }

  .sidebar-panel {
    height: auto;
    min-height: auto;
    max-height: none;
    align-self: start;
  }

  .sidebar-main {
    flex: none;
    overflow: visible;
  }

  .sidebar-footer {
    margin: 12px -16px -16px;
  }

  .workspace-panel {
    height: auto;
    max-height: none;
    grid-template-rows: auto;
    padding: 0;
    overflow: visible;
  }

  .workspace-tabs {
    flex-wrap: wrap;
  }

  .workspace-tab-actions {
    min-height: 0;
    padding: 8px 10px;
    justify-content: flex-start;
    border-top: 1px solid #d9e2ea;
  }

  #edit-actions-version-info {
    width: 100%;
    text-align: center;
  }

  #edit-actions-controls {
    width: 100%;
  }

  #edit-actions-controls {
    justify-content: space-around;
  }

  .preview-query-settings-grid {
    grid-template-columns: 1fr;
  }

  .workspace-view {
    overflow: visible;
  }
  .workspace-tab-list {
    justify-content: space-between;
    width: 100%;
  }
  .workspace-tab-list .workspace-tab-btn {
    width: 25%;
  }
  .workspace-tab-actions {
    width: 100%;
    justify-content: center;
  }
  
  #edit-actions-controls > button:not(:disabled) + button:not(:disabled)::before {
    display: none;
  }
  #assets-panel,
  #preview-panel {
    height: auto;
    overflow: visible;
  }
  #editor-panel {
    margin-top: 0;
    padding: 0;
    min-height: 100vw;
  }
  .settings-panel {
    padding: 18px;
  }

  .settings-copy h2 {
    font-size: 20px;
  }

  .settings-copy p,
  .settings-placeholder {
    font-size: 14px;
  }

  #preview-frame {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 80vw;
  }

  .games-accordion {
    max-height: 360px;
  }

  .asset-browser-grid {
    grid-template-columns: 1fr;
  }

  .asset-browser-grid > .asset-pane + .asset-pane {
    border-left: 0;
    border-top: 1px solid #d9e2ea;
    margin-top: 20px;
  }

  .asset-pane {
    min-height: 0;
  }

  .asset-preview-media { 
    padding: 10px;
    border-radius: 5px;
  }

  .folder-items-grid {
    --asset-list-gap: 8px;
    --asset-thumb-size: 52px;
  }

  .folder-tree {
    max-height: 420px;
  }

  #selected-asset-text {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }

}
