/* Entrance: a sparse centered editor with a narrow header and footer. */

body.glimpse {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) 34px;
  overflow: hidden;
}

.g-head,
.g-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  min-width: 0;
}
.g-sub {
  color: var(--faint);
}
.g-ctl {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.g-enter b {
  color: var(--accent);
}

.g-foot {
  justify-content: space-between;
  color: var(--dim);
}
.g-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.g-hints {
  gap: 18px !important;
}
.g-hints kbd {
  color: var(--fg);
  margin-right: 4px;
}
.g-rec .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mark);
  display: inline-block;
  animation: rec 1.6s steps(1) infinite;
}
:root[data-paused='1'] .g-rec .dot {
  animation: none;
  opacity: 0.35;
}
@keyframes rec {
  50% {
    opacity: 0.2;
  }
}

/* ── stage ──────────────────────────────────────────────────────────── */

.g-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  padding: 8px 12px;
  transition:
    opacity 0.5s var(--ease),
    transform 0.9s cubic-bezier(0.7, 0, 0.84, 0);
}
body.entering .g-stage {
  opacity: 0;
  transform: scale(1.06);
}

.editor {
  --rows: 30;
  width: min(806px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--hair);
  font: 400 var(--ui) / 18px var(--mono);
}

.tabs {
  display: flex;
  height: 22px;
  border-bottom: 1px solid var(--hair);
  overflow: hidden;
  white-space: nowrap;
}
.tabs span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 10px;
  color: var(--faint);
  border-right: 1px solid var(--hair);
  transition: color 0.2s;
}
.tabs span::before {
  content: '';
  width: 2px;
  height: 11px;
  background: transparent;
}
.tabs span.on {
  color: var(--fg);
  background: var(--raise);
}
.tabs span.on::before {
  background: var(--accent);
}
.tabs .tabs-right {
  margin-left: auto;
  border: 0;
  color: var(--faint);
}
.tabs .tabs-right::before {
  display: none;
}

.buffer {
  position: relative;
  height: calc(var(--rows) * var(--code-lh) + 8px);
  padding: 4px 0;
  overflow: hidden;
  cursor: text;
}
.buffer canvas {
  position: absolute;
  inset: 4px 0;
  width: 100%;
  height: calc(100% - 8px);
  display: block;
}
.fallback {
  margin: 0;
  padding: 0 12px;
  font: 400 var(--code) / var(--code-lh) var(--mono);
  color: var(--fg);
  white-space: pre;
  overflow: hidden;
}
.fallback .ln {
  color: var(--faint);
  margin-right: 8px;
}
.editor.live .fallback {
  display: none;
}
.editor:not(.live) canvas {
  display: none;
}

.status {
  display: flex;
  align-items: stretch;
  height: 18px;
  background: var(--hair);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
}
.status > span {
  display: inline-flex;
  align-items: center;
}
.st-mode {
  padding: 0 9px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: background-color 0.15s;
}
.editor[data-ed='INSERT'] .st-mode {
  background: var(--mark);
}
.editor[data-ed='COMMAND'] .st-mode {
  background: var(--fg);
}
.editor[data-ed='BOOT'] .st-mode,
.editor[data-ed='GLIMPSE'] .st-mode {
  background: var(--dim);
}
.st-file {
  padding: 0 10px;
  color: var(--fg);
  gap: 4px;
}
.st-mod {
  color: var(--mark);
}
.st-msg {
  padding: 0 10px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.st-cmd {
  padding: 0 10px;
  color: var(--fg);
}
.st-right {
  gap: 14px;
  padding-right: 10px;
}
.st-dim {
  color: var(--faint);
}
.st-pct {
  min-width: 3ch;
  justify-content: flex-end;
}

.cmdline {
  display: flex;
  align-items: center;
  height: 20px;
  padding: 0 8px 0 10px;
  margin: 0;
  color: var(--fg);
}
.cmd-prompt {
  width: 1ch;
  visibility: hidden;
}
.cmdline.on .cmd-prompt {
  visibility: visible;
}
.cmdline input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  caret-color: var(--cursor);
}
.cmdline input:focus-visible {
  outline: none;
}
.cmd-hint {
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdline.err input {
  color: var(--mark);
}

/* ── input visualization ────────────────────────────────────────────── */

.inputs {
  width: min(806px, 100%);
  height: 96px;
  flex: none;
}
.inputs canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── warp transition ────────────────────────────────────────────────── */

.warp {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
}
body.entering .warp {
  opacity: 1;
}

/* ── responsive ─────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .g-head,
  .g-foot {
    padding: 0 14px;
    gap: 10px;
  }
  .g-sub,
  .g-hints,
  #grid-size,
  .g-rec .sep {
    display: none !important;
  }
  .g-ctl {
    gap: 14px;
  }
  #theme-btn > span:nth-child(2) {
    display: none;
  }
  .st-right .st-dim,
  #st-lang {
    display: none;
  }
  .tabs span:not(.on) {
    display: none;
  }
  .inputs {
    height: 76px;
  }
}
@media (max-width: 420px) {
  #theme-name {
    display: none;
  }
}
@media (max-height: 640px) and (max-width: 760px) {
  .inputs {
    display: none;
  }
}
@media (max-height: 560px) {
  .inputs {
    display: none;
  }
}
