/* AW Term: terminal window styles. Prefix: .aw-term */
.aw-term {
  position: relative;
  --aw-term-bg: #1e1e1e;
  --aw-term-fg: #d4d4d4;
  --aw-term-bar: #3a3a3a;
  --aw-term-bar-fg: #cfcfcf;
  --aw-term-prompt: #7fd1b9;
  --aw-term-input: #9cdcfe;
  --aw-term-font: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --aw-term-size: 0.9rem;
  display: block;
  margin: 1.5em 0;
  padding: 0;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--aw-term-bg);
  color: var(--aw-term-fg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  font-family: var(--aw-term-font);
  font-size: var(--aw-term-size);
  line-height: 1.5;
}
.aw-term--theme-light {
  --aw-term-bg: #f8f8f8;
  --aw-term-fg: #222;
  --aw-term-bar: #e4e4e4;
  --aw-term-bar-fg: #444;
  --aw-term-prompt: #0f766e;
  --aw-term-input: #1d4ed8;
}
.aw-term--theme-ubuntu {
  --aw-term-bg: #300a24;
  --aw-term-fg: #ffffff;
  --aw-term-bar: #3c3b37;
  --aw-term-bar-fg: #dfdbd2;
  --aw-term-prompt: #8ae234;
  --aw-term-input: #34e2e2;
}
.aw-term--theme-blue {
  --aw-term-bg: #0b2a4a;
  --aw-term-fg: #e6f0ff;
  --aw-term-bar: #103a66;
  --aw-term-bar-fg: #cfe3ff;
  --aw-term-prompt: #7dd3fc;
  --aw-term-input: #fde68a;
}
.aw-term__titlebar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.4em 0.8em;
  background: var(--aw-term-bar);
  color: var(--aw-term-bar-fg);
  font-size: 0.85em;
  user-select: none;
}
.aw-term__dots {
  display: inline-flex;
  gap: 0.4em;
}
.aw-term__dots i,
.aw-term__dot {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: #ff5f56;
}
.aw-term__dots i:nth-child(2),
.aw-term__dot--min { background: #ffbd2e; }
.aw-term__dots i:nth-child(3),
.aw-term__dot--max { background: #27c93f; }
.aw-term__dot {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.aw-term__dot::before {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 0.65em/1 system-ui, sans-serif;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0;
}
.aw-term__dot--close::before { content: "\00d7"; }
.aw-term__dot--min::before { content: "\2013"; }
.aw-term__dot--max::before { content: "+"; }
.aw-term__dots:hover .aw-term__dot::before,
.aw-term__dot:focus-visible::before { opacity: 1; }
.aw-term__dot:focus-visible { outline: 2px solid var(--aw-term-prompt); outline-offset: 2px; }
/* Windows-style controls: hidden unless the theme asks for them. */
.aw-term__wincontrols {
  display: none;
  gap: 0.2em;
  margin-left: auto;
  flex: none;
}
.aw-term__winbtn {
  width: 2.2em;
  height: 1.8em;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--aw-term-bar-fg);
  cursor: pointer;
  font: 0.95em/1 "Segoe UI Symbol", "Segoe UI", system-ui, sans-serif;
  opacity: 0.85;
}
.aw-term__winbtn--min::before { content: "\2500"; }
.aw-term__winbtn--max::before { content: "\2610"; }
.aw-term__winbtn--close::before { content: "\2715"; }
.aw-term__winbtn:hover,
.aw-term__winbtn:focus-visible { background: rgba(0, 0, 0, 0.08); opacity: 1; outline: none; }
.aw-term__winbtn--close:hover,
.aw-term__winbtn--close:focus-visible { background: #c42b1c; color: #fff; }
.aw-term__title {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Full text for assistive technology while the visual copy is animated. */
.aw-term__sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: pre-wrap;
  border: 0;
}
.aw-term__viewport {
  position: relative;
  overflow-x: auto;
  outline: none;
}
.aw-term__viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--aw-term-prompt); }
/* Fixed height: by default the row count of the terminal each theme imitates (80x24 for Terminal.app,
   GNOME Terminal and Tera Term, 80x25 for iTerm2, 120x30 for Command Prompt, PowerShell and Windows Terminal).
   An explicit rows value sets the variable inline on the viewport. JS follows the typing. */
.aw-term { --aw-term-rows: 24; }
.aw-term--theme-iterm { --aw-term-rows: 25; }
.aw-term--theme-blue, .aw-term--theme-cmd, .aw-term--theme-powershell, .aw-term--theme-winterm { --aw-term-rows: 30; }
.aw-term__viewport--fixed {
  height: calc(var(--aw-term-rows, 24) * 1.5em + 1.8em);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.aw-term__theme {
  font: inherit;
  font-size: 1em;
  padding: 0.15em 0.4em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  color: var(--aw-term-bar-fg);
  max-width: 12em;
}
.aw-term__theme option { color: #111; background: #fff; }
.aw-term--theme-light .aw-term__theme, .aw-term--theme-macos .aw-term__theme, .aw-term--theme-teraterm .aw-term__theme, .aw-term--theme-cmd .aw-term__theme, .aw-term--theme-powershell .aw-term__theme { border-color: rgba(0, 0, 0, 0.25); }
pre.aw-term__screen {
  margin: 0;
  padding: 0.9em 1em;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  white-space: pre;
  font: inherit;
  line-height: inherit;
  min-height: 3em;
}
.aw-term__screen code {
  display: block;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  white-space: pre;
}
.aw-term__line {
  display: block;
  min-height: 1.5em;
}
.aw-term__line.is-hidden { display: none; }
.aw-term__prompt { color: var(--aw-term-prompt); }
.aw-term__line--command .aw-term__text { font-weight: 600; }
.aw-term__line--input .aw-term__prompt,
.aw-term__line--input .aw-term__text { color: var(--aw-term-input); }
.aw-term__color-red { color: #ff6b6b; }
.aw-term__color-yellow { color: #ffd43b; }
.aw-term__color-green { color: #69db7c; }
.aw-term__color-blue { color: #74c0fc; }
.aw-term__color-grey { color: #9a9a9a; }
.aw-term__color-magenta { color: #f783ac; }
.aw-term__color-cyan { color: #66d9e8; }
.aw-term__color-white { color: #ffffff; }
.aw-term--theme-light .aw-term__color-white { color: #000; }
.aw-term__underline { text-decoration: underline; }
.aw-term__blink { animation: aw-term-blink 1s steps(1) infinite; }
.aw-term__cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: aw-term-blink 1s steps(1) infinite;
}
.aw-term__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.8em;
  background: var(--aw-term-bar);
  font-size: 0.8em;
}
.aw-term__btn {
  font: inherit;
  padding: 0.2em 0.7em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  color: var(--aw-term-bar-fg);
  cursor: pointer;
  line-height: 1.6;
}
.aw-term__btn:hover,
.aw-term__btn:focus-visible { background: rgba(255, 255, 255, 0.12); outline: 2px solid var(--aw-term-prompt); outline-offset: 1px; }
.aw-term--theme-light .aw-term__btn { border-color: rgba(0, 0, 0, 0.2); }
.aw-term--theme-light .aw-term__btn:hover { background: rgba(0, 0, 0, 0.06); }
.aw-term__status { margin-left: auto; color: var(--aw-term-bar-fg); opacity: 0.8; }
@keyframes aw-term-blink {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .aw-term__cursor,
  .aw-term__blink { animation: none; }
}

/* ---- Themes that imitate common terminal windows (1.1.0) ---- */
/* macOS Terminal.app, "Basic" profile: white window, grey title bar, traffic lights. */
.aw-term--theme-macos {
  --aw-term-bg: #ffffff;
  --aw-term-fg: #000000;
  --aw-term-bar: linear-gradient(#ececec, #d4d4d4);
  --aw-term-bar-fg: #4a4a4a;
  --aw-term-prompt: #000000;
  --aw-term-input: #0b45b5;
  --aw-term-font: Menlo, "SF Mono", Monaco, "DejaVu Sans Mono", monospace;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.aw-term--theme-macos .aw-term__titlebar { border-bottom: 1px solid #b8b8b8; }
/* iTerm2 with a translucent window: the figure paints a desktop, the window parts are see-through. */
.aw-term--theme-iterm {
  --aw-term-bg: rgba(16, 16, 20, 0.78);
  --aw-term-fg: #f2f2f2;
  --aw-term-bar: rgba(44, 44, 52, 0.82);
  --aw-term-bar-fg: #dadada;
  --aw-term-prompt: #c678dd;
  --aw-term-input: #56b6c2;
  --aw-term-font: Menlo, "SF Mono", Monaco, "DejaVu Sans Mono", monospace;
  padding: 1.25em;
  background: linear-gradient(135deg, #1e3a8a 0%, #6d28d9 45%, #db2777 100%);
  border-radius: 12px;
}
.aw-term--theme-iterm > .aw-term__titlebar,
.aw-term--theme-iterm > .aw-term__viewport,
.aw-term--theme-iterm > .aw-term__toolbar { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.aw-term--theme-iterm > .aw-term__viewport { background: var(--aw-term-bg); }
.aw-term--theme-iterm > .aw-term__titlebar { border-radius: 10px 10px 0 0; }
.aw-term--theme-iterm > :last-child { border-radius: 0 0 10px 10px; }
/* Windows window chrome shared by Tera Term, Command Prompt, PowerShell and Windows Terminal:
   no traffic lights, title on the left, minimise / maximise / close on the right. */
.aw-term--theme-teraterm,
.aw-term--theme-cmd,
.aw-term--theme-powershell,
.aw-term--theme-winterm {
  --aw-term-font: Consolas, "Cascadia Mono", "Cascadia Code", "BIZ UDGothic", "MS Gothic", monospace;
  border-radius: 0;
}
.aw-term--theme-teraterm .aw-term__dots,
.aw-term--theme-cmd .aw-term__dots,
.aw-term--theme-powershell .aw-term__dots,
.aw-term--theme-winterm .aw-term__dots { display: none; }
.aw-term--theme-teraterm .aw-term__title,
.aw-term--theme-cmd .aw-term__title,
.aw-term--theme-powershell .aw-term__title,
.aw-term--theme-winterm .aw-term__title { text-align: left; }
.aw-term--theme-teraterm .aw-term__wincontrols,
.aw-term--theme-cmd .aw-term__wincontrols,
.aw-term--theme-powershell .aw-term__wincontrols,
.aw-term--theme-winterm .aw-term__wincontrols { display: inline-flex; }
.aw-term--theme-winterm .aw-term__winbtn:hover,
.aw-term--theme-winterm .aw-term__winbtn:focus-visible { background: rgba(255, 255, 255, 0.12); }
/* Tera Term: black text on a white VT window, thin grey frame. */
.aw-term--theme-teraterm {
  --aw-term-bg: #ffffff;
  --aw-term-fg: #000000;
  --aw-term-bar: #ffffff;
  --aw-term-bar-fg: #000000;
  --aw-term-prompt: #000000;
  --aw-term-input: #0000c0;
  border: 1px solid #8a8a8a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.aw-term--theme-teraterm .aw-term__titlebar { border-bottom: 1px solid #d9d9d9; }
/* Command Prompt: near-black window, light grey text, white title bar. */
.aw-term--theme-cmd {
  --aw-term-bg: #0c0c0c;
  --aw-term-fg: #cccccc;
  --aw-term-bar: #ffffff;
  --aw-term-bar-fg: #000000;
  --aw-term-prompt: #cccccc;
  --aw-term-input: #f9f1a5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
/* Windows PowerShell console: the classic deep blue. */
.aw-term--theme-powershell {
  --aw-term-bg: #012456;
  --aw-term-fg: #eeedf0;
  --aw-term-bar: #ffffff;
  --aw-term-bar-fg: #000000;
  --aw-term-prompt: #eeedf0;
  --aw-term-input: #f9f1a5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
/* Windows Terminal: dark tab bar with one tab, Campbell colours. */
.aw-term--theme-winterm {
  --aw-term-bg: #0c0c0c;
  --aw-term-fg: #cccccc;
  --aw-term-bar: #202020;
  --aw-term-bar-fg: #ffffff;
  --aw-term-prompt: #16c60c;
  --aw-term-input: #f9f1a5;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.aw-term--theme-winterm .aw-term__titlebar { padding: 0.45em 0.7em 0; gap: 0.5em; }
.aw-term--theme-winterm .aw-term__title {
  flex: 0 1 auto;
  max-width: 60%;
  order: 1;
  padding: 0.35em 1em;
  background: #0c0c0c;
  border-radius: 6px 6px 0 0;
}
.aw-term--theme-winterm .aw-term__titlebar::before { content: "+"; order: 2; opacity: 0.8; }
.aw-term--theme-winterm .aw-term__wincontrols { order: 3; padding-bottom: 0.45em; }
.aw-term--theme-winterm .aw-term__toolbar { padding-top: 0.5em; }
/* Readable colours and buttons on light backgrounds and white bars. */
.aw-term--theme-macos .aw-term__color-red, .aw-term--theme-teraterm .aw-term__color-red, .aw-term--theme-light .aw-term__color-red { color: #c92a2a; }
.aw-term--theme-macos .aw-term__color-yellow, .aw-term--theme-teraterm .aw-term__color-yellow, .aw-term--theme-light .aw-term__color-yellow { color: #946c00; }
.aw-term--theme-macos .aw-term__color-green, .aw-term--theme-teraterm .aw-term__color-green, .aw-term--theme-light .aw-term__color-green { color: #2b8a3e; }
.aw-term--theme-macos .aw-term__color-blue, .aw-term--theme-teraterm .aw-term__color-blue, .aw-term--theme-light .aw-term__color-blue { color: #1864ab; }
.aw-term--theme-macos .aw-term__color-grey, .aw-term--theme-teraterm .aw-term__color-grey, .aw-term--theme-light .aw-term__color-grey { color: #5c5c5c; }
.aw-term--theme-macos .aw-term__color-magenta, .aw-term--theme-teraterm .aw-term__color-magenta, .aw-term--theme-light .aw-term__color-magenta { color: #a61e4d; }
.aw-term--theme-macos .aw-term__color-cyan, .aw-term--theme-teraterm .aw-term__color-cyan, .aw-term--theme-light .aw-term__color-cyan { color: #0b7285; }
.aw-term--theme-macos .aw-term__color-white, .aw-term--theme-teraterm .aw-term__color-white { color: #000; }
.aw-term--theme-macos .aw-term__btn, .aw-term--theme-teraterm .aw-term__btn, .aw-term--theme-cmd .aw-term__btn, .aw-term--theme-powershell .aw-term__btn { border-color: rgba(0, 0, 0, 0.25); }
.aw-term--theme-macos .aw-term__btn:hover, .aw-term--theme-teraterm .aw-term__btn:hover, .aw-term--theme-cmd .aw-term__btn:hover, .aw-term--theme-powershell .aw-term__btn:hover { background: rgba(0, 0, 0, 0.06); }

/* ---- 1.3.0: scrollbars in theme colours ---- */
.aw-term { --aw-term-sb-track: #262626; --aw-term-sb-thumb: #6b6b6b; }
.aw-term--theme-light, .aw-term--theme-macos, .aw-term--theme-teraterm { --aw-term-sb-track: #ffffff; --aw-term-sb-thumb: #c1c1c1; }
.aw-term--theme-ubuntu { --aw-term-sb-track: #300a24; --aw-term-sb-thumb: #8a6a82; }
.aw-term--theme-blue { --aw-term-sb-track: #0b2a4a; --aw-term-sb-thumb: #4b6a98; }
.aw-term--theme-powershell { --aw-term-sb-track: #012456; --aw-term-sb-thumb: #4b6a98; }
.aw-term--theme-cmd, .aw-term--theme-winterm { --aw-term-sb-track: #171717; --aw-term-sb-thumb: #4d4d4d; }
.aw-term--theme-iterm { --aw-term-sb-track: rgba(0, 0, 0, 0.25); --aw-term-sb-thumb: rgba(255, 255, 255, 0.4); }
.aw-term__viewport { scrollbar-color: var(--aw-term-sb-thumb) var(--aw-term-sb-track); }
.aw-term__viewport::-webkit-scrollbar { width: 12px; height: 12px; }
.aw-term__viewport::-webkit-scrollbar-track { background: var(--aw-term-sb-track); }
.aw-term__viewport::-webkit-scrollbar-thumb { background: var(--aw-term-sb-thumb); border-radius: 6px; border: 3px solid var(--aw-term-sb-track); }
.aw-term__viewport::-webkit-scrollbar-corner { background: var(--aw-term-sb-track); }
/* Skip typing only makes sense while the typing plays. */
.aw-term--static button[data-action="showall"] { display: none; }
.aw-term__btn:disabled { opacity: 0.4; cursor: default; }
/* ---- 1.3.0: maximize (Fullscreen API, or a fixed overlay when unavailable) ---- */
.aw-term:fullscreen,
.aw-term--maximized {
  display: flex;
  flex-direction: column;
  margin: 0;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
}
.aw-term:-webkit-full-screen { display: flex; flex-direction: column; margin: 0; max-width: none; border-radius: 0; }
.aw-term--maximized { position: fixed; inset: 0; z-index: 99999; }
.aw-term:fullscreen > .aw-term__viewport,
.aw-term--maximized > .aw-term__viewport { flex: 1 1 auto; height: auto; overflow: auto; }
.aw-term:-webkit-full-screen > .aw-term__viewport { flex: 1 1 auto; height: auto; overflow: auto; }
.aw-term:fullscreen pre.aw-term__screen,
.aw-term--maximized pre.aw-term__screen { font-size: 1.1em; }
.aw-term-lock { overflow: hidden; }
/* ---- 1.3.0: minimize to a dock (mac-style) or a taskbar (Windows-style) ---- */
.aw-term--minimized { display: none !important; }
.aw-term-dock {
  position: fixed;
  z-index: 99998;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.aw-term-dock--mac {
  left: 50%;
  right: auto;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(240, 240, 240, 0.6);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.aw-term-dock--win {
  padding: 4px 8px;
  background: #202020;
  color: #fff;
  border-top: 1px solid #3a3a3a;
}
.aw-term-dock__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  border: 0;
  cursor: pointer;
  font: inherit;
}
.aw-term-dock--mac .aw-term-dock__item {
  flex-direction: column;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 8px;
  background: transparent;
  color: #111;
}
.aw-term-dock--mac .aw-term-dock__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(#3a3a3a, #111);
  color: #e5e5e5;
  font: 700 16px/44px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.aw-term-dock--mac .aw-term-dock__label {
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.aw-term-dock--win .aw-term-dock__item {
  max-width: 16em;
  padding: 6px 12px;
  border-left: 3px solid #4cc2ff;
  background: #2b2b2b;
  color: #fff;
}
.aw-term-dock--win .aw-term-dock__icon { font: 700 12px/1 ui-monospace, Consolas, monospace; }
.aw-term-dock--win .aw-term-dock__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-term-dock__item:hover,
.aw-term-dock__item:focus-visible { outline: 2px solid #4cc2ff; outline-offset: 2px; }
/* ---- 1.3.0: the notice shown by the close button ---- */
.aw-term__dialog {
  max-width: 24em;
  padding: 1.2em 1.4em;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.aw-term__dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.aw-term__dialog p { margin: 0 0 1em; }
.aw-term__dialog .aw-term__btn { color: #111; border-color: rgba(0, 0, 0, 0.3); }
