/* ==========================================================================
   openurl.no — design system (open-base)
   Ultra-minimal: light neutral background, white borderless surfaces, pills,
   near-monochrome. Geist for content, Geist Mono for numbers and micro labels.
   The accent color is reserved for alarm/critical states only.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #e9e9e6;
  --text: #171717;
  --text-2: #666666;
  --text-3: #6f6f6f;
  --border: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.1);

  --accent: #d92d20;
  --accent-soft: rgba(217, 45, 32, 0.08);

  --ok: #157f3d;

  --inverse-bg: #171717;
  --inverse-text: #fafafa;

  --ring: rgba(0, 0, 0, 0.1);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.04), 0 24px 60px rgba(0, 0, 0, 0.1);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6f6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #191919;
  --surface-2: #0e0e0e;
  --surface-3: #262626;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #9a9a9a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --accent: #f4645a;
  --accent-soft: rgba(244, 100, 90, 0.12);

  --ok: #6ccb8b;

  --inverse-bg: #fafafa;
  --inverse-text: #171717;

  --ring: rgba(255, 255, 255, 0.16);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: dark;
}

/* System dark mode applies unless the user explicitly chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --surface: #191919;
    --surface-2: #0e0e0e;
    --surface-3: #262626;
    --text: #ededed;
    --text-2: #a3a3a3;
    --text-3: #9a9a9a;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent: #f4645a;
    --accent-soft: rgba(244, 100, 90, 0.12);

    --ok: #6ccb8b;

    --inverse-bg: #fafafa;
    --inverse-text: #171717;

    --ring: rgba(255, 255, 255, 0.16);
    --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Numbers and data: mono with tabular digits so nothing jumps */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--surface-3); }

/* UI chrome must not be text-selectable (iOS long-press etc.).
   Real content/data the user may want to copy stays selectable. */
button, .site-header, .site-footer, .menu, .toast {
  -webkit-user-select: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header { background: transparent; }

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-tld { color: var(--text-3); font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) { .icon-btn:hover { background: var(--surface-3); } }
.icon-btn:active { transform: scale(0.94); }

.icon-btn.open { background: var(--inverse-bg); color: var(--inverse-text); }

/* Toggle buttons (on/off states) invert when active */
.toggle-btn.on { background: var(--inverse-bg); color: var(--inverse-text); }
@media (hover: hover) { .toggle-btn.on:hover { opacity: 0.85; background: var(--inverse-bg); } }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, opacity 0.15s ease;
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.primary { background: var(--inverse-bg); color: var(--inverse-text); }
@media (hover: hover) { .pill-btn.primary:hover { opacity: 0.85; } }

.pill-btn.ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

@media (hover: hover) { .pill-btn.ghost:hover { background: var(--surface-2); } }
.pill-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* --------------------------------------------------------------------------
   Settings menu
   -------------------------------------------------------------------------- */

.settings-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 296px;
  max-height: min(560px, calc(100dvh - 90px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-overlay);
  padding: 20px;
  z-index: 60;
  transform-origin: top right;
  animation: menu-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes menu-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Options share the row evenly when they fit; locales with long words
   («Pantalla completa», «Бегущая строка») wrap to their own row rather
   than wrapping inside the button. gap applies both ways, so the spacing
   between wrapped rows equals the spacing within a row */
.menu-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-grid .opt-btn { flex: 1 1 auto; white-space: nowrap; }

.menu-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 11px 44px 11px 14px;
  cursor: pointer;
}

.opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  color: var(--text-2);
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.opt-btn .icon { width: 14px; height: 14px; }

@media (hover: hover) { .opt-btn:hover { background: var(--surface-3); color: var(--text); } }
.opt-btn:active { transform: scale(0.97); }

.opt-btn.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 600;
}

.opt-btn.wide { width: 100%; }
.opt-btn.copied { background: var(--ok); color: #fff; }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 18px -20px;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease;
  margin: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease;
}

.switch:checked { background: var(--inverse-bg); }
.switch:checked::after { transform: translateX(17px); background: var(--inverse-text); }

.menu-info {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.menu-info a { color: var(--text-2); text-decoration: none; }
@media (hover: hover) { .menu-info a:hover { text-decoration: underline; } }

.menu-year { margin-top: 6px; }
.menu-info + .menu-info { margin-top: 6px; }
.menu-info a#termsLink { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------- /vilkar (from openlink) */

.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 0 32px;
}

.legal h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 7vw, 40px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.legal h2 {
  margin: 30px 0 8px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.legal p, .legal li { font-size: 15.5px; line-height: 1.6; color: var(--text-2); }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0; padding-left: 1.2em; }
.legal li + li { margin-top: 6px; }
.legal a { color: var(--text); text-underline-offset: 3px; }
.legal .legal-lead { font-size: 17px; color: var(--text); }
.legal .legal-meta { margin-top: 26px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.legal .legal-meta + .legal-meta { margin-top: 0; }
.legal-back { margin-top: 26px; }
.legal-back .pill-btn { text-decoration: none; }

/* --------------------------------------------------------------------------
   THE TOOL — paste a long link, get a short one. One big field with the
   button inside it, an optional address line under it, the list below.
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(28px, 9vh, 96px);
  padding-bottom: 40px;
}

.hero-title {
  margin: 0 0 26px;
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-align: center;
  text-wrap: balance;
}

.shorten {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The field: white, borderless-looking, lifted a little — the one thing on
   the page that asks for attention. The button sits inside it. */
.url-field {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-field:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px var(--ring), 0 10px 30px rgba(0, 0, 0, 0.06);
}

.url-field.invalid { border-color: var(--accent); }
.url-field.invalid:focus-within { box-shadow: 0 0 0 4px var(--accent-soft); }

.url-icon { color: var(--text-3); width: 19px; height: 19px; margin-right: 8px; }

.url-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 17px; /* ≥ 16px: iOS never zooms into the field */
  text-overflow: ellipsis;
}

.url-input:focus-visible { outline: none; }
.url-input::placeholder { color: var(--text-3); opacity: 0.85; }

.shorten-btn { height: 48px; padding: 0 24px; font-size: 15.5px; flex-shrink: 0; }
.pill-btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.pill-btn[aria-disabled="true"] { opacity: 0.4; }

/* openurl.no/<optional address> — reads like the link you will get */
.slug-line {
  display: flex;
  align-items: center;
  max-width: 100%;
  height: 40px;
  margin-top: 12px;
  padding: 0 12px 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  cursor: text;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) { .slug-line:hover { background: var(--surface); } }

.slug-line:focus-within {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--ring);
}

.slug-prefix { color: var(--text-3); white-space: nowrap; }

/* Hugs what is typed, so the line reads like the link you will get (a
   fixed width where field-sizing is not supported) */
.slug-input {
  width: 15ch;
  min-width: 0;
  field-sizing: content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}

@supports (field-sizing: content) {
  .slug-input { width: auto; min-width: 11ch; max-width: min(36ch, 58vw); }
}

.slug-input:focus-visible { outline: none; }
.slug-input::placeholder { color: var(--text-3); font-weight: 400; opacity: 0.8; }

.slug-state {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  flex-shrink: 0;
}

.slug-state .icon { width: 17px; height: 17px; stroke-width: 2.4; }
.slug-state.ok { color: var(--ok); }
.slug-state.bad { color: var(--accent); }

.field-hint {
  margin: 8px 14px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-3);
  text-align: center;
  text-wrap: pretty;
}

.field-hint:empty { display: none; }
.field-hint.ok { color: var(--ok); }
.field-hint.error { color: var(--accent); }
.field-hint .link-btn { font-weight: 600; color: inherit; text-decoration-color: currentColor; }

.login-line {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

.link-btn {
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

@media (hover: hover) { .link-btn:hover { text-decoration-color: currentColor; } }

.pill-btn.danger { background: var(--accent); color: #fff; }
@media (hover: hover) { .pill-btn.danger:hover { opacity: 0.88; } }

.pill-btn.danger-ghost {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  color: var(--accent);
  background: transparent;
}

.pill-btn.danger-ghost.armed { background: var(--accent-soft); }
@media (hover: hover) { .pill-btn.danger-ghost:hover { background: var(--accent-soft); } }

.pill-btn .icon { width: 17px; height: 17px; }

/* --------------------------------------------------------------------------
   Your links
   -------------------------------------------------------------------------- */

.list-section { width: 100%; max-width: 640px; margin-top: 56px; }

.section-label {
  margin: 0 0 12px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-hint {
  margin: -4px 0 14px;
  padding: 0 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  border-radius: 18px;
  background: var(--surface);
}

/* A new link slides in where it belongs and shows itself once */
.link-row.fresh { animation: row-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) backwards, row-glow 1.8s ease 0.1s; }

@keyframes row-in {
  from { opacity: 0.01; transform: translateY(-8px) scale(0.985); }
}

@keyframes row-glow {
  0%, 30% { box-shadow: 0 0 0 2px var(--text); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 8px 13px 18px;
  border-radius: 18px;
  text-align: left;
}

.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.row-short {
  font-size: 15.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-short b { font-weight: 600; color: var(--text); }

.row-sub {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub .row-name { color: var(--text-2); font-weight: 500; }

@media (hover: hover) { .row-main:hover .row-short b { text-decoration: underline; text-underline-offset: 3px; } }

/* The numbers line up in a column, so they are tabular */
.row-clicks {
  flex-shrink: 0;
  min-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.row-count {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.row-unit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.row-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.row-copy { flex-shrink: 0; margin-right: 8px; background: transparent; color: var(--text-2); }
@media (hover: hover) { .row-copy:hover { background: var(--surface-2); color: var(--text); } }
.row-copy .icon { width: 18px; height: 18px; }
.row-copy.done, .row-copy.done:hover { color: var(--ok); }

/* --------------------------------------------------------------------------
   One link: numbers, QR code, and what can change afterwards
   -------------------------------------------------------------------------- */

.ls {
  display: flex;
  flex-direction: column;
  padding: 20px 22px 22px;
}

.ls-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ls-title {
  flex: 1;
  min-width: 0;
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-3);
  overflow-wrap: break-word;
}

.ls-title b { font-weight: 650; color: var(--text); }

.ls-close { flex-shrink: 0; margin: -2px -6px 0 0; background: transparent; }
@media (hover: hover) { .ls-close:hover { background: var(--surface-2); } }

.ls-dest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
}

.ls-dest span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-dest .icon { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
@media (hover: hover) { .ls-dest:hover span { text-decoration: underline; text-underline-offset: 3px; } }

.ls-actions { display: flex; gap: 8px; margin-top: 16px; }
.ls-actions .pill-btn { height: 42px; padding: 0 18px; }
.ls-actions .pill-btn.done { background: var(--ok); color: #fff; }
.pill-btn.ghost[aria-pressed="true"] { background: var(--inverse-bg); color: var(--inverse-text); border-color: transparent; }
@media (hover: hover) { .pill-btn.ghost[aria-pressed="true"]:hover { background: var(--inverse-bg); opacity: 0.88; } }

.ls-blocked {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
}

.ls-note {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.mini-label {
  display: block;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* The numbers: three stat tiles, a 30-day column chart, two ranked lists */
.ls-stats { margin-top: 22px; }

.ls-stats.loading { opacity: 0.55; transition: opacity 0.2s ease; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

/* Standalone figures: the same sans, proportional digits */
.stat-num { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.chart-wrap { margin-top: 18px; }

.chart-readout {
  margin: 0 0 8px;
  min-height: 20px;
  font-size: 13.5px;
  color: var(--text-2);
}

.chart-readout b { color: var(--text); font-weight: 650; }

/* One column per day: the whole column is the hit target, the bar inside
   it the mark (≤ 24 px, 4 px rounded top, square at the baseline, 2 px of
   surface between neighbours). Grey bars, the active day in ink. */
.chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
  height: 120px;
  border-bottom: 1px solid var(--border-strong);
  touch-action: pan-y;
  cursor: default;
}

.chart:focus-visible { outline-offset: 6px; }

.chart-grid {
  position: absolute;
  inset: 0 0 auto;
  height: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.chart-grid span {
  position: absolute;
  right: 0;
  bottom: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.day {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
}

.day-bar {
  width: 100%;
  max-width: 24px;
  height: calc(var(--h, 0) * 100%);
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: var(--text-3);
  transition: background-color 0.12s ease;
}

.day.some .day-bar { min-height: 3px; }
.day.active .day-bar { background: var(--text); }

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.ls-empty {
  margin: 18px 0 0;
  padding: 22px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

.ranks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

.rank {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.rank li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 4px;
  font-size: 13.5px;
}

.rank-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.rank-flag { margin-right: 6px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.rank-n { font-weight: 600; font-variant-numeric: tabular-nums; }

.rank-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.rank-bar span {
  display: block;
  height: 100%;
  width: calc(var(--w, 0) * 100%);
  border-radius: 999px;
  background: var(--text-3);
}

.rank-more { color: var(--text-3); font-size: 12.5px; }

/* The QR code: always dark on white, whatever the theme — scanners want it */
.ls-qr { margin-top: 22px; display: flex; flex-direction: column; align-items: center; }

.qr-box {
  width: 216px;
  height: 216px;
  padding: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-actions { display: flex; gap: 8px; margin-top: 14px; }
.ls-qr .ls-note { text-align: center; }

/* What can change afterwards */
.ls-edit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.ls-edit .mini-label { margin-bottom: -2px; }
.ls-field { display: flex; flex-direction: column; gap: 6px; }

.ls-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field:focus-within {
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--ring);
}

.field-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}

.field-input:focus-visible { outline: none; }
.field .slug-prefix { font-size: 16px; }
.ls-edit .field-hint { margin: -8px 2px 0; text-align: left; }

.aliases { display: flex; flex-direction: column; gap: 6px; }

.alias-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alias {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 4px 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-2);
}

.alias-x {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-3);
}

.alias-x .icon { width: 14px; height: 14px; }
@media (hover: hover) { .alias-x:hover { background: var(--surface-3); color: var(--text); } }

.text-area { height: auto; padding: 12px 16px; resize: vertical; line-height: 1.45; }

.reasons .opt-btn[aria-checked="true"] {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Settings menu: the account
   -------------------------------------------------------------------------- */

.menu-text {
  margin: -2px 0 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}

.menu-account {
  margin: -2px 0 12px;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.menu-danger { margin-top: 8px; color: var(--accent); }
@media (hover: hover) { .menu-danger:hover { background: var(--accent-soft); color: var(--accent); } }
.menu-recovery { margin-top: 8px; }

/* --------------------------------------------------------------------------
   Sheets (from openlink / opencountdown)
   -------------------------------------------------------------------------- */

dialog.sheet {
  width: min(420px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-overlay);
  overflow: auto;
  overscroll-behavior: contain;
}

dialog.link-sheet { width: min(560px, calc(100vw - 24px)); }

dialog.sheet[open] { animation: sheet-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1); }
dialog.sheet::backdrop { background: rgba(10, 10, 10, 0.42); }

@keyframes sheet-in {
  from { opacity: 0.01; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
}

.sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.sheet-text {
  margin: -6px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-2);
}

.sheet-field { display: flex; flex-direction: column; }

.text-input {
  height: 48px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.text-input:focus-visible {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--ring);
}

.text-input::placeholder { color: var(--text-3); opacity: 0.8; }
.sheet-form .field-hint { margin: -8px 2px 0; text-align: left; }

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.sheet-spacer { flex: 1; }

.recovery-link {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.sheet-switch {
  margin: -2px 0 0;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  inset: auto; /* resets popover UA styling (inset: 0) */
  margin: 0;
  border: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100;
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  text-align: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-2); text-decoration: none; }
@media (hover: hover) { .site-footer a:hover { text-decoration: underline; } }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .menu { width: min(296px, calc(100vw - 32px)); }
  .hero-title { margin-bottom: 20px; }
  .url-field { height: 58px; padding: 0 6px 0 18px; }
  .url-icon { display: none; }
  .shorten-btn { height: 46px; padding: 0 18px; }
  .list-section { margin-top: 44px; }
  .ls { padding: 18px 18px 20px; }
  .stat { padding: 10px 12px; }
  .stat-num { font-size: 22px; }
  .chart { height: 104px; }
  .ranks { grid-template-columns: 1fr; gap: 20px; }
  /* Top-anchored on phones: the on-screen keyboard covers the bottom half,
     and iOS does not scroll a top-layer dialog out from under it */
  dialog.sheet { margin: calc(12px + env(safe-area-inset-top)) auto auto; }
}

/* Small phones (320–380 px): the address line and the rows keep room */
@media (max-width: 380px) {
  .slug-line { padding: 0 10px 0 12px; font-size: 14px; }
  .slug-input { width: 12ch; font-size: 15px; }
  .row-main { padding-left: 14px; gap: 10px; }
  .row-short { font-size: 14.5px; }
  .ls-actions .pill-btn { padding: 0 14px; }
}
