/* kraft — console mode: a framed terminal window, glass on black (dark) or paper (light), IBM Plex Mono.
   Black and white first; restrained accents: blue user, violet path, yellow markers, green for "achieved". */

/* ---------- Page and window ---------- */
.term-page { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center; padding: 22px 22px 6px; font: 400 .875rem/1.6 var(--mono); color: var(--term-text); }
/* Faint brand light behind the glass */
.term-page::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(38% 46% at 12% 8%, var(--glow-b), transparent 70%), radial-gradient(36% 44% at 92% 30%, var(--glow-a), transparent 70%),
    radial-gradient(30% 30% at 55% 105%, var(--glow-c), transparent 70%); }
.term-window { width: min(1120px, 100%); height: calc(100vh - 52px); height: calc(100dvh - 52px); min-height: 360px; display: flex; flex-direction: column;
  min-width: 0; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--term-bg);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(var(--tint), .03) inset, 0 0 90px -40px var(--bar-glow); }
.term-window-login { height: auto; min-height: 0; max-width: 760px; align-self: center; }
.page-login .term-page { align-items: center; }
.term-window ::selection { background: var(--term-select); }

/* Title bar: three hairline dots, the title, round tools */
.term-bar { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 10px 0 14px; flex-shrink: 0; min-width: 0;
  background: var(--term-bar); border-bottom: 1px solid var(--line); }
.term-dots { display: flex; gap: 7px; flex-shrink: 0; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(var(--tint), .06); }
.term-dots i:first-child { background: rgba(var(--tint), .22); }
.term-title { flex: 1; min-width: 0; margin: 0; text-align: center; color: var(--muted); font-size: .78rem; letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.term-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; min-width: 28px; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(var(--tint), .05); color: var(--term-text); cursor: pointer; font: 500 .75rem/1 var(--mono);
  transition: background .15s, border-color .15s; }
.term-btn:hover { background: rgba(var(--tint), .13); border-color: rgba(var(--tint), .3); }
.term-btn .ico { width: 15px; height: 15px; }
.term-btn-label { padding: 0 10px 0 8px; }

/* Body: the scrolling screen of the terminal */
.term-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 22px 22px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.term-body pre, .term-body p { font: inherit; }

/* Logotype and message of the day */
.term-logo { display: block; width: min(370px, 100%); height: auto; margin: 4px 0 14px; overflow: visible;
  filter: drop-shadow(0 0 18px rgba(10, 101, 231, .28)) drop-shadow(0 0 30px rgba(138, 42, 227, .18)); }
.term-logo-ink { fill: var(--fg); }
.term-logo-shade { opacity: .75; }
.motd { margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px dashed var(--line-strong); }
.motd .t-key { white-space: pre; }
.motd p { margin: 0; }
.motd-line { padding-bottom: 8px; }

/* ---------- Prompt and colours ---------- */
.pr-user, .pr-host { color: var(--term-user); font-weight: 500; }
.pr-at, .pr-sep { color: var(--muted); }
.pr-path { color: var(--term-path); font-weight: 500; }
.pr-sign { color: var(--fg); margin-left: .1ch; }
.cmd { margin: 0 0 4px; overflow-wrap: anywhere; }
.t-cmd { color: var(--fg); }
.t-strong { color: var(--fg); font-weight: 500; }
.t-muted, .t-key { color: var(--muted); }
.t-acc { color: var(--term-acc); }
.t-err { color: var(--ko); }
.t-ok { color: var(--ok); }
.t-dir { color: var(--term-user); font-weight: 500; }
.t-doc { color: var(--term-acc); }
.t-file { color: var(--fg); }
.t-tag { color: var(--term-path); }
.t-title { color: var(--term-text); }
.t-pct { color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }

/* Outputs: one block line per text line (copy keeps the line breaks) */
.out { margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ln { display: block; min-height: 1.6em; }
.ln-h { color: var(--fg); }
.ln-h .t-strong { font-weight: 700; }
.ln-period { margin-top: .4em; }
.ln-tag { margin-top: .2em; }

/* Goal rows: [x] title ……… ▮▮▮▮▮▯▯▯▯▯ 50 %, details below */
.ln-goal { display: grid; grid-template-columns: 5ch minmax(0, 1fr) auto 5ch; column-gap: 1ch; align-items: center; padding: 1px 0; max-width: 112ch;
  border-radius: 6px; }
.ln-goal:hover { background: rgba(var(--tint), .04); }
.ln-goal .t-box { padding-left: 2ch; white-space: pre; }
.ln-goal .t-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-goal .t-meta { grid-column: 2 / -1; font-size: .8em; line-height: 1.4; }
.ln-goal .t-meta:empty { display: none; }

/* Bars made of 10 cells; their width is a class (.w-60) */
.t-bar { --cell: .82ch; --bar-fill: var(--term-user); position: relative; display: inline-block; width: 10ch; height: .66em; vertical-align: -.02em;
  background: repeating-linear-gradient(90deg, var(--term-track) 0 var(--cell), transparent var(--cell) 1ch); }
.t-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%);
  background: repeating-linear-gradient(90deg, var(--bar-fill) 0 var(--cell), transparent var(--cell) 1ch);
  filter: drop-shadow(0 0 4px var(--bar-glow)); }
.t-bar.t-pride { --bar-fill: var(--term-path); margin-right: .2ch; }
.t-bar.t-pride::before { filter: drop-shadow(0 0 4px var(--pride-glow)); }
.t-bar.t-full { --bar-fill: var(--ok); }

/* help: commands in the foreground */
.ln-help .t-cmd { color: var(--term-user); }

/* ---------- Command line ---------- */
.terminal { margin-top: 2px; }
.log:empty { display: none; }
.line { display: flex; gap: 1ch; align-items: baseline; margin: 0 -8px; padding: 2px 8px; border-radius: 8px; transition: background .15s; }
.line:focus-within { background: rgba(var(--tint), .045); box-shadow: inset 0 0 0 1px var(--line); }
.prompt { white-space: nowrap; flex-shrink: 0; }
.line-field { position: relative; flex: 1; min-width: 0; display: block; }
.line-field input { display: block; width: 100%; background: transparent; color: var(--term-text); border: 0; outline: 0; font: inherit; padding: 0;
  caret-color: var(--term-cursor); }
.line-mirror { display: none; }
/* Mouse screens: the text is drawn again with a block cursor; the real input stays (transparent) for typing */
html.fine .line-field input { color: transparent; caret-color: transparent; }
html.fine .line-mirror { display: block; position: absolute; inset: 0; overflow: hidden; white-space: pre; pointer-events: none; color: var(--term-text); }
.cursor { display: inline-block; min-width: 1ch; color: var(--term-text); outline: 1px solid var(--muted); outline-offset: -1px; }
.focused .cursor { background: var(--term-cursor); color: var(--term-page); outline: 0; box-shadow: 0 0 10px var(--bar-glow);
  animation: blink 1.1s steps(1, end) infinite; }
.focused.typing .cursor { animation: none; }
@keyframes blink { 50% { background: transparent; color: var(--term-text); box-shadow: none; } }

/* ---------- Status line (tmux-like) ---------- */
.term-status { display: flex; align-items: stretch; height: 28px; flex-shrink: 0; min-width: 0; border-top: 1px solid var(--line);
  background: var(--term-bar); font-size: .72rem; line-height: 28px; color: var(--muted); }
.st-chip { padding: 0 12px; background: var(--fg); color: var(--on-fg); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: 0 0 18px -2px var(--bar-glow); flex-shrink: 0; }
.st-item { padding: 0 12px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.st-chip + .st-item { border-left: 0; }
.st-path { color: var(--term-path); flex-shrink: 1; }
.st-grow { flex: 1; text-align: right; }
.term-status [data-clock] { color: var(--fg); flex-shrink: 0; }

.report-bug { margin: 0; padding: 4px 0 0; width: min(1120px, 100%); text-align: right; font-size: .72rem; }
.report-bug a { color: var(--muted); }
.report-bug a:hover { color: var(--fg); }

/* ---------- Login (tty) ---------- */
.term-login { display: grid; gap: 6px; max-width: 54ch; margin: 6px 0 4px; }
.term-field { display: flex; align-items: baseline; gap: 1ch; margin: 0 -8px; padding: 2px 8px; border-radius: 8px; }
.term-field:focus-within { background: rgba(var(--tint), .045); box-shadow: inset 0 0 0 1px var(--line); }
.term-field > span { white-space: nowrap; }
.term-field input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--term-text); font: inherit; padding: 0; caret-color: var(--term-cursor); }
.term-submit { justify-self: start; margin-top: 10px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--fg);
  color: var(--on-fg); font: 500 .8125rem/1.4 var(--mono); cursor: pointer; box-shadow: 0 0 22px -6px var(--bar-glow); }
.term-submit:hover { background: var(--fg-hover); }
.term-alert { margin: 10px 0 0; }
.term-hint { margin: 16px 0 0; font-size: .78rem; }
.term-hint b { color: var(--fg); font-weight: 500; }

/* ---------- Small screens: the terminal fills the screen ---------- */
@media (max-width: 719.98px) {
  .term-page { padding: 0; }
  .term-window { height: calc(100vh - 26px); height: calc(100dvh - 26px); border-radius: 0; border-width: 0 0 1px; min-height: 0; }
  .term-window-login { height: auto; min-height: calc(100dvh - 26px); }
  .term-body { padding: 14px 14px 18px; font-size: .8125rem; }
  .term-dots { display: none; }
  .term-title { text-align: left; }
  .st-wide { display: none; }
  .report-bug { padding: 4px 12px 6px; }
  .ln-goal { grid-template-columns: 4ch minmax(0, 1fr) auto 5ch; }
  .ln-goal .t-box { padding-left: 1ch; }
  .t-bar { width: 6ch; background-size: auto; }
}
