/* OpenNSO — one stylesheet, no framework, light and dark. */

:root {
  --red: #e03a2f;
  --red-dark: #b52a21;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #666d78;
  --line: #e2e5ea;
  --good: #1d7a45;
  --good-bg: #e4f5ea;
  --bad: #b52a21;
  --bad-bg: #fdeceb;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f25;
    --ink: #e8eaee;
    --muted: #9aa2ae;
    --line: #2b2f37;
    --good: #6ddc9b;
    --good-bg: #16301f;
    --bad: #ff8b80;
    --bad-bg: #331816;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- chrome -------------------------------------------------------------- */

.bar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700; font-size: 1.15rem; color: var(--ink);
  display: flex; align-items: center; gap: .55rem;
}
.brand:hover { text-decoration: none; }
.mark {
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--red);
  box-shadow: inset 0 0 0 .22rem var(--panel), 0 0 0 .15rem var(--red);
}

/* Beside the name rather than among the ordinary links: it is a different kind
   of thing, and it should not be one tab away from Sign out. */
.adminlink {
  font-weight: 600; font-size: .82rem;
  padding: .2rem .6rem; border-radius: 999px;
  border: 1px solid var(--red); color: var(--red);
}
.adminlink:hover { background: var(--red); color: #fff; text-decoration: none; }

.bar nav {
  margin-left: auto;
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
}
.bar nav a { color: var(--ink); font-weight: 500; }
.bar nav a.btn { color: #fff; }
.bar .who { display: flex; align-items: center; gap: .5rem; }
.bar .who img { border-radius: 7px; }

main { max-width: 62rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

footer {
  max-width: 62rem; margin: 0 auto; padding: 0 1.25rem 2.5rem;
  color: var(--muted); font-size: .82rem;
}

/* ---- blocks -------------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.panel.narrow { max-width: 30rem; margin-inline: auto; }
.panel.center { text-align: center; }

h1 { font-size: 1.55rem; margin: 0 0 .85rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .85rem; }

.hero { text-align: center; padding: 1.5rem 0 1.5rem; }
.hero h1 { font-size: 2.4rem; margin-bottom: .5rem; }

/* The globe is scenery, not information: grey, thin, and quiet enough that the
   headline under it is still the first thing read. */
.globe {
  display: block;
  width: 100%; max-width: 22rem; height: auto;
  margin: 0 auto .25rem;
  color: var(--muted);
}
.globe-rim  { opacity: .55; }
.globe-grid { opacity: .32; }
.globe-arc  { color: var(--red); opacity: .9; }
/* A ring the colour of the page, so a pin reads as sitting on the wireframe
   rather than being crossed by it. */
.globe-pin  { fill: var(--red); stroke: var(--bg); stroke-width: 3.5; }

@media (max-width: 30rem) {
  .globe { max-width: 15rem; }
}
.lead { font-size: 1.1rem; color: var(--muted); max-width: 34rem; margin: 0 auto 1.5rem; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.cards .card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem;
}
.cards h2 { color: var(--red); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.cards p { margin: 0; color: var(--muted); }

.stats { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 1.75rem; }

/* ---- forms --------------------------------------------------------------- */

label, .label { display: block; font-weight: 600; margin: 1rem 0 .35rem; font-size: .92rem; }
.panel > form > label:first-child { margin-top: 0; }

input[type=text], input[type=password], input:not([type]) {
  width: 100%; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--ink);
  font: inherit;
}
input:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

.hint { color: var(--muted); font-size: .84rem; margin: .4rem 0 0; }
.muted { color: var(--muted); }

/* A field with a fixed head: the two read as one control, and the part nobody
   should have to type is printed instead. */
.prefixed {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); overflow: hidden;
}
.prefixed:focus-within { outline: 2px solid var(--red); outline-offset: 1px; }
.prefixed .prefix {
  display: flex; align-items: center;
  padding: 0 .1rem 0 .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.2rem; letter-spacing: .12em;
  color: var(--muted); white-space: nowrap; user-select: none;
}
.prefixed input {
  flex: 1; min-width: 0;
  border: 0; border-radius: 0; background: none; padding-left: .15rem;
}
.prefixed input:focus-visible { outline: none; }

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.2rem; letter-spacing: .12em; text-transform: uppercase;
}

.btn {
  display: inline-block; border: 0; border-radius: 9px;
  background: var(--red); color: #fff;
  padding: .68rem 1.15rem; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: 1rem;
}
.btn:hover { background: var(--red-dark); text-decoration: none; }
.btn.wide { width: 100%; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; margin-top: 0; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }

/* Destructive actions read as destructive only on hover: a row of red buttons
   beside every account is a page nobody reads carefully. */
.btn.ghost.danger:hover {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
}

.linkish {
  border: 0; background: none; color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; padding: 0;
}
.linkish:hover { text-decoration: underline; }

.inline { display: inline; }
.row { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.row input { flex: 1 1 14rem; }
.row .btn { margin-top: 0; }

.notice { padding: .7rem 1rem; border-radius: 9px; margin: 0 0 1.25rem; font-weight: 500; }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* ---- profile ------------------------------------------------------------- */

.profile { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.profile p { margin: 0 0 .2rem; }
.bigavatar { border-radius: 18px; display: block; }
.nickname { font-size: 1.5rem; font-weight: 700; }

.friendcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem; letter-spacing: .06em;
  color: var(--red); font-weight: 600;
}
.inline-code { display: inline; }

.recovery {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.25rem; letter-spacing: .08em; text-align: center;
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: 10px; padding: 1rem; word-break: break-all;
}

/* ---- avatar picker ------------------------------------------------------- */

.avatar-grid {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
}
.avatar-choice input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-choice img {
  width: 100%; height: auto; border-radius: 12px; display: block;
  cursor: pointer; padding: 3px;
  border: 3px solid transparent;
  transition: transform .08s ease;
}
.avatar-choice img:hover { transform: scale(1.05); }
.avatar-choice input:checked + img { border-color: var(--red); }
.avatar-choice input:focus-visible + img { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---- lists --------------------------------------------------------------- */

.friends, .devices { list-style: none; padding: 0; margin: 0; }
.friends li, .devices li {
  display: flex; align-items: center; gap: .9rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.friends li:last-child, .devices li:last-child { border-bottom: 0; }
.friends img { border-radius: 12px; }
.friends .who { display: flex; flex-direction: column; gap: .15rem; }
.friends .actions, .devices form { margin-left: auto; display: flex; gap: .5rem; }
.devices li > div { display: flex; flex-direction: column; }
.friends li.pending { opacity: .85; }

.tag {
  font-size: .78rem; font-weight: 600;
  padding: .1rem .5rem; border-radius: 999px;
  background: var(--bg); color: var(--muted); width: fit-content;
}
.tag.online { background: var(--good-bg); color: var(--good); }
.tag.room { background: var(--bad-bg); color: var(--red); }

/* ---- linking ------------------------------------------------------------- */

.device {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem; text-align: center; margin-bottom: 1rem;
}
.device p { margin: 0; }
.devapp { font-weight: 700; font-size: 1.1rem; }
.devname { color: var(--muted); font-size: .9rem; }
.devcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.5rem; letter-spacing: .16em; margin-top: .5rem !important;
}

.bigmark { font-size: 3rem; line-height: 1; margin: 0 0 .5rem; }
.bigmark.good { color: var(--good); }
.bigmark.bad { color: var(--bad); }
.panel.center .bigavatar { margin: 1rem auto; }
