/* Shortcuts site: iOS inset-grouped look in light and dark. No inline styles (CSP). */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #fffffe;
  --text: #1c1c1e;
  --muted: #6c6c70;
  --line: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --accent: #007aff;
  --ok: #248a3d;
  --danger: #d70015;
  --radius: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #050506;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #98989f;
    --line: rgba(84, 84, 88, 0.65);
    --fill: rgba(118, 118, 128, 0.24);
    --accent: #0a84ff;
    --ok: #30d158;
    --danger: #ff6961;
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
    system-ui, sans-serif;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

main { max-width: 34rem; margin: 0 auto; }
h1 {
  font: 700 34px/1.12 ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  letter-spacing: 0.01em;
  margin: 8px 0 4px;
}
h2 { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
h3 { font-size: 19px; font-weight: 650; margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); margin-bottom: 24px; }
.muted { color: var(--muted); font-size: 15px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top form { margin: 0 0 8px; }
.link {
  background: none; border: 0; padding: 8px 0; font: inherit; color: var(--accent);
  cursor: pointer;
}

/* API key card: the button keeps its own row, so "Copied ✓" never reflows the card */
.key { display: grid; justify-items: start; gap: 12px; }

/* Buttons: one primary per card, secondary for helpers */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fffffe; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s var(--ease-out), opacity 0.12s var(--ease-out),
    color 0.2s var(--ease-out);
}
.button:active { transform: scale(0.97); opacity: 0.85; }
.button.wide { width: 100%; }
.button.secondary { background: var(--fill); color: var(--accent); }
.button.done { color: var(--ok); }

/* Shortcut tiles: the icon square previews the tile Shortcuts will show */
.tile { display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; row-gap: 2px; }
.tile .glyph {
  grid-row: span 2; width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--tile) 72%, #fff),
    var(--tile) 55%, color-mix(in srgb, var(--tile) 80%, #000));
}
.tile h3 { align-self: end; }
.tile p { align-self: start; color: var(--muted); font-size: 15px; }
.tile .request {
  grid-column: 1 / -1; margin-top: 12px; padding: 6px 10px; border-radius: 8px;
  background: var(--fill); color: var(--muted); overflow-wrap: anywhere;
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
}
.tile .button { grid-column: 1 / -1; margin-top: 12px; }

.c-red { --tile: #f36f74; }
.c-orange { --tile: #ff8e73; }
.c-yellow { --tile: #f8ae5f; }
.c-gold { --tile: #e8ca45; }
.c-green { --tile: #53cd6b; }
.c-teal { --tile: #57cfb4; }
.c-cyan { --tile: #5acdde; }
.c-blue { --tile: #24baf7; }
.c-navy { --tile: #5874ca; }
.c-purple { --tile: #9164c7; }
.c-lavender { --tile: #c085e6; }
.c-pink { --tile: #f694d8; }
.c-gray { --tile: #9099a3; }
.c-sage { --tile: #9da79d; }
.c-tan { --tile: #a49995; }

/* Install steps */
.help summary { font-weight: 600; cursor: pointer; }
.help ol { margin: 12px 0 0; padding-left: 22px; color: var(--muted); font-size: 15px; }
.help li + li { margin-top: 6px; }
.help .hint { margin-top: 12px; }
.empty { color: var(--muted); padding: 4px 4px 20px; }
.empty code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; }

/* Login */
.login { max-width: 22rem; padding-top: 8vh; }
.login .app-icon { display: block; margin: 0 0 14px; }
.login form { margin-top: 8px; }
.login .button { margin-top: 14px; }

label {
  display: block; margin: 0 0 6px 2px; font-size: 13px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
input[type="password"] {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
input:focus-visible, .button:focus-visible, .link:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}
.error { color: var(--danger); font-weight: 600; margin-bottom: 12px; }

/* One calm entrance; nothing moves for people who ask for less motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: rise 0.45s var(--ease-out) both; }
  main > :nth-child(2) { animation-delay: 30ms; }
  main > :nth-child(3) { animation-delay: 60ms; }
  main > :nth-child(4) { animation-delay: 90ms; }
  main > :nth-child(n + 5) { animation-delay: 120ms; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .button:active { transform: none; }
}
