html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
}

/* Top bar */
#top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--bulma-border);
  background: var(--bulma-scheme-main);
  flex-wrap: wrap;
}
#top-bar .buttons { margin-bottom: 0; }
#top-bar .button { margin-bottom: 0; }
#version-display {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.7;
  white-space: nowrap;
}

/* Progress notification */
#load-progress {
  flex-shrink: 0;
}

/* App body: sidebar + main */
#app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Icon strip sidebar */
#icon-strip {
  flex-shrink: 0;
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.5rem;
  gap: 0.25rem;
  border-right: 1px solid var(--bulma-border);
  background: var(--bulma-scheme-main-bis);
}
#icon-strip .button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
}

/* Sidebar panels */
.sidebar-panel {
  flex-shrink: 0;
  width: 280px;
  border-right: 1px solid var(--bulma-border);
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--bulma-scheme-main);
}

/* Sidebar backdrop (mobile overlay) */
#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 30;
}
.sidebar-panel.is-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 31;
  width: 300px;
}

/* Main content area */
#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Tab strip */
#tab-strip {
  flex-shrink: 0;
}
#tab-strip .tabs {
  margin-bottom: 0;
}

/* Editor view: split pane */
#editor-view {
  flex: 1;
  display: flex;
  overflow: hidden;
}
#editor-view .columns {
  flex: 1;
  margin: 0;
  height: 100%;
}
#editor-view .column {
  height: 100%;
  overflow: hidden;
  padding: 0;
}
#col-source {
  display: flex;
  flex-direction: column;
}
#editor-source {
  flex: 1;
  width: 100%;
  min-height: 0;
  line-height: 1.4em;
}
#col-console {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--bulma-border);
}
#console-filter {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--bulma-border);
  flex-wrap: wrap;
}
#console-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.85rem;
  min-height: 0;
}

/* Run view */
#run-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#runarea {
  flex: 1;
  width: 100%;
  border: none;
}

/* Responsive: mobile */
@media (max-width: 768px) {
  #icon-strip {
    display: none;
  }
  .sidebar-panel:not(.is-overlay) {
    display: none;
  }
  #editor-view .columns {
    flex-direction: column;
  }
  #col-source {
    flex: 1;
    min-height: 40%;
  }
  #col-console {
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--bulma-border);
    min-height: 30%;
  }
}
@media (min-width: 769px) {
  #btn-hamburger {
    display: none;
  }
}

/* Embed mode */
.embed-mode #top-bar,
.embed-mode #icon-strip,
.embed-mode .sidebar-panel,
.embed-mode #sidebar-backdrop,
.embed-mode #tab-strip,
.embed-mode #col-console {
  display: none !important;
}
.embed-mode #editor-view .column.is-7 {
  flex: 0 0 100%;
  max-width: 100%;
}
.embed-mode #load-progress {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}
#embed-toolbar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--bulma-border);
  background: var(--bulma-scheme-main);
}
.embed-mode #embed-toolbar {
  display: flex;
}
#embed-errors {
  flex-shrink: 0;
  max-height: 30%;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  border-bottom: 1px solid var(--bulma-border);
  background: var(--bulma-scheme-main-bis);
}
#embed-errors > div {
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
}
#embed-errors > div:hover {
  background: var(--bulma-background);
}
#embed-status { cursor: pointer; }
#embed-run-toolbar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--bulma-border);
  background: var(--bulma-scheme-main);
}
.embed-mode #embed-run-toolbar {
  display: flex;
}

/* Settings panel: JIT debounce field hidden by default */
#jit-debounce-field { display: none; }

/* Assignment panel */
#assignment-panel {
  flex-shrink: 0;
  max-height: 40%;
  overflow-y: auto;
}
#validation-results {
  font-size: 0.95rem;
}
