/* ============================================================
   5i.fi/to/ — link shortener
   Shares the homepage palette, fonts and background so the
   two sites feel continuous.
   ============================================================ */

:root {
  --bg:        #0E1116;
  --panel:     #161B22;
  --panel-2:   #1B222B;
  --hairline:  #232A33;
  --hairline-2:#2C353F;
  --text:      #E6EDF3;
  --muted:     #7D8792;
  --muted-dim: #59626C;
  --aqua:      #3FE0C8;
  --aqua-dim:  #1F6B62;
  --amber:     #F2A83B;
  --danger:    #F2708B;

  --font-display: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 620px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Same server-room background as the homepage */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 82% -8%, rgba(63,224,200,0.07), transparent 60%),
    radial-gradient(760px 620px at -6% 108%, rgba(242,168,59,0.05), transparent 60%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255,255,255,0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.014) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 88%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; border-radius: 4px; }

/* ---------- LED ---------- */
.led {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--muted-dim);
}
.led--live {
  background: var(--aqua);
  box-shadow: 0 0 8px rgba(63,224,200,0.8);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(63,224,200,0.55); }
  50%      { box-shadow: 0 0 11px rgba(63,224,200,0.95); }
}

/* ---------- Top bar ---------- */
.topbar {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.node-id {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.02em;
}
.node-id__name { font-weight: 500; }
.node-id__path { color: var(--aqua); }
.topnav {
  font-family: var(--font-mono); font-size: 13.5px; color: var(--muted);
}
.topnav a { transition: color .18s ease; }
.topnav a:hover { color: var(--aqua); }

/* ---------- Layout ---------- */
.wrap {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(48px, 10vw, 96px) 24px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- Card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: clamp(26px, 5vw, 40px);
}
.card--message { text-align: center; }
.card--message .btn { margin-top: 24px; }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--aqua);
  margin-bottom: 16px;
}
.card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.muted { color: var(--muted); margin: 0 0 26px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; color: var(--text); }

.glyph {
  display: block;
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 18px;
  color: var(--aqua);
}
.glyph--dim { color: var(--muted-dim); }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__opt { color: var(--muted-dim); text-transform: none; letter-spacing: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline-2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 13px 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted-dim); }
.input:focus {
  outline: none;
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(63,224,200,0.14);
}
select.input {
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--aqua);
  color: #06231F;
  border: 1px solid var(--aqua);
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { box-shadow: 0 0 22px rgba(63,224,200,0.35); }
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: transparent;
  color: var(--aqua);
  border-color: var(--hairline-2);
}
.btn--ghost:hover { border-color: var(--aqua); box-shadow: none; }

/* ---------- Result ---------- */
.result {
  border: 1px solid var(--aqua-dim);
  background: rgba(63,224,200,0.05);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 28px;
}
.result__label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--aqua);
}
.result__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 16px;
}
.result__link {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text);
  word-break: break-all;
  border-bottom: 1px solid var(--aqua-dim);
}
.result__link:hover { color: var(--aqua); }
.btn--copy {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.btn--copy.is-done { background: #2f9c8c; border-color: #2f9c8c; }
.btn--sm { padding: 8px 14px; font-size: 13px; }

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 16px;
}

/* QR panel — light background so it always scans */
.qr { margin: 0 0 18px; }
.qr__inner {
  display: inline-block;
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  line-height: 0;
}
.qr__inner img,
.qr__inner canvas { display: block; }
.qr__inner table { border-collapse: collapse; }

.result__meta {
  margin: 0;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
}
.result__meta > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.result__meta dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.result__meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-align: right;
}
.truncate {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Admin ---------- */
.card--wide { max-width: none; }
.wrap:has(.card--wide) { max-width: 940px; }

.admin__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.admin__head h1 { margin-bottom: 6px; }
.admin__count { margin: 0; font-family: var(--font-mono); font-size: 13px; }
.admin__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin__actions .btn { padding: 9px 15px; font-size: 13px; }

.inline-link { color: var(--aqua); border-bottom: 1px solid var(--aqua-dim); }
.inline-link:hover { border-color: var(--aqua); }

.notice {
  margin: 22px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--aqua-dim);
  background: rgba(63,224,200,0.07);
  border-radius: 8px;
  color: var(--aqua);
  font-size: 14px;
}
.empty { margin: 28px 0 0; color: var(--muted); }

.table-scroll { margin-top: 24px; overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.row--expired { opacity: 0.5; }

.code {
  color: var(--text);
  border-bottom: 1px solid var(--aqua-dim);
}
.code:hover { color: var(--aqua); }
.pill { margin-left: 6px; font-size: 11px; }

.dest { max-width: 320px; }
.dest__link {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dest__link:hover { color: var(--aqua); }

.when { color: var(--muted); white-space: nowrap; }
.expired-tag { color: var(--danger); }

.rowactions { text-align: right; white-space: nowrap; }
.rowactions__in { display: flex; gap: 8px; justify-content: flex-end; }
.rowactions__in form { display: contents; }
.btn-mini {
  background: transparent;
  border: 1px solid var(--hairline-2);
  color: var(--muted);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.btn-mini:hover { color: var(--aqua); border-color: var(--aqua); }
.btn-mini.is-done { color: var(--aqua); border-color: var(--aqua-dim); }
.btn-x {
  background: transparent;
  border: 1px solid var(--hairline-2);
  color: var(--muted);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.btn-x:hover {
  color: var(--danger);
  border-color: rgba(242,112,139,0.5);
  background: rgba(242,112,139,0.08);
}

/* ---------- Messages ---------- */
.error {
  margin: 0;
  padding: 11px 14px;
  border: 1px solid rgba(242,112,139,0.4);
  background: rgba(242,112,139,0.08);
  border-radius: 8px;
  color: var(--danger);
  font-size: 14px;
}

/* ---------- Footer ---------- */
.footer {
  flex-shrink: 0;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.footer__node { display: inline-flex; align-items: center; gap: 9px; }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .truncate { max-width: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .led--live { animation: none; }
}
