/* Git Gud. Dark, warm, one accent. */
:root {
  --bg: #16131d; --panel: #1f1b29; --panel2: #262133; --line: #342d45; --text: #eeeaf6; --dim: #a59fb8; --faint: #6f6886;
  --acc: #ff7a45; --acc2: #5cc8ff; --ok: #4ade80; --err: #ff6b6b; --warn: #fbbf24; --purple: #c084fc;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
code, kbd { font-family: var(--mono); font-size: .88em; background: #2e2840; border-radius: 5px; padding: .08em .35em; color: #ffd2bd; }
.ok { color: var(--ok); } .err { color: var(--err); }
a { color: var(--acc2); }

/* ---------- header */
.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: #1a1622; flex-wrap: wrap; }
.logo { font: 800 22px/1 var(--mono); text-decoration: none; letter-spacing: -.5px; }
.lg-git { color: var(--acc); } .lg-gud { color: var(--text); margin-left: 2px; }
.lg-gud::before { content: "\00a0"; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-b { background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 10px; color: var(--dim); }
.nav-b:hover, .nav-b:focus-visible { color: var(--text); border-color: var(--line); background: var(--panel); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.toggle { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 14px; cursor: pointer; }
.rank { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--warn); }

/* ---------- layout */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 440px) 1fr; grid-template-rows: auto 1fr; gap: 12px; padding: 12px; }
.mission { grid-column: 1; grid-row: 1; }
.term { grid-column: 1; grid-row: 2; min-height: 300px; }
.viz { grid-column: 2; grid-row: 1 / 3; min-width: 0; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
@media (min-width: 1001px) { body { height: 100vh; } .app { overflow: hidden; } .mission { max-height: 52vh; overflow: auto; } }
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; grid-template-rows: none; }
  .mission, .term, .viz { grid-column: 1; grid-row: auto; }
  .viz { overflow: visible; }
  .term { min-height: 420px; max-height: 80vh; }
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }

/* ---------- mission */
.mission { padding: 14px 16px; }
.m-head { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--acc); font-weight: 700; }
.m-par { color: var(--faint); }
.m-title { font-size: 21px; margin: 4px 0 6px; line-height: 1.25; }
.m-story p { margin: 0 0 8px; color: #d9d4e6; }
.goals { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.goals li { display: flex; gap: 9px; align-items: flex-start; padding: 7px 10px; border-radius: 9px; background: var(--panel2); border: 1px solid transparent; transition: background .3s, border-color .3s; }
.goals li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--faint); transition: all .25s; }
.goals li.done { background: #1b2e25; border-color: #2c5a41; }
.goals li.done::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l3 3 5-6' stroke='%2316131d' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.goals li.pop { animation: pop .5s; }
@keyframes pop { 40% { transform: scale(1.04); } }
.m-hints { display: grid; gap: 6px; }
.m-hints .hint { background: #2a2338; border-left: 3px solid var(--acc2); padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.m-hints .sol { background: #2a2338; border-left: 3px solid var(--acc); padding: 8px 10px; border-radius: 6px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.m-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 14px; }
.btn:hover, .btn:focus-visible { border-color: var(--acc2); }
.btn.ghost { background: none; color: var(--dim); }
.btn.hot { background: #3a2230; border-color: #6b3550; }
.btn.big { padding: 10px 18px; font-size: 16px; font-weight: 600; }
.btn.primary { background: var(--acc); color: #1a0f08; border-color: var(--acc); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- terminal */
.term { display: flex; flex-direction: column; background: #0f0d14; overflow: hidden; }
.t-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid #241f30; font: 12px var(--mono); color: var(--faint); }
.dots { display: flex; gap: 5px; } .dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a3348; }
.dots i:first-child { background: #ff6b6b88; } .dots i:nth-child(2) { background: #fbbf2488; } .dots i:last-child { background: #4ade8088; }
.t-x { margin-left: auto; background: none; border: 0; color: var(--faint); font: 12px var(--mono); }
.t-x:hover { color: var(--text); }
.t-out { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; font: 13px/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; }
.ln { min-height: 1.45em; }
.ln.cmd { color: var(--text); margin-top: 6px; }
.ln.cmd .ps { color: var(--ok); } .ln.cmd .br { color: var(--acc2); }
.ln.err { color: var(--err); } .ln.ok { color: var(--ok); } .ln.warn { color: var(--warn); } .ln.dim { color: var(--faint); }
.ln.out { color: #d5d0e0; }
.ln .h { color: var(--warn); cursor: pointer; } .ln .h:hover { text-decoration: underline; }
.ln.sys { color: var(--purple); }
.explain { font: 13.5px/1.45 system-ui, sans-serif; color: #e6defa; background: #221d33; border-left: 3px solid var(--purple); border-radius: 6px; padding: 6px 10px; margin: 6px 0 4px; white-space: normal; }
.explain::before { content: "What happened: "; font-weight: 700; color: var(--purple); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.chips:empty { display: none; }
.chip { font: 12.5px var(--mono); background: #1f1a2b; border: 1px solid #3b3350; color: #e9dcff; border-radius: 7px; padding: 4px 9px; }
.chip:hover, .chip:focus-visible { border-color: var(--acc); color: #fff; }
.chip.used { opacity: .55; }
.t-in { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #241f30; }
.prompt { font: 13px var(--mono); color: var(--ok); white-space: nowrap; }
.prompt .br { color: var(--acc2); }
#tInput { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: 14px var(--mono); caret-color: var(--acc); padding: 4px 0; }
.t-in:focus-within { background: #15121c; }

/* ---------- graphs */
.c-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px 4px; flex-wrap: wrap; }
.c-head h2 { font-size: 15px; margin: 0; }
.c-head h2 small, .col h3 small { color: var(--faint); font-weight: 400; margin-left: 6px; font-size: 12px; }
.mini { margin-left: auto; font-size: 12px; color: var(--dim); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.url { margin-left: auto; font: 12px var(--mono); color: var(--faint); }
.graph-wrap { position: relative; overflow: auto; padding: 0 4px; min-height: 120px; }
.graph { display: block; }
.graph .node { cursor: pointer; }
.graph .node:hover circle.c { stroke: #fff; stroke-width: 3; }
.graph text { font-family: var(--mono); }
.g-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 14px; text-align: center; padding: 10px; pointer-events: none; }
.g-empty:empty { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 14px 10px; font-size: 11.5px; color: var(--faint); }
.legend span { display: flex; align-items: center; gap: 5px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); display: inline-block; }
.lg-dot.faded { background: none; border: 1.5px dashed var(--faint); }
.lg-chip { font: normal 10.5px var(--mono); border: 1px solid #5cc8ff88; background: #1d3044; color: #cfeaff; border-radius: 4px; padding: 0 4px; }
.lg-chip.cur { background: var(--acc); color: #1a0f08; border-color: var(--acc); font-weight: 700; }
.lg-chip.rem { background: none; border-style: dashed; border-color: #c084fc99; color: #dcc4ff; }
.remote .graph-wrap { min-height: 100px; }
.op-banner { background: #3b2a14; border: 1px solid #7a5521; color: #ffe2b0; border-radius: var(--r); padding: 8px 14px; font-size: 14px; }
.op-banner b { color: var(--warn); }

/* ---------- files */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 12px 8px; }
.col { background: var(--panel2); border-radius: 10px; padding: 8px; min-height: 90px; }
.col h3 { margin: 0 0 6px; font-size: 12.5px; color: var(--dim); font-weight: 600; }
.col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.f { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: #1a1624; border: 1px solid #332c44; border-radius: 7px; padding: 4px 7px; font: 12.5px var(--mono); }
.f:hover, .f:focus-visible { border-color: var(--acc2); }
.f .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f .b { font: 700 10px var(--mono); border-radius: 4px; padding: 1px 4px; }
.f.untracked .b { background: #5a2330; color: #ffb3bd; } .f.untracked { border-color: #6b2b3a; }
.f.modified .b { background: #5a4313; color: #ffe08a; } .f.modified { border-color: #6d5520; }
.f.staged .b { background: #1e4a30; color: #a6f4c2; } .f.staged { border-color: #2f6b45; }
.f.deleted { opacity: .7; } .f.deleted .nm { text-decoration: line-through; } .f.deleted .b { background: #5a2330; color: #ffb3bd; }
.f.conflict { border-color: var(--err); background: #3a1820; } .f.conflict .b { background: var(--err); color: #200; }
.f.same { color: var(--dim); }
.col .none { color: var(--faint); font-size: 12px; padding: 4px 2px; }
.flow { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.flow-b { background: #1a1624; border: 1px dashed #4a4160; border-radius: 8px; padding: 5px 10px; font: 12.5px var(--mono); color: #e9dcff; }
.flow-b span { font-family: system-ui, sans-serif; color: var(--faint); }
.flow-b:hover { border-color: var(--acc); }
.f-tip { color: var(--faint); font-size: 12px; margin-left: auto; }
.stash { margin: 0 12px 12px; padding: 8px 10px; border-radius: 10px; background: #231d31; border: 1px dashed #5b4d78; font: 12.5px var(--mono); color: #dcd2f2; }
.stash b { font-family: system-ui, sans-serif; color: var(--purple); }
@media (max-width: 560px) { .cols { grid-template-columns: 1fr; } .col { min-height: 0; } .legend { display: none; } .prompt { max-width: 38%; overflow: hidden; text-overflow: ellipsis; } }

/* ---------- dialog */
.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px #000a; }
.dlg::backdrop { background: #0a0810cc; backdrop-filter: blur(3px); }
.dlg-x { position: absolute; right: 10px; top: 8px; margin: 0; }
.dlg-x button { background: none; border: 0; font-size: 26px; color: var(--faint); line-height: 1; padding: 4px 8px; }
.dlg-x button:hover { color: var(--text); }
.dlg h2 { margin: 0 0 6px; font-size: 22px; }
.dlg .sub { color: var(--dim); margin: 0 0 14px; }
.dlg .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.track { margin: 18px 0 6px; }
.track h3 { margin: 0; font-size: 15px; color: var(--acc); }
.track p { margin: 0 0 8px; color: var(--faint); font-size: 13px; }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.lv { text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; display: grid; gap: 2px; }
.lv:hover, .lv:focus-visible { border-color: var(--acc); }
.lv .n { font: 11px var(--mono); color: var(--faint); }
.lv .t { font-weight: 600; font-size: 14px; }
.lv .st { color: var(--warn); letter-spacing: 2px; font-size: 13px; }
.lv.cur { border-color: var(--acc2); }
.stars-big { font-size: 44px; letter-spacing: 6px; color: var(--warn); text-align: center; margin: 6px 0; }
.stars-big .off { color: #3c3550; }
.win-after { background: var(--panel2); border-radius: 10px; padding: 10px 14px; }
.win-after p { margin: 0 0 6px; }
.situ-search { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--text); font-size: 15px; outline: 0; }
.situ-search:focus { border-color: var(--acc2); }
.situ-list { display: grid; gap: 8px; margin-top: 12px; }
.situ { background: var(--panel2); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.situ .q { font-weight: 600; }
.situ .fix { grid-column: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.situ .fix code { font-size: 12.5px; }
.situ .go { grid-column: 2; grid-row: 1 / 3; }
.editor { width: 100%; min-height: 180px; background: #0f0d14; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 14px/1.5 var(--mono); resize: vertical; outline: 0; }
.editor:focus { border-color: var(--acc2); }
.editor[readonly] { color: var(--dim); }
.conf-help { background: #3a1820; border: 1px solid #6b2b3a; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.conf-help .row { margin-top: 6px; }
.ri-list { display: grid; gap: 6px; margin: 10px 0; }
.ri { display: grid; grid-template-columns: 104px 74px 1fr auto; gap: 8px; align-items: center; background: var(--panel2); border-radius: 9px; padding: 6px 8px; }
.ri select, .ri input { background: #15121c; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: 13px var(--mono); min-width: 0; }
.ri input:disabled { color: var(--dim); border-color: transparent; background: transparent; }
.ri .hid { font: 12px var(--mono); color: var(--warn); }
.ri .mv { display: flex; gap: 2px; } .ri .mv button { background: #15121c; border: 1px solid var(--line); border-radius: 6px; width: 26px; height: 26px; }
.ri.drop { opacity: .45; } .ri.drop input { text-decoration: line-through; }
.ri-help { font-size: 13px; color: var(--dim); display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.ri-help b { font-family: var(--mono); color: var(--text); }
@media (max-width: 560px) { .ri { grid-template-columns: 92px 1fr auto; } .ri .hid { display: none; } }
.slides { min-height: 300px; }
.slide h2 { font-size: 24px; }
.slide p { color: #d9d4e6; font-size: 16px; }
.pic { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0; font: 13px var(--mono); }
.pic .box { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-align: center; min-width: 110px; }
.pic .box b { display: block; font-family: system-ui, sans-serif; font-size: 14px; margin-bottom: 4px; }
.pic .arr { color: var(--acc); font-weight: 700; text-align: center; }
.pic .arr small { display: block; color: var(--dim); font-weight: 400; }
.pic .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--acc); display: inline-block; }
.pic .dot.b { background: var(--acc2); }
.pic .ln2 { width: 26px; height: 3px; background: var(--acc); display: inline-block; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pager .pips { display: flex; gap: 6px; margin: 0 auto; } .pager .pips i { width: 8px; height: 8px; border-radius: 50%; background: #3c3550; } .pager .pips i.on { background: var(--acc); }
.welcome-opts { display: grid; gap: 10px; margin-top: 16px; }
.wo { text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.wo:hover, .wo:focus-visible { border-color: var(--acc); }
.wo b { font-size: 17px; } .wo span { color: var(--dim); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; font-size: 14px; }
.help-grid h4 { grid-column: 1 / -1; margin: 10px 0 2px; color: var(--acc); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .goals li.pop { animation: none; } }
.goals li.keep { background: transparent; border: 1px dashed #3d3552; font-size: 14px; color: var(--dim); }
.goals li.keep b { color: var(--dim); font-weight: 600; }
.goals li.keep.done { background: transparent; border-color: #2c5a41; }

/* ---------- small screens: mission, graph, terminal, files */
@media (max-width: 1000px) {
  .viz { display: contents; }
  .mission { order: 1; } .op-banner { order: 2; } .graph-card { order: 3; } .remote { order: 4; } .term { order: 5; } .files-card { order: 6; }
  .term { height: 70vh; }
}
@media (max-width: 560px) {
  .top { gap: 6px 10px; padding: 8px 10px; }
  .logo { font-size: 19px; }
  .nav-b { padding: 4px 7px; font-size: 14px; }
  .top-r { gap: 8px; }
  .toggle span { font-size: 13px; }
  .rank { padding: 3px 9px; font-size: 12px; }
  .app { padding: 8px; gap: 8px; }
  .mission { padding: 12px; }
  .m-title { font-size: 19px; }
}
.ln.coach { color: #7ee8d6; background: #12302b; border-left: 3px solid #2dd4bf; padding: 2px 8px; border-radius: 4px; font-family: system-ui, sans-serif; font-size: 13px; }
