:root {
  color-scheme: dark;
  --bg: #04070e;
  --bg-2: #09111f;
  --panel: rgba(9, 15, 26, 0.86);
  --panel-2: rgba(12, 19, 33, 0.94);
  --panel-3: rgba(6, 10, 18, 0.92);
  --border: rgba(158, 183, 226, 0.14);
  --border-strong: rgba(137, 214, 245, 0.35);
  --text: #eef4ff;
  --muted: #8f9fbb;
  --accent: #7be7ff;
  --accent-2: #9eb0ff;
  --success: #7ee0a0;
  --warning: #ffd679;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
  --radius: 24px;
  --radius-sm: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(117, 231, 255, 0.16), transparent 24%),
    radial-gradient(circle at 100% 8%, rgba(154, 167, 255, 0.14), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(126, 224, 160, 0.08), transparent 30%),
    linear-gradient(180deg, #03060c, #07101d 55%, #03050a);
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 38vmax;
  height: 38vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.16;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}

body::before {
  left: -10vmax;
  top: -12vmax;
  background: radial-gradient(circle, rgba(117, 231, 255, 0.9), transparent 68%);
}

body::after {
  right: -12vmax;
  bottom: -14vmax;
  background: radial-gradient(circle, rgba(154, 167, 255, 0.9), transparent 68%);
  animation-duration: 24s;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  padding: 14px 10px 10px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(9, 14, 24, 0.96), rgba(5, 9, 16, 0.92)),
    radial-gradient(circle at top, rgba(117, 231, 255, 0.06), transparent 42%);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #03101b;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.9), transparent 28%),
    linear-gradient(135deg, #8cf1ff, #a0a7ff);
  box-shadow:
    0 18px 42px rgba(117, 231, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-lang,
.muted {
  color: var(--muted);
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 18px 50px rgba(0, 0, 0, 0.34);
  animation: riseIn 420ms ease both;
}

.project-panel {
  padding: 10px;
}

.sidebar .project-panel .panel-top {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.sidebar .project-panel .status-pill {
  align-self: flex-start;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.panel-title,
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #c8d3ea;
}

.sidebar .panel-title {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
}

.project-name {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  outline: none;
  font-size: 0.88rem;
}

.project-name:focus {
  border-color: rgba(117, 231, 255, 0.38);
  box-shadow: 0 0 0 4px rgba(117, 231, 255, 0.08);
}

.status-pill,
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.status-pill.saved {
  color: var(--success);
  border-color: rgba(126, 224, 160, 0.28);
}

.mode-chip.console {
  color: var(--warning);
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.explorer-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 6px;
  margin-bottom: 4px;
}

.explorer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
}

.explorer-actions .ghost {
  width: 100%;
  justify-content: center;
}

.explorer-actions .ghost:last-child {
  grid-column: auto;
}

.explorer-search {
  width: 100%;
  margin-bottom: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.explorer-search:focus {
  border-color: rgba(117, 231, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(117, 231, 255, 0.08);
}

.ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  padding: 7px 9px;
  border-radius: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  font-size: 0.88rem;
}

.ghost:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.2);
}

.ghost::before {
  content: attr(data-icon);
  margin-right: 5px;
  opacity: 0.88;
}

.ghost.tiny {
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 0.76rem;
}

.sidebar .ghost {
  width: 100%;
  min-height: 34px;
  padding: 0;
  font-size: 0;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.sidebar .ghost::before {
  margin: 0;
  font-size: 1rem;
}

.sidebar .ghost.tiny {
  min-height: 32px;
  font-size: 0;
  padding: 0;
}

.sidebar .explorer-search {
  margin-bottom: 6px;
  padding: 8px 9px;
  font-size: 0.82rem;
}

.ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.ghost.primary {
  border-color: rgba(117, 231, 255, 0.34);
  background: linear-gradient(135deg, rgba(117, 231, 255, 0.16), rgba(154, 167, 255, 0.14));
}

.ghost.active {
  border-color: rgba(126, 224, 160, 0.42);
  background: linear-gradient(135deg, rgba(126, 224, 160, 0.16), rgba(117, 231, 255, 0.1));
  color: #eaffef;
  box-shadow: 0 0 0 1px rgba(126, 224, 160, 0.08);
}

.file-list,
.tabs {
  display: grid;
  gap: 8px;
}

.file-entry,
.tab {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  animation: slideUp 260ms ease both;
}

.file-entry {
  cursor: grab;
}

.file-entry.folder-label {
  cursor: default;
}

.file-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.file-icon {
  width: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  color: #9be7ff;
  font-size: 0.88rem;
  opacity: 0.9;
}

.file-path {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-entry:active {
  cursor: grabbing;
}

.file-entry.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.file-entry.drop-target {
  border-color: rgba(117, 231, 255, 0.45);
  background: rgba(117, 231, 255, 0.08);
}

.file-entry:hover,
.tab:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.tab {
  cursor: default;
}

.tab:hover {
  transform: none;
  box-shadow: none;
}

.file-entry.active,
.tab.active {
  border-color: rgba(117, 231, 255, 0.34);
  background: linear-gradient(135deg, rgba(117, 231, 255, 0.1), rgba(154, 167, 255, 0.08));
}

.folder-entry .file-lang {
  color: #cfe6ff;
}

.asset-entry .file-lang {
  color: #ffd179;
}

.file-name,
.tab-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name {
  font-size: 0.92rem;
}

.file-lang {
  font-size: 0.72rem;
}

.sidebar .panel {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.sidebar .panel:hover {
  transform: translateY(-1px);
  border-color: rgba(161, 180, 220, 0.28);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.empty-state {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  line-height: 1.45;
}

.main-shell {
  min-width: 0;
  padding: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 4px 2px 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.88fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.app-shell.game-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
}

.app-shell.game-mode .editor-panel {
  display: flex;
  position: static;
  width: auto;
  max-height: none;
  z-index: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18%),
    rgba(8, 12, 20, 0.94);
  backdrop-filter: blur(18px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 18px 50px rgba(0, 0, 0, 0.34);
}

.app-shell.game-mode .output-panel {
  min-height: 0;
  min-height: calc(100vh - 160px);
}

.app-shell.game-mode .workspace {
  position: relative;
}

.app-shell.game-mode .editor-shell,
.app-shell.game-mode .autocomplete-menu {
  display: none;
}

.app-shell.game-mode .editor-panel .tabbar {
  margin-bottom: 0;
}

.editor-panel,
.output-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  min-height: 0;
}

.editor-panel {
  position: relative;
  padding: 8px;
}

.tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

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

.editor-shell {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 12, 19, 0.76), rgba(10, 15, 25, 0.98)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.014),
      rgba(255, 255, 255, 0.014) 27px,
      transparent 27px,
      transparent 28px
    );
  box-shadow:
    inset 0 0 0 1px rgba(126, 224, 160, 0.05),
    0 18px 42px rgba(0, 0, 0, 0.24);
}

.editor-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.96), rgba(7, 10, 15, 0.99)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 29px,
      rgba(117, 231, 255, 0.028) 29px,
      rgba(117, 231, 255, 0.028) 30px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 29px,
      rgba(154, 167, 255, 0.024) 29px,
      rgba(154, 167, 255, 0.024) 30px
    ),
    radial-gradient(circle at 20% 0%, rgba(117, 231, 255, 0.06), transparent 38%),
    radial-gradient(circle at 82% 0%, rgba(154, 167, 255, 0.045), transparent 36%);
  box-shadow: inset 0 0 0 1px rgba(117, 231, 255, 0.03);
}

.editor-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, transparent 0, transparent calc(2ch - 1px), rgba(255, 255, 255, 0.022) calc(2ch - 1px), rgba(255, 255, 255, 0.022) 2ch),
    linear-gradient(to right, transparent 0, transparent calc(4ch - 1px), rgba(117, 231, 255, 0.05) calc(4ch - 1px), rgba(117, 231, 255, 0.05) 4ch),
    linear-gradient(to right, transparent 0, transparent calc(8ch - 1px), rgba(154, 167, 255, 0.03) calc(8ch - 1px), rgba(154, 167, 255, 0.03) 8ch),
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.03), transparent 28%);
  background-size: 2ch 100%, 4ch 100%, 8ch 100%, 100% 100%;
  background-position: 18px 0, 18px 0, 18px 0, 0 0;
  opacity: 0.62;
}

.line-numbers {
  padding: 12px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #6c7ba0;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: right;
  overflow: hidden;
  user-select: none;
}

.editor-highlight {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 16px 16px;
  color: rgba(237, 244, 255, 0.86);
  background: transparent;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.35;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  word-wrap: normal;
  overflow: auto;
  scrollbar-width: none;
  z-index: 1;
}

.editor-highlight::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.editor-panel.large-file-mode .editor-highlight {
  display: none;
}

.editor-panel.large-file-mode #editor {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}

.editor-panel.large-file-mode .autocomplete-menu {
  display: none;
}

.token.keyword {
  color: #9aa7ff;
}

.token.string {
  color: #8de7b5;
}

.token.number {
  color: #ffd179;
}

.token.comment {
  color: #7583a8;
  font-style: italic;
}

.token.tag {
  color: #6ee7ff;
}

.token.attr {
  color: #f3b1ff;
}

.line-number {
  padding: 0 12px 0 0;
}

#editor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  color: rgba(237, 244, 255, 0.28);
  -webkit-text-fill-color: rgba(237, 244, 255, 0.28);
  caret-color: #f4f7ff;
  background: transparent;
  padding: 12px 16px 16px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.35;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  word-wrap: normal;
  overflow: auto;
  overscroll-behavior: contain;
  min-height: 0;
  z-index: 1;
}

#editor::selection {
  background: rgba(117, 231, 255, 0.24);
}

.autocomplete-menu {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100% - 32px));
  border-radius: 20px;
  border: 1px solid rgba(117, 231, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(7, 12, 22, 0.98), rgba(4, 8, 15, 0.98));
  box-shadow:
    0 26px 68px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
  backdrop-filter: blur(18px);
  animation: popIn 180ms ease;
  z-index: 20;
}

.autocomplete-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.autocomplete-item:first-child {
  border-top: 0;
}

.autocomplete-item.active,
.autocomplete-item:hover {
  background:
    linear-gradient(90deg, rgba(117, 231, 255, 0.12), rgba(154, 167, 255, 0.1));
  transform: translateX(2px);
}

.autocomplete-keyword {
  color: #c8f9ff;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.autocomplete-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.autocomplete-detail {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.autocomplete-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.autocomplete-kind {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(117, 231, 255, 0.08);
  border: 1px solid rgba(117, 231, 255, 0.14);
  color: #9beaff;
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.output-panel {
  padding: 10px;
}

.output-panel .panel-title {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
}

.output-panel .panel-top {
  align-items: center;
  gap: 8px;
}

.output-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.output-panel:fullscreen .output-surface {
  flex: 1;
}

.output-panel:fullscreen .console-input-row {
  flex-shrink: 0;
}

.output-surface {
  margin-top: 8px;
  min-height: 0;
  flex: 1;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(1, 5, 9, 0.99), rgba(4, 7, 12, 0.99));
  position: relative;
  box-shadow:
    inset 0 0 28px rgba(126, 224, 160, 0.04),
    inset 0 0 0 1px rgba(126, 224, 160, 0.05);
}

.output-panel.cobol-terminal .output-surface {
  border-color: rgba(126, 224, 160, 0.24);
  background:
    radial-gradient(circle at top, rgba(126, 224, 160, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(2, 8, 5, 0.98), rgba(4, 10, 7, 0.98));
}

.output-surface iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: white;
}

.preview-shell {
  min-height: 100%;
  display: grid;
  grid-template-rows: minmax(240px, 1fr) auto;
  gap: 8px;
  padding: 0;
}

.preview-shell iframe {
  min-height: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-console {
  max-height: 180px;
  margin: 0 8px 8px;
  border-radius: 8px;
  border: 1px solid rgba(126, 224, 160, 0.22);
  box-shadow:
    0 0 0 1px rgba(126, 224, 160, 0.06) inset,
    0 0 18px rgba(126, 224, 160, 0.05);
}

.console {
  min-height: 0;
  height: 100%;
  padding: 9px;
  background:
    linear-gradient(180deg, rgba(1, 4, 7, 0.99), rgba(4, 8, 10, 0.99)),
    repeating-linear-gradient(
      180deg,
      rgba(126, 224, 160, 0.045),
      rgba(126, 224, 160, 0.045) 1px,
      transparent 1px,
      transparent 4px
    );
  color: #ccffd7;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow: auto;
  box-shadow: inset 0 0 18px rgba(126, 224, 160, 0.03);
}

.output-panel.cobol-terminal .console {
  color: #d6ffe0;
  background:
    linear-gradient(180deg, rgba(1, 7, 4, 0.99), rgba(2, 11, 6, 0.99)),
    repeating-linear-gradient(
      180deg,
      rgba(126, 224, 160, 0.055),
      rgba(126, 224, 160, 0.055) 1px,
      transparent 1px,
      transparent 4px
    );
}

.asset-preview,
.folder-preview {
  display: grid;
  gap: 12px;
  padding: 12px;
  color: var(--text);
  min-height: 100%;
}

.asset-title {
  font-size: 1rem;
  font-weight: 700;
}

.asset-subtitle {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 4px;
}

.asset-detail {
  color: #aebedf;
  font-size: 0.78rem;
}

.asset-media {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.asset-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.4;
}

.folder-children {
  display: grid;
  gap: 8px;
}

.folder-child {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.folder-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.output-surface.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(117, 231, 255, 0.12), transparent);
  animation: shimmer 1s linear infinite;
}

.console-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 8px;
}

.console-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(126, 224, 160, 0.26);
  padding: 9px 10px;
  background: rgba(2, 10, 5, 0.96);
  color: #d6ffe0;
  box-shadow: 0 0 0 1px rgba(126, 224, 160, 0.05) inset;
  outline: none;
}

.console-input:focus {
  border-color: rgba(126, 224, 160, 0.48);
  box-shadow: 0 0 0 4px rgba(126, 224, 160, 0.1);
}

.console-line {
  margin: 0 0 4px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fadeInUp 180ms ease both;
  text-shadow: 0 0 8px rgba(126, 224, 160, 0.05);
}

.console-line.log {
  color: #e5ffee;
}

.console-line.info {
  color: #b2ffd0;
}

.console-line.warn {
  color: #dff7a8;
}

.console-line.error {
  color: #ffbfc1;
}

.console-line.input {
  color: #d6ffe0;
}

.console-screen {
  margin: 0;
  min-height: 100%;
  min-width: max-content;
  width: max-content;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.05;
  letter-spacing: 0;
  font-variant-ligatures: none;
  white-space: pre;
  overflow: auto;
  display: block;
  color: #d6ffe0;
  text-shadow: 0 0 8px rgba(126, 224, 160, 0.1);
}

.output-panel.cobol-terminal .console-screen {
  color: #e0ffe7;
  text-shadow: 0 0 10px rgba(126, 224, 160, 0.16);
  font-size: 0.86rem;
  line-height: 1.08;
}

.output-panel.cobol-terminal .console-input-row {
  margin-top: 10px;
}

.output-panel.cobol-terminal .console-input {
  background: rgba(3, 16, 8, 0.92);
  border-color: rgba(126, 224, 160, 0.24);
  color: #d7ffe0;
}

.output-panel.cobol-terminal .console-input:focus {
  border-color: rgba(126, 224, 160, 0.44);
  box-shadow: 0 0 0 4px rgba(126, 224, 160, 0.08);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 11, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 32px));
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(9, 14, 25, 0.98);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: popIn 220ms ease;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  color: #d7e3ff;
  font-size: 0.9rem;
}

.field input,
.field select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(117, 231, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(117, 231, 255, 0.08);
}

.modal-actions {
  display: flex;
  justify-content: end;
  margin-top: 16px;
}

.modal[hidden] {
  display: none;
}

body.drag-importing .app-shell::after {
  content: "Drop files to import";
  position: fixed;
  inset: 16px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  border: 1px dashed rgba(117, 231, 255, 0.5);
  background: rgba(7, 12, 22, 0.78);
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 40;
  pointer-events: none;
  animation: popIn 180ms ease;
}

.app-shell.game-mode .editor-panel .tab-actions {
  flex-wrap: nowrap;
}

.app-shell.game-mode .editor-panel .tab-actions .ghost {
  white-space: nowrap;
}

.app-shell.game-mode .editor-panel {
  border-color: rgba(126, 224, 160, 0.18);
}

.app-shell.game-mode .editor-panel::after {
  content: "Game Mode";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(126, 224, 160, 0.24);
  background: rgba(6, 12, 10, 0.7);
  color: #bff6cf;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(20px, 18px, 0) scale(1.12); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .main-shell {
    padding: 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .app-shell.game-mode .editor-panel {
    position: static;
    width: auto;
    max-height: none;
  }

  .app-shell.game-mode .output-panel {
    min-height: 60vh;
  }
}

@media (max-width: 720px) {
  .main-shell {
    padding: 10px;
  }

  .brand-title {
    font-size: 0.92rem;
  }

  .topbar,
  .tabbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    align-items: start;
  }

  .editor-shell {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .tab-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explorer-actions {
    grid-template-columns: 1fr;
  }

  .explorer-actions .ghost:last-child {
    grid-column: auto;
  }

  .app-shell.game-mode .editor-panel .tab-actions {
    grid-template-columns: 1fr 1fr;
  }
}
