/* Goose - one stylesheet, served from the app itself.
 *
 * No CDN and no build step on purpose: the people who need this page are behind
 * the firewall it exists to get them past, so an asset hosted anywhere else is
 * an asset that may not load. Everything here is tokens + a handful of
 * components, which is all five form-shaped pages need.
 */

:root {
  color-scheme: light dark;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e3e6ec;
  --text: #131820;
  --muted: #626d7d;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-fg: #ffffff;
  --accent-soft: #eeecfd;
  --danger: #b42843;
  --danger-soft: #fdeef1;
  --ok: #0c7a51;
  --ok-soft: #e6f6ef;
  --warn: #93601a;
  --warn-soft: #fdf3e2;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --ring: 0 0 0 3px rgb(79 70 229 / 30%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017;
    --surface: #151a22;
    --surface-2: #1b212b;
    --border: #272e3a;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --accent: #6366f1;
    --accent-hover: #7c83f5;
    --accent-fg: #ffffff;
    --accent-soft: #1e2140;
    --danger: #f0798d;
    --danger-soft: #33191f;
    --ok: #4ade80;
    --ok-soft: #12291f;
    --warn: #e0b062;
    --warn-soft: #2b2415;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --ring: 0 0 0 3px rgb(99 102 241 / 45%);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  /* Chinese punctuation and Latin text sit better together with this off. */
  text-rendering: optimizeLegibility;
}

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

.wrap {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Login, signup, "link is dead" - one small card, vertically centred. */
.wrap--center {
  max-width: 24rem;
  min-height: 100dvh;
  justify-content: center;
  padding-bottom: 1.5rem;
}

.page {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.page__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page__sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.spread {
  justify-content: space-between;
}

/* ---------- card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.card__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.card__body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card__foot {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* On a phone the footer text takes the whole width and drops the action onto a
   line of its own, where a half-width button looks stranded. */
@media (max-width: 30rem) {
  .card__foot {
    flex-direction: column;
    align-items: stretch;
  }

  .card__foot .btn {
    width: 100%;
  }
}

.card--plain {
  box-shadow: none;
  background: transparent;
  border-style: dashed;
}

/* ---------- slot (one box the user holds) ---------- */

.slots {
  display: flex;
  flex-direction: column;
}

.slot {
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.slot + .slot {
  border-top: 1px solid var(--border);
}

.slot__where {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.slot__region {
  font-size: 0.9rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.slot__note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.slot__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ---------- badges and pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill--busy {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill--bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.pill--busy .dot {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .pill--busy .dot { animation: none; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  /* 44px tall: this is a phone page first, and the buttons sit next to each
     other in a row where a mis-tap deletes a server. */
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--danger {
  color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn--sm {
  min-height: 2.25rem;
  padding: 0 0.7rem;
  font-size: 0.85rem;
}

.btn--block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Every input, not input[type=...]: the copy fields are bare <input readonly>
   with no type at all, and a type-scoped selector left them with the browser's
   default inset border. */
input,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

select {
  /* Long region names, narrow phone. */
  max-width: 100%;
  text-overflow: ellipsis;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

form {
  margin: 0;
}

/* ---------- copyable link ---------- */

.copy {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.copy input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: var(--surface-2);
  color: var(--muted);
}

.copy .btn {
  flex: 0 0 auto;
}

/* ---------- invitation ---------- */

.invite {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.invite + .invite {
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
}

/* ---------- misc ---------- */

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.err {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 1rem;
  padding-top: 0.5rem;
}

.links a,
.links button {
  color: var(--muted);
  font-size: 0.9rem;
}

.links button {
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

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

.prose h2 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.4rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p {
  margin: 0.4rem 0;
  font-size: 0.95rem;
}

.prose ol {
  margin: 0.4rem 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
}

.prose li {
  margin: 0.25rem 0;
}

/* django-hijack injects its banner before </main>. */
#djhj {
  position: sticky;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 600;
}
