/* Ragnarok — bone white, ink, one glacial accent. Hard edges, no motion. */
:root {
  --bone: #f2efe7;
  --paper: #fbfaf5;
  --ink: #14120e;
  --stone: #6f6a5c;
  --hairline: #d9d4c5;
  --shadow: #ddd8c9;
  --ice: #2c6d8e;      /* accent on light ground */
  --ice-on-ink: #a5cadb; /* accent on ink blocks */
  --warn: #8a6414;
  --bad: #99301c;
  --in-bg: #e7e3d6;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font: 15px/1.55 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  min-height: 100vh;
  border-top: 6px solid var(--ink);
}
::selection { background: var(--ink); color: var(--bone); }
a { color: var(--ice); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
code { font-family: var(--mono); }

#app { max-width: 740px; margin: 0 auto; padding: 36px 20px 48px; }

/* Masthead */
header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.brand { display: flex; gap: 16px; align-items: center; }
.mark { width: 46px; height: auto; display: block; }
h1 {
  margin: 0; font-size: 26px; font-weight: 800; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.22em; margin-right: -0.22em;
}
.tagline {
  margin: 7px 0 0; color: var(--stone);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.me { text-align: right; }
.label {
  display: block; color: var(--stone);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em;
}
.fp {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.05em;
  color: var(--ice-on-ink); background: var(--ink); padding: 5px 10px;
  display: inline-block; margin-top: 6px; user-select: all;
}

/* Slabs */
.card {
  background: var(--paper); border: 2px solid var(--ink);
  padding: 26px 26px 24px; box-shadow: 8px 8px 0 var(--shadow);
}
.card h2 {
  margin: 0 0 8px; font-size: 14px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.hint { color: var(--stone); font-size: 13.5px; margin: 0 0 20px; max-width: 58ch; text-wrap: pretty; }

/* Numbered steps (sharing flow) — brutalist ink squares matching the theme. */
.steps { margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; max-width: 58ch; }
.steps li {
  position: relative; padding: 10px 0 10px 36px; color: var(--ink);
  font-size: 13.5px; line-height: 1.5; border-top: 1px solid var(--hairline); text-wrap: pretty;
}
.steps li:first-child { border-top: none; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 9px; width: 22px; height: 22px;
  line-height: 22px; text-align: center; background: var(--ink); color: var(--bone);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.steps code { background: var(--bone); padding: 0 3px; }

label {
  display: block; margin-bottom: 16px; color: var(--ink);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
}
.sublabel {
  display: block; margin-top: 7px; color: var(--stone);
  font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0; text-wrap: pretty;
}

input[type=text], input[type=password] {
  width: 100%; margin-top: 8px; padding: 11px 12px;
  font: inherit; font-size: 14px; text-transform: none; letter-spacing: normal;
  color: var(--ink); background: #fff; border: 2px solid var(--ink);
  border-radius: 0; outline: none;
}
input[type=text]:focus, input[type=password]:focus { border-color: var(--ice); }
::placeholder { color: #a8a294; }

button {
  font: inherit; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  background: var(--ink); color: var(--bone); border: 2px solid var(--ink);
  padding: 11px 20px; border-radius: 0; cursor: pointer;
}
button:hover { background: var(--ice); border-color: var(--ice); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--ink); }
button.secondary:hover { background: var(--ink); border-color: var(--ink); color: var(--bone); }
button:focus-visible { outline: 3px solid var(--ice); outline-offset: 2px; }

.status { margin: 16px 0 0; min-height: 18px; font-family: var(--mono); font-size: 12.5px; color: var(--stone); }
.status.err { color: var(--bad); }
.status.ok { color: var(--ice); }

.hidden { display: none !important; }

/* Share / join rows */
.share { display: flex; gap: 10px; margin: 6px 0 8px; }
.share input { flex: 1; margin: 0; font-family: var(--mono); font-size: 13px; }
.share input[readonly] { background: var(--bone); }
.share button { white-space: nowrap; flex-shrink: 0; }

.advanced { margin: 20px 0 8px; border-top: 1px solid var(--hairline); padding-top: 14px; }
.advanced summary {
  cursor: pointer; color: var(--stone);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
}
.advanced summary:hover { color: var(--ink); }
.advanced label { margin-top: 14px; }
.wide { width: 100%; margin-top: 10px; }

#unlock button { width: 100%; margin-top: 8px; }

/* Biometric unlock (Face ID / Touch ID / fingerprint) */
.bio-or { text-align: center; color: var(--stone); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; margin: 14px 0; }
.bio-enrol {
  display: flex; align-items: center; gap: 9px; margin: 4px 0 16px;
  text-transform: none; letter-spacing: normal; font-weight: 400; font-size: 12.5px; color: var(--stone);
}
.bio-enrol input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; flex-shrink: 0; }

/* Peer banner */
.peer-banner { padding: 14px 16px; margin-bottom: 16px; background: var(--bone); border: 2px solid var(--ink); }
.peer-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.verify-note { margin: 10px 0 0; font-size: 12.5px; text-wrap: pretty; }
.verify-note.tofu { color: var(--warn); }
.verify-note.verified { color: var(--ice); font-weight: 600; }

/* Messages */
.messages {
  height: 46vh; min-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 6px 0;
}
.bubble {
  max-width: 76%; padding: 10px 14px; font-size: 14px;
  word-wrap: break-word; white-space: pre-wrap; border-radius: 0;
}
.bubble.in  { align-self: flex-start; background: var(--in-bg); color: var(--ink); }
.bubble.out { align-self: flex-end; background: var(--ink); color: var(--bone); }
.bubble.sys {
  align-self: center; background: transparent; color: var(--stone);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
}

#composer { display: flex; gap: 10px; margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 16px; }
#composer input { flex: 1; margin: 0; }

footer { margin-top: 30px; border-top: 2px solid var(--ink); padding-top: 14px; }
footer p { color: var(--stone); font-size: 11.5px; text-align: center; margin: 0 0 6px; text-wrap: pretty; }
footer strong { color: var(--ink); }

@media (max-width: 560px) {
  header { flex-direction: column; align-items: flex-start; }
  .me { text-align: left; }
  h1 { font-size: 22px; }
  .card { padding: 20px 18px; box-shadow: 6px 6px 0 var(--shadow); }
}
