/* Modle — terminal skin (committed single theme) */

:root {
  color-scheme: dark;

  --bg:        #0a0d0b;
  --panel:     #0e1210;
  --bar:       #151a17;
  --border:    #24302a;
  --border-lo: #1a221d;

  --text:      #b9c7bc;
  --dim:       #627268;
  --bright:    #e6efe8;

  --green:     #3fdc7a;
  --green-lo:  rgba(63, 220, 122, 0.13);
  --amber:     #e3b45c;
  --amber-lo:  rgba(227, 180, 92, 0.13);
  --cyan:      #57cfd8;
  --red:       #e57a6c;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* faint CRT scanlines + vignette — static, no motion */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.13) 2px 3px),
    radial-gradient(120% 90% at 50% 0%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.35) 100%);
  mix-blend-mode: multiply;
}

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 22px 14px 60px;
}

/* ---- terminal window --------------------------------------------- */
.term {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 24px 70px -30px rgba(0, 0, 0, 0.8),
    0 0 60px -20px rgba(63, 220, 122, 0.09);
  overflow: hidden;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
}
.term-dots { display: flex; gap: 6px; flex: none; }
.term-dots i {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #2b352f;
  display: block;
}
.term-dots i:nth-child(1) { background: #e5766b; }
.term-dots i:nth-child(2) { background: #e3b45c; }
.term-dots i:nth-child(3) { background: #6fce87; }

.term-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-actions { display: flex; gap: 6px; flex: none; }
button.tool {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
button.tool:hover { color: var(--green); border-color: var(--green); }
button.tool:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.term-body { padding: 18px 16px 20px; }

/* ---- banner ----------------------------------------------------- */
.banner {
  margin: 0 0 16px;
  color: var(--green);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: pre;
  overflow-x: auto;
  text-shadow: 0 0 14px rgba(63, 220, 122, 0.35);
}

.lede {
  margin: 0 0 4px;
  color: var(--dim);
  font-size: 13px;
  max-width: 74ch;
}
.lede::before { content: "# "; color: var(--border); }
.lede strong { color: var(--text); font-weight: 500; }
.lede .k { color: var(--cyan); }

.mode-tag {
  margin: 14px 0 2px;
  font-size: 12px;
  color: var(--green);
}
.mode-tag::before { content: "› "; color: var(--dim); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 10px 0 2px;
  font-size: 12px;
  color: var(--dim);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 10px; height: 10px; flex: none; border: 1px solid; }
.swatch.c { border-color: var(--green); background: var(--green-lo); }
.swatch.p { border-color: var(--amber); background: var(--amber-lo); }
.swatch.a { border-color: var(--border); border-style: dashed; background: transparent; }
.legend .arrow { color: var(--green); }

/* ---- prompt / input ------------------------------------------- */
.guess-area { position: relative; margin: 16px 0 12px; }

.prompt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b0f0d;
  padding: 11px 13px;
}
.prompt-row:focus-within { border-color: var(--green); box-shadow: 0 0 0 1px var(--green-lo); }
.prompt {
  flex: none;
  color: var(--green);
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
}
.guess-input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--bright);
  background: transparent;
  border: none;
  padding: 0;
  caret-color: var(--green);
}
.guess-input::placeholder { color: var(--dim); }
.guess-input:focus { outline: none; }
.guess-input:disabled { color: var(--dim); }

.blk {
  flex: none;
  width: 8px;
  height: 17px;
  background: var(--green);
  box-shadow: 0 0 8px rgba(63, 220, 122, 0.5);
  animation: blink 1.1s steps(1) infinite;
}
.guess-input:not(:placeholder-shown) ~ .blk,
.guess-input:disabled ~ .blk { display: none; }
@keyframes blink { 50% { opacity: 0; } }

.tip {
  margin: 6px 2px 0;
  font-size: 11px;
  color: var(--dim);
}
.tip::before { content: "# "; color: var(--border); }
.tip code {
  color: var(--green);
  background: var(--green-lo);
  padding: 0 4px;
  border-radius: 3px;
}

.hints {
  margin: 12px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hint-line {
  font-size: 12px;
  color: var(--amber);
  border-left: 2px solid var(--amber);
  padding-left: 8px;
}
.hint-line .hk { color: var(--dim); }
.hint-line b { color: var(--bright); font-weight: 500; }

/* completion menu */
.suggestions {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 5px);
  background: #0c110e;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px -20px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
}
.suggestion {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}
.suggestion .nm { color: var(--text); }
.suggestion .dv { font-size: 11px; color: var(--dim); }
.suggestion.active { background: var(--green); }
.suggestion.active .nm, .suggestion.active .dv { color: #06110a; }
.suggestion:hover:not(.active) { background: var(--green-lo); }
.suggestion.more {
  cursor: default;
  color: var(--dim);
  font-size: 11px;
  justify-content: center;
  border-top: 1px solid var(--border);
}
.suggestion.more:hover { background: transparent; }

/* ---- board --------------------------------------------------- */
.board-scroll { overflow-x: auto; margin: 6px -16px 0; padding: 0 16px 8px; }
.board { min-width: 540px; }

.row {
  display: grid;
  grid-template-columns: repeat(7, minmax(74px, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.row.head {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-lo);
}
.col-h {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  text-align: center;
}

.tile {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 3px;
  font-size: 10.5px;
  line-height: 1.16;
  word-break: break-word;
  border: 1px solid var(--border-lo);
  border-radius: 4px;
  color: var(--dim);
  background: transparent;
}
.tile.empty { border-style: dashed; opacity: 0.4; }

.tile.filled {
  opacity: 0;
  transform: translateY(5px);
  animation: reveal 0.28s ease forwards;
}
@keyframes reveal { to { opacity: 1; transform: none; } }

.tile.correct {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-lo);
  text-shadow: 0 0 10px rgba(63, 220, 122, 0.3);
}
.tile.close {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-lo);
}
.tile.absent {
  color: var(--dim);
  border: 1px dashed var(--border);
  background: transparent;
}

.tile .val { display: block; }
.tile .dir {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tile.filled { animation: none; opacity: 1; transform: none; }
  .blk { animation: none; }
}

/* ---- result (stdout) --------------------------------------- */
.result {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--green);
  border-radius: var(--radius);
  padding: 15px 16px;
  background: #0b0f0d;
}
.result h2 { margin: 0; font-size: 14px; font-weight: 500; color: var(--bright); }
.result .ans { margin-top: 6px; font-size: 13px; color: var(--green); }
.result .ans::before { content: "» "; color: var(--dim); }
.result p { margin: 8px 0 0; font-size: 12px; color: var(--dim); }

.dist { margin: 14px 0 2px; display: flex; flex-direction: column; gap: 3px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); }
.dist-row .k { width: 10px; text-align: right; }
.dist-bar {
  height: 15px;
  background: var(--border-lo);
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 5px;
  color: var(--dim);
}
.dist-bar.hit { background: var(--green); color: #06110a; }

.stat-line { display: flex; gap: 20px; margin-top: 13px; flex-wrap: wrap; }
.stat-line div { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-line b { display: block; font-size: 18px; color: var(--text); font-weight: 500; }

.actions { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
button.primary, button.ghost {
  font-family: var(--mono);
  font-size: 12.5px;
  border-radius: 5px;
  padding: 9px 14px;
  cursor: pointer;
}
button.primary { background: var(--green); color: #06110a; border: 1px solid var(--green); font-weight: 500; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.primary:hover { filter: brightness(1.1); }
button.ghost:hover { border-color: var(--green); color: var(--green); }
button.primary:focus-visible, button.ghost:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---- man page ---------------------------------------------- */
details.how {
  margin-top: 22px;
  border-top: 1px solid var(--border-lo);
  padding-top: 13px;
}
details.how summary {
  font-size: 12px;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}
details.how summary::-webkit-details-marker { display: none; }
details.how summary::before { content: "$ "; color: var(--green); }
details.how .body { font-size: 12.5px; color: var(--dim); margin-top: 10px; }
details.how .body ul { padding-left: 16px; margin: 8px 0; }
details.how .body li { margin: 4px 0; }
details.how .body code {
  background: var(--green-lo);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--text);
}

footer {
  margin-top: 26px;
  font-size: 11px;
  color: var(--border);
}
footer::before { content: "# "; }

/* ---- toast ------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: #06110a;
  color: var(--green);
  border: 1px solid var(--green);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 50;
}
.toast::before { content: "› "; color: var(--dim); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
