/* Main stylesheet. Defaults to light mode, follows system dark mode. */

:root {
  --ink: #1b1f24;
  --faint: #5c6670;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --rule: #dcd9d2;
  --accent: #0b6e4f;
  --accent-hover: #095a40;
  --accent-ink: #ffffff;
  --warn: #9a3412;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e8eb;
    --faint: #98a2ad;
    --paper: #0d1117;
    --panel: #151b23;
    --rule: #2a323d;
    --accent: #3fb68b;
    --accent-hover: #52c69c;
    --accent-ink: #06130e;
    --warn: #f0a070;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0 auto;
  min-height: 100dvh;
  max-width: 68rem;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main:not([hidden]) {
  flex: 1;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1 {
  font-size: 1.85rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h2,
h3 {
  font-size: 0.78rem;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.6rem;
}

h3 {
  margin-top: 1.5rem;
}

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

/* Header bar */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.brand .name {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: 600 1.05rem var(--mono);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand .name img {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.brand .tagline {
  color: var(--faint);
  font-size: 0.9rem;
}

.brand .visitor {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--mono);
  font-size: 0.88rem;
}

/* Controls */
button,
.button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--panel);
  padding: 0.45rem 0.75rem;
}

button,
.button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:active:not(:disabled),
.button:active {
  transform: translateY(1px);
}

button.quiet {
  background: transparent;
  border-color: var(--rule);
  color: var(--faint);
  font-weight: 450;
}

button.quiet:hover:not(:disabled) {
  background: var(--panel);
  border-color: var(--faint);
  color: var(--ink);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

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

.row input:not([type="file"]) {
  flex: 1;
  min-width: 10rem;
}

.note {
  color: var(--faint);
  font-size: 0.9rem;
}

/* Sign-in view: centered vertically in the viewport */
#door:not([hidden]) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 36rem;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 0 3.5rem;
  text-align: center;
}

#door .lead {
  color: var(--faint);
  font-size: 1rem;
  margin: 0 0 1.75rem;
  text-wrap: balance;
}

.doors {
  width: 100%;
}

.door {
  width: 100%;
  margin: 0 0 1.25rem;
}

.door:last-child {
  margin-bottom: 0;
}

.about {
  width: 100%;
  max-width: 34rem;
  margin-top: 2rem;
  color: var(--faint);
  font-size: 0.9rem;
}

.about summary {
  cursor: pointer;
  display: inline-block;
  list-style: none;
  font-size: 0.85rem;
  color: var(--faint);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

.about summary::-webkit-details-marker {
  display: none;
}

.about summary:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.about[open] {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1.15rem;
  text-align: left;
  box-shadow: var(--shadow);
}

.about[open] summary {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.about p {
  margin: 0.5rem 0 0;
}

.about p:first-of-type {
  margin-top: 0;
}

.door label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--faint);
  font-size: 0.9rem;
}

.door .row {
  justify-content: center;
  max-width: 22rem;
  margin: 0 auto;
}

.door .note {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  text-wrap: balance;
}

/* Provider buttons share one width so multiple sign-in options stack cleanly. */
.door .provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 19rem;
  min-height: 3rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.door .provider svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.door .github {
  background: #24292f;
  border-color: #24292f;
  color: #ffffff;
}

.door .github:hover {
  background: #32383f;
  border-color: #32383f;
}

.door .exe {
  background: #ffffff;
  border-color: #bfddce;
  color: #111111;
  font-family: var(--mono);
  font-weight: 700;
}

.door .exe:hover {
  background: #f6fbf8;
  border-color: #8bc4a9;
}

.door .exe img {
  width: 2rem;
  height: 2rem;
  flex: none;
}

@media (prefers-color-scheme: dark) {
  .door .github {
    background: #f6f8fa;
    border-color: #f6f8fa;
    color: #24292f;
  }

  .door .github:hover {
    background: #e6eaef;
    border-color: #e6eaef;
  }
}

/* Main workspace */
#network {
  padding: 1.25rem 0 2.5rem;
}

/* Node connection status badge */
.status {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--faint);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  margin: 0 0 1.25rem;
}

.status.failed {
  color: var(--warn);
  border-color: var(--warn);
}

/* Two-column layout: peer sidebar and app area */
.columns {
  display: grid;
  grid-template-columns: 15.5rem 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 48rem) {
  .columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.members ul,
.inbox,
.messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.members li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.15rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.88rem;
  transition: background-color 0.12s ease;
}

.members li.peer,
.members li.own {
  cursor: pointer;
}

.members li.peer:hover,
.members li.own:hover,
.members li.selected {
  background: var(--panel);
  outline: 1px solid var(--rule);
}

.members .latency,
.members .self,
.count {
  color: var(--faint);
  font-weight: 400;
  font-size: 0.82rem;
}

/* App tab bar */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.1rem;
}

.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--faint);
  padding: 0.45rem 0.85rem;
  margin-bottom: -1px;
}

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

.tabs button:active {
  transform: none;
}

.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.badge {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font: 600 0.7rem var(--mono);
  padding: 0.05rem 0.4rem;
  margin-left: 0.25rem;
}

.app > .note:first-child {
  margin-top: 0;
}

/* Pages */
.viewer {
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}

.viewer-title {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font: 0.8rem var(--mono);
  color: var(--faint);
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.viewer iframe {
  display: block;
  width: 100%;
  height: 16rem;
  border: none;
  background: #ffffff;
}

.editor {
  margin-top: 1rem;
}

.editor summary {
  cursor: pointer;
  font: 600 0.78rem var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.5rem;
}

/* Chat */
.messages {
  height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.6rem 0.8rem;
}

.messages li {
  margin: 0.2rem 0;
  overflow-wrap: anywhere;
}

.messages .who {
  font: 600 0.85rem var(--mono);
  margin-right: 0.45rem;
}

.messages .mine .who {
  color: var(--faint);
}

/* Drop */
.inbox li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule);
}

.inbox .file {
  font-family: var(--mono);
  font-size: 0.88rem;
  flex: 1;
  overflow-wrap: anywhere;
}

/* Board */
#board {
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
  cursor: crosshair;
}

.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin: 0 0.25rem 0 0.6rem;
  vertical-align: baseline;
}

/* Footer */
footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

footer a {
  color: inherit;
  text-decoration-color: var(--rule);
}

footer a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* Footer attribution and Nix build path */
footer .made {
  margin: 0;
}

footer .made + .made {
  margin-top: 0.35rem;
}

footer .made code {
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
