/* Window chrome, desktop and colors come from the site shell (../os/os.css);
   this file only lays out the terminal's contents. */
:root {
  --bg: var(--t-bg);
  --fg: var(--t-fg);
  --dim: var(--t-dim);
  --faint: var(--t-faint);
  --warn: var(--t-warn);
  --bad: var(--t-bad);
}

#term {
  min-width: 420px;
  min-height: 280px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
}

/* ---------------------------------------------------------------------------
   Terminal contents */

#screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
}

#status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--faint);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
}

#view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

#hints {
  padding-top: 4px;
  margin-top: 8px;
  border-top: 1px solid var(--faint);
  color: var(--dim);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
}

#hints button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

#hints button:hover { color: var(--fg); }

.line { white-space: pre-wrap; }
.dim { color: var(--dim); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.gap { height: 1em; }

/* decrypt screen: guesses on the left, letter scratchpad on the right */
.decrypt-layout {
  display: flex;
  gap: 20px;
  height: 100%;
}

.decrypt-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

.guess-table {
  border-collapse: collapse;
  margin: 4px 0 8px;
}

.guess-table th,
.guess-table td {
  text-align: left;
  padding: 0 2.5ch 0 0;
  font-weight: normal;
  white-space: nowrap;
}

.guess-table th { color: var(--dim); }

.prompt {
  display: flex;
  align-items: baseline;
  gap: 1ch;
}

.prompt input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: none;
  outline: none;
  caret-color: var(--fg);
  text-transform: uppercase;
}

.letters {
  flex: none;
  padding-left: 16px;
  border-left: 1px solid var(--faint);
}

.letters-title { margin-bottom: 6px; }

.letters-grid {
  display: grid;
  grid-template-columns: repeat(4, 3ch);
  gap: 4px;
}

.letter {
  position: relative;
  font: inherit;
  color: var(--fg);
  background: none;
  border: 1px solid var(--faint);
  border-radius: 3px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

.letter:hover { border-color: var(--dim); }

.letter.in {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.letter.out {
  background: #b3261e;
  border-color: #b3261e;
  color: #fff;
}

/* Phones: the shell makes the window fill the screen. */
[data-os='phone'] #term { min-width: 0; min-height: 0; }
[data-os='phone'] .decrypt-layout { flex-direction: column; gap: 10px; }
[data-os='phone'] .letters { padding: 8px 0 0; border-left: none; border-top: 1px solid var(--faint); }
[data-os='phone'] .letters-grid { grid-template-columns: repeat(9, 3ch); }
[data-os='phone'] .guess-table th,
[data-os='phone'] .guess-table td { padding-right: 1.5ch; }
