/* CrossSend. Light, App.Shawn's palette (src/App.Shawn/App.xaml), same motion
   language as All files: presses land on pointer-down, arrivals settle on a
   soft spring, panels grow from the button that opened them. */
:root {
  --canvas: #F4F7FB;
  --surface: #FFFFFF;
  --field: #F7F9FC;
  --border: #E3E9F1;
  --text: #162033;
  --muted: #667085;
  --dim: #8A94A6;
  --accent: #2867E8;
  --accent-hover: #1F58CD;
  --accent-soft: #EAF1FF;
  --success: #168A5B;
  --danger: #C83D4D;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.grow { flex-grow: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font: 600 11.5px/1 ui-monospace, Consolas, monospace; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); }

button, .pill, .round, .primary, .secondary, .act {
  transition: transform 180ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 200ms ease;
}
button:active, .primary:active, .secondary:active { transform: scale(0.97); transition-duration: 90ms; }

/* ---------- header ---------- */

.top { display: flex; align-items: center; gap: 10px; padding: 20px max(24px, calc((100vw - 1120px) / 2)); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.brand svg { color: var(--accent); }
.pill { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); }
.pill .lock { color: var(--dim); }
.round { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); }
@media (hover: hover) and (pointer: fine) { .pill:hover, .round:hover { background: var(--field); } }

/* ---------- drop zone ---------- */

.page { max-width: 1120px; margin: 0 auto; padding: 4px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.zone {
  border: 1.5px dashed #C9D3E0; border-radius: 20px; background: var(--surface); padding: 26px;
  display: flex; flex-direction: column; gap: 18px;
  transition: transform 260ms var(--ease-out), border-color 200ms ease, background-color 200ms ease, box-shadow 260ms ease;
}
.zone.over { transform: scale(1.01); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 12px 40px rgba(40, 103, 232, 0.12); }
.zone-head { display: flex; align-items: center; gap: 16px; }
.zone-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; transition: transform 300ms var(--spring); }
.zone.over .zone-icon { transform: translateY(-3px) scale(1.06); }
.zone h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.sub { margin: 2px 0 0; color: var(--muted); }
.note { display: flex; flex-direction: column; gap: 6px; }
.note span { font-size: 12.5px; color: var(--muted); }
.note textarea {
  resize: vertical; min-height: 52px; border: 1px solid var(--border); border-radius: 12px; background: var(--field);
  padding: 12px 14px; outline: none; transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.note textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px rgba(40, 103, 232, 0.12); }
.zone-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; text-decoration: none; font-weight: 500;
}
.primary { border: 0; background: var(--accent); color: #fff; position: relative; }
.primary.dark { background: var(--text); }
.secondary { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.secondary.danger { color: var(--danger); }
.wide { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .primary:hover { background: var(--accent-hover); }
  .primary.dark:hover { background: #24304A; }
  .secondary:hover { background: var(--field); }
}

/* Segmented control with one thumb that slides between options. */
.keep { display: flex; align-items: center; gap: 8px; }
.keep-label { color: var(--muted); font-size: 13px; }
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 3px; border-radius: 12px; background: #EEF2F7; }
.seg button { position: relative; z-index: 1; height: 34px; min-width: 52px; padding: 0 10px; border: 0; background: transparent; border-radius: 9px; color: var(--muted); }
.seg button[aria-checked="true"], .seg button.on { color: var(--text); font-weight: 600; }
.seg button:active { transform: scale(0.95); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; left: 3px; height: 34px; border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(22, 32, 51, 0.12); transition: transform 320ms var(--ease-sheet), width 320ms var(--ease-sheet);
}
.seg-wide { width: 100%; }

/* ---------- drops ---------- */

.drops-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.drops-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.count { color: var(--dim); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 36px 0; }

.card-drop {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  display: flex; gap: 12px; align-items: center; min-height: 78px; overflow: hidden;
}
.card-drop.text { align-items: flex-start; }
.arrive { animation: arrive 440ms var(--spring) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
.leave { animation: leave 220ms ease-in both; }
@keyframes leave { to { opacity: 0; transform: scale(0.96); } }

.thumb { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 300ms ease; }
.thumb img.in { opacity: 1; }
.t-txt { background: #FFF4E5; color: #A15C07; }
.t-img { background: #E9F7EF; color: #137A4F; }
.t-pdf { background: #FDEDEF; color: #B4303F; }
.t-url { background: var(--accent-soft); color: var(--accent); }
.t-zip { background: #F1EEFB; color: #5B45B0; }
.t-any { background: #EEF2F7; color: var(--muted); }

.ring { transition: stroke-dashoffset 160ms linear; }
.tick { animation: tick 320ms cubic-bezier(0.34, 1.42, 0.64, 1) both; }
@keyframes tick { from { opacity: 0; transform: scale(0.6); } }

.body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex-grow: 1; }
.name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text .name { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-weight: 400; }
.meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta.bad { color: var(--danger); white-space: normal; }
.acts { display: flex; gap: 2px; flex-shrink: 0; transition: opacity 240ms ease; }
.acts.wait { opacity: 0; pointer-events: none; }
.act { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-decoration: none; }
.act:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) { .act:hover { background: var(--field); color: var(--accent); } .act.del:hover { color: var(--danger); } }
.bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transform-origin: left; transition: transform 160ms linear; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 20px;
  background: var(--text); color: #fff; font-size: 13.5px; box-shadow: 0 8px 24px rgba(22, 32, 51, 0.18);
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  transition: transform 360ms var(--ease-out), opacity 240ms ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- panels ---------- */

.scrim { position: fixed; inset: 0; z-index: 19; background: rgba(22, 32, 51, 0.22); opacity: 0; transition: opacity 260ms ease; }
.scrim.show { opacity: 1; }
.panel {
  position: fixed; z-index: 20; top: 72px; right: max(24px, calc((100vw - 1120px) / 2));
  width: 410px; max-height: calc(100dvh - 96px); overflow-y: auto;
  border-radius: 22px; background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 60px rgba(22, 32, 51, 0.22), 0 0 0 1px rgba(22, 32, 51, 0.05);
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.panel h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.panel .grip { display: none; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input[type="password"] {
  height: 46px; border-radius: 12px; border: 1px solid var(--border); background: var(--field); padding: 0 14px; outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(40, 103, 232, 0.12); }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.error { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--danger); }
#signin-form { display: flex; flex-direction: column; gap: 12px; }

.code-wrap { position: relative; }
.boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.boxes i {
  height: 64px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--field);
  display: grid; place-items: center; font: normal 600 28px/1 inherit; font-variant-numeric: tabular-nums;
  transition: border-color 160ms ease, background-color 200ms ease, transform 220ms cubic-bezier(0.34, 1.42, 0.64, 1);
}
.boxes i.filled { transform: scale(1.04); }
.boxes i.caret { border-color: var(--accent); }
.boxes i.ok { border-color: var(--success); background: #E9F7EF; }
#code-input { position: absolute; inset: 0; opacity: 0; font-size: 28px; caret-color: transparent; }

.spinner {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%;
  opacity: 0; transform: scale(0.6); transition: opacity 160ms ease, transform 200ms var(--ease-out);
  animation: spin 700ms linear infinite;
}
.primary span { transition: opacity 120ms ease, filter 160ms ease; }
.primary.busy span { opacity: 0; filter: blur(2px); }
.primary.busy .spinner { opacity: 1; transform: none; }
.primary.ok { background: var(--success); }
@keyframes spin { to { rotate: 360deg; } }

.who { display: flex; align-items: center; gap: 12px; }
.who .badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.who .badge.on { background: #E9F7EF; color: var(--success); }
.who .badge.off { background: #EEF2F7; color: var(--muted); }
.who strong { display: block; font-size: 16px; }
.card { border-radius: 16px; background: var(--field); border: 1px solid var(--border); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.code-shown { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.ring-wrap span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
#ring { transition: stroke-dashoffset 1000ms linear; }
.digits { display: flex; gap: 8px; font-size: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.digits span { display: inline-block; animation: roll 520ms var(--spring) both; }
@keyframes roll { from { opacity: 0; transform: translateY(60%); filter: blur(4px); } }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }

/* ---------- phone ---------- */

@media (max-width: 700px) {
  body { font-size: 15px; }
  .top { padding: max(14px, env(safe-area-inset-top)) 16px 8px; }
  .pill span { display: none; }
  .pill { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 22px; position: relative; }
  .pill .lock { position: absolute; right: 4px; bottom: 4px; width: 12px; height: 12px; background: var(--surface); border-radius: 4px; }
  .round { width: 44px; height: 44px; border-radius: 22px; }
  .page { padding: 4px 16px 48px; gap: 22px; }
  .zone { padding: 18px; border-radius: 18px; }
  .paste-hint { display: none; }
  .zone-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .zone-actions .primary, .zone-actions .secondary { height: 46px; padding: 0 12px; }
  #choose { grid-column: 1 / -1; }
  .zone-actions .grow { display: none; }
  .keep { grid-column: 1 / -1; }
  .keep { width: 100%; }
  .keep .seg { flex: 1; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .act { width: 42px; height: 44px; }
  .act[data-a="copylink"], .card-drop:has(.act[href^="http"]) .act[data-a="copy"] { display: none; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 88dvh;
    border-radius: 22px 22px 0 0; padding: 8px 20px max(24px, env(safe-area-inset-bottom));
  }
  .panel .grip { display: block; align-self: center; width: 38px; height: 5px; border-radius: 3px; background: #D5DBE4; margin: 4px 0 2px; flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}
.who .sub { display: block; }
