/* the shared .wrap cap (1180px) is what actually sizes this page's window */
.wrap.wide { max-width: 1420px; }

:root {
  /* VS Code on Arch renders "monospace" as DejaVu Sans Mono; Noto Sans Mono is
     the closest face available as a webfont for machines without it. */
  --vsc-mono: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Liberation Mono',
              'Noto Sans Mono', Consolas, 'Courier New', monospace;
}

/* VS Code window chrome — pixel-faithful to the Dark+ theme on the screenshot. */
.vscode {
  max-width: 1400px;
  margin: 26px auto 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2d33;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.5);
  background: #1e1e1e;
  font-family: var(--vsc-mono);
  position: relative;
  z-index: 1;
}

/* title bar */
.vsc-titlebar {
  height: 35px;
  background: #3c3c3c;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #2a2a2a;
  user-select: none;
}
.vsc-titlebar .title {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  text-align: center;
  color: #cccccc;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsc-titlebar .controls { display: flex; gap: 18px; color: #a8a8a8; font-size: 11px; }
.vsc-titlebar .controls span { cursor: default; padding: 0 2px; }
.vsc-titlebar .controls .close:hover { color: #fff; }

.vsc-main { display: flex; height: 640px; }
@media (max-width: 760px) { .vsc-main { height: 560px; } }

/* activity bar */
.vsc-activity {
  width: 48px;
  background: #333333;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0;
  border-right: 1px solid #2a2a2a;
  user-select: none;
}
.vsc-activity .ico {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #858585;
  position: relative;
}
.vsc-activity .ico.active { color: #fff; }
.vsc-activity .ico.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #fff;
}
.vsc-activity .ico svg { width: 24px; height: 24px; fill: currentColor; }
.vsc-activity .spacer { flex: 1; }

/* editor side */
.vsc-editor { flex: 0 0 38%; display: flex; flex-direction: column; min-width: 0; background: #1e1e1e; }
.vsc-tabs { display: flex; background: #252526; height: 35px; user-select: none; }
.vsc-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: #1e1e1e;
  color: #e8e8e8;
  font-size: 13px;
  border-top: 1px solid #1e1e1e;
  position: relative;
}
.vsc-tab::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: #0078d4; }
.vsc-tab .ticon { color: #519aba; font-size: 11px; font-weight: 700; letter-spacing: -0.5px; }
.vsc-tab .x { color: #8b8b8b; margin-left: 6px; font-size: 15px; }

.vsc-code {
  flex: 1;
  overflow: auto;
  font-family: var(--vsc-mono);
  margin: 0;
  padding: 8px 0 14px 8px;
  font-size: 13.6px;
  line-height: 19px;
  color: #d4d4d4;
  scrollbar-width: thin;
  scrollbar-color: #4f4f4f transparent;
}
.vsc-code::-webkit-scrollbar { width: 10px; height: 10px; }
.vsc-code::-webkit-scrollbar-thumb { background: #4f4f4f; border: 3px solid #1e1e1e; border-radius: 6px; }
.vsc-code::-webkit-scrollbar-track { background: transparent; }
.vsc-code .ln { display: flex; width: max-content; min-width: 100%; }
.vsc-code .ln .no {
  width: 42px;
  flex: 0 0 42px;
  text-align: right;
  padding-right: 22px;
  color: #6e7681;
  position: sticky;
  left: 0;
  background: #1e1e1e;
  z-index: 1;
}
.vsc-code .ln .src { white-space: pre; padding-right: 18px; }
.vsc-code .kw { color: #c586c0; }
.vsc-code .num { color: #b5cea8; }
.vsc-code .var { color: #9cdcfe; }
.vsc-code .cm { color: #6a9955; }
.vsc-code .str { color: #ce9178; }
.vsc-code .pp { color: #c586c0; }

/* panel */
.vsc-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #1e1e1e;
  border-top: 1px solid #2b2b2b;
}
.vsc-panel-tabs {
  display: flex;
  align-items: center;
  height: 35px;
  padding: 0 10px;
  user-select: none;
}
.vsc-panel-tabs .ptab {
  color: #858585;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 10px;
  height: 35px;
  display: flex;
  align-items: center;
  position: relative;
  cursor: default;
}
.vsc-panel-tabs .ptab.active { color: #e8e8e8; }
.vsc-panel-tabs .ptab.active::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: #e8e8e8;
}
.vsc-panel-actions { margin-left: auto; display: flex; gap: 12px; color: #858585; font-size: 14px; padding-right: 4px; }
.vsc-panel-actions .act { cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.vsc-panel-actions .act:hover { color: #fff; background: #2a2d32; }
.vsc-panel-actions .act.on { color: #4daafc; }

/* terminal body */
.vsc-terminal {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 14px 14px 20px;
  font-family: var(--vsc-mono);
  font-size: 14px;
  line-height: 1.36;
  cursor: text;
}
.vsc-terminal::-webkit-scrollbar { width: 14px; }
.vsc-terminal::-webkit-scrollbar-thumb { background: #4f4f4f; border: 4px solid #1e1e1e; border-radius: 8px; }
.vsc-terminal::-webkit-scrollbar-track { background: transparent; }

.tline { white-space: pre-wrap; overflow-wrap: break-word; min-height: 19px; }
.tline .m { color: #569cd6; }              /* shell integration markers */
.tline .dot { color: #2f9bd8; }            /* command decoration bullet */
.tline .u { color: #3b8eea; }              /* user   — blue  */
.tline .h { color: #e5c07b; }              /* host   — yellow */
.tline .c { color: #cccccc; }              /* '@', ':' and '$' */
.tline .p { color: #e06c75; }              /* path   — red   */
.tline .o { color: #cccccc; }              /* program output */
.tline .in { color: #e8e8e8; }             /* echoed user input */
.tline .err { color: #f14c4c; }

.cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 1px;
  background: #cccccc;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
.cursor.typing { animation: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* keycaps under the window */
.keydeck {
  max-width: 1400px;
  margin: 18px auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 1;
  padding: 0 16px;
}
.keyhint { color: var(--text-faint); font-size: 12.5px; text-align: center; }
.keyhint b { color: var(--text-dim); font-weight: 600; }

.keyrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.key {
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: linear-gradient(180deg, #1d222b, #161a21);
  box-shadow: 0 3px 0 #0c0e12, inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.04s ease, box-shadow 0.04s ease, background 0.12s ease;
  user-select: none;
}
.key:hover { background: linear-gradient(180deg, #232936, #1a1f27); }
.key:active, .key.pressed {
  transform: translateY(3px);
  box-shadow: 0 0 0 #0c0e12, inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.key.wide { min-width: 84px; }
.key.accent { border-color: rgba(23, 147, 209, 0.55); color: var(--arch-soft); }
.key.danger { border-color: rgba(239, 68, 68, 0.4); color: #f08c8c; }
.key[disabled] { opacity: 0.35; pointer-events: none; }

/* ---- tablets: drop the source pane, keep the rest of the chrome ---- */
@media (max-width: 760px) {
  .key { min-width: 38px; height: 40px; }
  /* display:none, not flex:0 — a zero-basis flex item still renders its tab
     strip, which drew on top of the panel's TERMINAL tab */
  .vsc-editor { display: none; }
  .vsc-panel { flex: 1; }
  /* only the active tab fits — the rest push the panel actions off the edge */
  .vsc-panel-tabs { padding: 0 6px; }
  .vsc-panel-tabs .ptab:not(.active) { display: none; }
  .vsc-panel-actions { gap: 10px; }
  .vsc-terminal { padding: 6px 10px 12px 12px; font-size: 12.5px; }
}

/* ---- phones: the prompt and the enter key must share one screen ---- */
@media (max-width: 560px) {
  .wrap.wide { padding: 12px 10px 28px; }
  .vscode { margin-top: 0; border-radius: 6px; }

  /* nothing in the activity bar is tappable — it was costing 48 of ~355px */
  .vsc-activity { display: none; }

  .vsc-titlebar { height: 30px; padding: 0 8px; }
  .vsc-titlebar .title { font-size: 11.5px; text-align: left; padding-left: 6px; }
  .vsc-titlebar .controls { gap: 12px; }
  .vsc-titlebar .controls:last-child { display: none; }

  /* dvh first-class, vh above it as the fallback: iOS Safari's vh assumes a
     collapsed URL bar and would push the keypad under it */
  .vsc-main { height: 46vh; height: clamp(220px, 46dvh, 430px); }
  .vsc-terminal { padding: 6px 10px 10px 10px; font-size: 12px; }

  .keydeck { margin-top: 12px; gap: 8px; padding: 0; }
  #keyDigits { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 100%; }
  .keyrow:not(#keyDigits) { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 6px; width: 100%; }
  /* 44px is the smallest comfortable touch target */
  .keyrow .key, .keyrow .key.wide { min-width: 0; width: 100%; height: 46px; padding: 0 4px; }
  .keyhint { font-size: 11.5px; line-height: 1.45; }
}
