:root {
  color-scheme: light;
  --bg: #f4f0e6;
  --ink: #1c1915;
  --muted: #5e584e;
  --faint: #8a8276;
  --line: #e3dcd0;
  --card: #fffcf6;
  --accent: #9a3412;
  --accent-ink: #fff7f2;
  --good: #1d6b45;
  --bad: #9f1239;
  --ring: #9a3412;
  --shadow: 0 16px 40px rgba(48, 32, 14, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14120e;
    --ink: #f3efe6;
    --muted: #c4b8a6;
    --faint: #9a8f80;
    --line: #322d26;
    --card: #1e1b16;
    --accent: #e8844f;
    --accent-ink: #1c0d06;
    --good: #8fd0ae;
    --bad: #fb7185;
    --ring: #e8844f;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.top, #app, .foot {
  width: min(40rem, calc(100% - 2rem));
  margin-inline: auto;
}

.top { padding: 1.5rem 0 0.25rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}

.mark {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}

.word {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.lede {
  margin: 0.75rem 0 0;
  max-width: 36rem;
  color: var(--muted);
}

body.leaving .lede { display: none; }

#app { padding: 1.15rem 0 2.5rem; }

.foot {
  padding: 0 0 2rem;
  color: var(--faint);
  font-size: 0.85rem;
}

h2 {
  margin: 0;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

form, .ticket, .panel, .library {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

form { padding: 0.9rem; display: grid; gap: 0.75rem; }

.field { display: grid; gap: 0.35rem; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

label, .kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

label span {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

input, select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.grow { min-height: 3.1rem; font-size: 1.05rem; }

button, .go {
  font: inherit;
  font-size: 0.95rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

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

button:disabled { opacity: 0.45; cursor: not-allowed; }

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

.alert {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 12%, var(--card));
  color: var(--bad);
  font-size: 0.92rem;
}

.ticket, .panel { margin-top: 0.9rem; padding: 1rem 1rem 1.05rem; }

.ticket { border-top: 4px solid var(--accent); }

.short-url, .host {
  margin: 0.35rem 0 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  line-height: 1.35;
}

.short-url {
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.host { overflow-wrap: anywhere; }

.host { font-size: 1.25rem; color: var(--accent); }

.full, .goes {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.portable {
  margin: 0.55rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: nowrap;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}

details { margin-top: 0.75rem; }

input::placeholder { color: var(--faint); }

.meta {
  margin: 0.3rem 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.split {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

.qr {
  margin-top: 0.75rem;
  padding: 0.7rem;
  border-radius: 12px;
  background: #fff;
  line-height: 0;
}

.qr:not([hidden]) { display: inline-block; }

.qr svg { width: 168px; height: 168px; }

.library { margin-top: 1.1rem; padding: 0.35rem 1rem 0.6rem; }

.library h2 { font-size: 1.2rem; padding-top: 0.7rem; }

.headrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.links { list-style: none; margin: 0.4rem 0 0; padding: 0; }

.links li {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.code {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 600;
}

.dest {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.empty { color: var(--muted); margin: 0.8rem 0; }

.file { display: none; }

@media (min-width: 640px) {
  .links li {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

@media (max-width: 560px) {
  .top, #app, .foot { width: min(40rem, calc(100% - 1.5rem)); }
  .row { grid-template-columns: 1fr; }
  .word { font-size: 1.65rem; }
  h2 { font-size: 1.45rem; }
  .actions button, .actions .go { flex: 1 1 auto; }
  .panel .actions { flex-direction: column; align-items: stretch; }
  .panel .actions button, .panel .actions .go { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
