/* EnkVault — "console" theme: a phosphor terminal in a dark room.
   One monospace voice, square corners, bracketed commands, and a chat that
   reads as a transcript instead of bubbles. System fonts and CSS gradients
   only: nothing is fetched from another origin, which the
   Content-Security-Policy also enforces. The earlier steel-and-brass
   stylesheet is kept beside this file as app.classic.css (not served). */

:root {
  --bg: #040d0a;
  --surface: #081711;
  --raised: #0c2119;
  --ink: #a9efc5;
  --bright: #d8ffe8;
  --muted: #62a388;
  --line: #1d4a39;
  --amber: #ffb44a;
  --amber-fill: #2a1f0a;
  --seal: #ff6b61;
  --seal-fill: #2b100e;
  --ok: #4dff9a;

  --mono: "JetBrains Mono", "Cascadia Mono", "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --glow: 0 0 0.6em color-mix(in srgb, var(--ok) 45%, transparent);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line) var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 50% 0%, #0a2219 0%, var(--bg) 62%) fixed var(--bg);
  color: var(--ink);
  font: 0.9375rem/1.6 var(--mono);
}

/* Scan lines over the whole screen. Purely decorative and click-through. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.13) 2px 3px);
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

h1,
h2 {
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--bright);
  text-shadow: var(--glow);
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.0625rem;
}

p {
  margin: 0;
}

a {
  color: var(--bright);
  text-decoration-style: dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:hover {
  color: var(--amber);
}

code {
  font-family: var(--mono);
  font-size: 1em;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lede {
  font-size: 1rem;
  color: var(--ink);
  max-width: 38em;
}

.fine {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- top bar */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bright);
  text-decoration: none;
  text-shadow: var(--glow);
}

.brand:hover {
  color: var(--bright);
}

.brand img {
  display: block;
}

.who {
  color: var(--muted);
  font-size: 0.875rem;
}

.who::before {
  content: "user: ";
}

/* ---------------------------------------------------------------- controls */

/* A command: its label between square brackets, inverted on hover. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.35rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bright);
  font: 500 0.9375rem/1.3 var(--mono);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button::before {
  content: "[\00a0";
  color: var(--muted);
}

.button::after {
  content: "\00a0]";
  color: var(--muted);
}

.button:hover {
  background: var(--ink);
  color: var(--bg);
}

.button:hover::before,
.button:hover::after,
.button.primary::before,
.button.primary::after {
  color: inherit;
}

.button.primary {
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  box-shadow: 0 0 0.9em color-mix(in srgb, var(--ok) 28%, transparent);
}

.button.primary:hover {
  background: var(--bright);
}

.button.danger {
  color: var(--seal);
}

.button.danger::before,
.button.danger::after {
  color: inherit;
}

.button.danger:hover {
  background: var(--seal);
  color: var(--bg);
}

.button.small {
  padding: 0.2rem 0.25rem;
  font-size: 0.8125rem;
}

.button:disabled {
  opacity: 0.5;
  cursor: progress;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--bright);
  caret-color: var(--amber);
  font: 0.9375rem/1.4 var(--mono);
}

input:focus,
textarea:focus {
  outline: 0;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink), 0 0 1em color-mix(in srgb, var(--ok) 22%, transparent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input[type="file"] {
  padding: 0.4rem;
  color: var(--ink);
}

input[type="file"]::file-selector-button {
  margin-right: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--raised);
  color: var(--bright);
  font: inherit;
  cursor: pointer;
}

/* A checkbox with its caption beside it. */
label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0;
  font-size: 0.9375rem;
  color: var(--ink);
  white-space: nowrap;
}

label.check input {
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  accent-color: var(--ok);
}

.code-input {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.code-input::placeholder {
  letter-spacing: 0.04em;
}

progress {
  width: 100%;
  height: 0.5rem;
  accent-color: var(--ok);
}

.notice {
  padding: 0.65rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  border-left: 3px solid var(--amber);
  background: var(--amber-fill);
  color: #ffe2b0;
  font-size: 0.875rem;
}

.notice.error {
  border-color: color-mix(in srgb, var(--seal) 45%, transparent);
  border-left-color: var(--seal);
  background: var(--seal-fill);
  color: #ffd2cd;
}

/* A secret code: the one amber thing on a green screen. */
.code-tag {
  display: inline-block;
  width: fit-content;
  padding: 0.2rem 0.6rem;
  border: 1px dashed var(--amber);
  background: var(--amber-fill);
  color: var(--amber);
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  user-select: all;
}

.code-tag.used {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  text-decoration: line-through;
}

/* ---------------------------------------------------------------- layout */

.stack {
  display: grid;
  gap: 1.1rem;
}

.stack.tight {
  gap: 0.6rem;
}

main.narrow {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2rem, 8vh, 5rem) 1.25rem 3rem;
}

main.narrow h1 {
  margin-bottom: 0.4rem;
}

main.wide {
  max-width: 66rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 4rem;
}

main.wide > section {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Next to a text field a command sits level with it. */
.inline-form > .button {
  padding-block: 0.6rem;
}

.grow {
  flex: 1 1 16rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.empty {
  color: var(--muted);
  padding: 1.5rem 0;
  max-width: 40em;
}

/* ---------------------------------------------------------------- start page */

.home {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2.5rem, 9vh, 6rem) 0;
}

.hero h1 {
  font-size: clamp(1.8rem, 3.7vw, 2.8rem);
  line-height: 1.12;
  max-width: 13em;
}

/* The cursor waiting after the headline: the page's one moving part. */
.hero h1::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.85em;
  margin-left: 0.15em;
  vertical-align: -0.06em;
  background: var(--ok);
  box-shadow: var(--glow);
}

.hero-copy {
  display: grid;
  gap: 1.25rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sealed {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 0 2.5em color-mix(in srgb, var(--ok) 9%, transparent);
}

.sealed-row {
  padding: 1rem 1.2rem 1.15rem;
}

.sealed-row + .sealed-row {
  border-top: 1px dashed var(--line);
}

.sealed-who {
  font-size: 0.8125rem;
  color: var(--muted);
}

.sealed-plain {
  font-size: 1.125rem;
  line-height: 1.4;
  color: var(--bright);
  margin-top: 0.3rem;
}

.sealed-cipher {
  font-size: 0.875rem;
  color: var(--amber);
  overflow-wrap: anywhere;
  margin-top: 0.4rem;
}

.points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 3rem);
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.points h2 {
  margin-bottom: 0.5rem;
}

.points p {
  color: var(--muted);
}

/* ---------------------------------------------------------------- dashboard */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs button {
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font: 500 0.9375rem var(--mono);
  cursor: pointer;
  white-space: nowrap;
}

.tabs button:hover {
  color: var(--bright);
}

.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
}

.rows,
.subrows,
.members {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rows > li,
.subrows > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--line);
}

.rows > li:first-child {
  border-top: 1px dashed var(--line);
}

.row-main {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 18rem;
}

.row-main strong {
  font-size: 1rem;
  color: var(--bright);
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.subpanel {
  flex: 1 0 100%;
  display: grid;
  gap: 0.5rem;
  padding: 1rem 1.1rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
}

.subrows > li:last-child {
  border-bottom: 0;
}

.subpanel .empty {
  padding: 0.5rem 0 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px dashed var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
  border-bottom-style: solid;
  white-space: nowrap;
}

td:first-child {
  white-space: nowrap;
}

.log-ok td:nth-child(4) {
  color: var(--ok);
  font-weight: 700;
}

.log-denied td:nth-child(4),
.log-interrupted td:nth-child(4) {
  color: var(--seal);
  font-weight: 700;
}

/* ---------------------------------------------------------------- chat */

.chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1 1 auto;
  min-width: 0;
}

.chat-title > div {
  min-width: 0;
}

.chat .bar nav {
  flex: none;
}

.chat-title h1 {
  font-size: 1.0625rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  min-height: 0;
}

.thread {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) repeat(3, auto);
  min-height: 0;
  min-width: 0;
}

/* The conversation is a transcript: time, sender, text on one line, flush
   left for everyone. Your own lines carry an amber rule and name. */
.messages {
  overflow-y: auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.messages > .button {
  align-self: center;
  margin-bottom: 0.5rem;
}

.day {
  align-self: center;
  margin: 0.9rem 0 0.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.day::before {
  content: "---- ";
}

.day::after {
  content: " ----";
}

.msg {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  column-gap: 1rem;
  margin-top: 0.55rem;
  padding: 0.05rem 0.7rem;
  border-left: 2px solid var(--line);
}

.msg.mine {
  border-left-color: var(--amber);
}

.msg.follows {
  margin-top: 0;
}

.msg header {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  min-width: 0;
}

.msg > :not(header) {
  grid-column: 2;
}

.msg time {
  order: -1;
  flex: none;
  color: var(--muted);
  font-size: 0.8125rem;
}

.msg.follows header .msg-name {
  display: none;
}

.msg-name {
  min-width: 0;
  font-weight: 700;
  color: var(--ok);
  overflow-wrap: anywhere;
}

.msg-name::after {
  content: ":";
  color: var(--muted);
}

.msg.mine .msg-name {
  color: var(--amber);
}

.msg-text {
  color: var(--bright);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-text.broken {
  color: var(--seal);
}

.msg-text.broken::before {
  content: "! ";
}

.thread > .notice {
  margin: 0 clamp(1rem, 4vw, 2.5rem) 0.5rem;
}

/* People waiting to be let into a public group (owner only). */
.requests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.requests li {
  display: grid;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.requests strong {
  color: var(--bright);
  overflow-wrap: anywhere;
}

/* Shown in a one-to-one conversation for comparing out of band. */
.safety {
  font-size: 1rem;
  letter-spacing: 0.06em;
  padding: 0.5rem 0.65rem;
  border: 1px dashed var(--amber);
  background: var(--amber-fill);
  color: var(--amber);
}

/* A file inside a message. It is only ever offered as a download. */
.file-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: fit-content;
  max-width: 100%;
  margin: 0.25rem 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.file-meta {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.file-name {
  color: var(--bright);
  overflow-wrap: anywhere;
}

.file-card .button {
  flex: none;
}

.file-card .fine.broken {
  color: var(--seal);
}

/* The file waiting to go out with the next message. */
.attached {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 clamp(1rem, 4vw, 2.5rem) 0.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px dashed var(--muted);
  font-size: 0.875rem;
}

.attached span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The input line: [ Attach ]  >  text  [ Send ] */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem) 1rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.composer::before {
  content: ">";
  order: 1;
  align-self: center;
  color: var(--amber);
  font-weight: 700;
  text-shadow: 0 0 0.6em color-mix(in srgb, var(--amber) 50%, transparent);
}

.composer textarea {
  order: 2;
  /* Width 0 plus grow: a monospace textarea's built-in width would otherwise
     push the whole thread wider than a phone screen. */
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  resize: none;
  max-height: 10rem;
}

.composer .button {
  flex: none;
  padding-block: 0.6rem;
}

.composer .button.primary {
  order: 3;
}

.people {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  padding: 1.25rem;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  overflow-y: auto;
}

.people h2 {
  font-size: 0.9375rem;
}

.people .button {
  justify-self: start;
}

.members li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
}

.member-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Presence: a lit block when online, an empty one when not. */
.dot {
  flex: none;
  width: 0.55rem;
  height: 0.8rem;
  border: 1px solid var(--muted);
}

.dot.online {
  border-color: var(--ok);
  background: var(--ok);
  box-shadow: var(--glow);
}

.badge {
  font-size: 0.75rem;
  padding: 0 0.4rem;
  border: 1px solid var(--muted);
  color: var(--muted);
}

.badge.new {
  border-color: var(--amber);
  color: var(--amber);
}

.row-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* The "ask to join" part of the gate, above the secret-code form. */
.public-box {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px dashed var(--line);
}

#people-toggle {
  display: none;
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .chat-title .fine {
    display: none;
  }

  .chat-body {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }

  .chat .bar {
    gap: 0.5rem;
  }

  .chat .bar nav {
    gap: 0.2rem;
  }

  #people-toggle {
    display: inline-flex;
  }

  .people {
    display: none;
    position: absolute;
    inset: 0;
    background: var(--bg);
    border-left: 0;
    z-index: 1;
  }

  .people.open {
    display: grid;
  }

  /* Too narrow for columns: time and sender on their own line, text below. */
  .msg {
    grid-template-columns: minmax(0, 1fr);
  }

  .msg header,
  .msg > :not(header) {
    grid-column: 1;
    grid-row: auto;
  }

  .msg.follows header {
    display: none;
  }

  /* No room for the prompt mark beside two commands and a text field. */
  .composer {
    gap: 0.4rem;
  }

  .composer::before {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero h1::after {
    animation: cursor 1.1s steps(1, end) infinite;
  }
}

@keyframes cursor {
  50% {
    opacity: 0;
  }
}
