/* The app. Colours, type, buttons, chips and the slip card come from tokens.css.
   Layout: a cobalt band holds the brand and the composer; the list sits on paper below it. */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.col { max-width: 660px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.spacer { flex: 1; }
.note { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }

/* ---------- the band ---------- */
.top { position: relative; background: var(--hero); color: var(--hero-ink); padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 30px; }
.top > .col { display: flex; flex-direction: column; gap: 14px; }
/* its lower edge is perforated, like the torn end of a slip */
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 14px; background: radial-gradient(circle at 9px 7px, var(--hero) 6.4px, transparent 7px) 0 0 / 18px 14px repeat-x; pointer-events: none; }
.top :focus-visible { outline-color: var(--hero-pop); }

.logo { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 750; font-size: 26px; letter-spacing: -0.03em; color: var(--hero-ink); text-decoration: none; align-self: flex-start; }
.logo-paper { fill: var(--hero-ink); }
.logo-line { fill: var(--hero); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.devices { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: var(--hero-ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.devices:hover { background: rgba(255, 255, 255, 0.22); }
.devices:focus-visible { outline: 2px solid var(--hero-pop); outline-offset: 2px; }
.devices i { width: 9px; height: 9px; border-radius: 50%; background: var(--hero-pop); flex: none; }
.devices[data-state="on"] i { background: #5BE3B0; }
.devices[data-state="connecting"] i { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- composer ---------- */
.composer { background: var(--surface); color: var(--ink); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 30px rgba(8, 14, 40, 0.28); }
.composer textarea { display: block; width: 100%; resize: none; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 18px; line-height: 1.4; padding: 12px 12px 8px; min-height: 52px; max-height: 40vh; }
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:focus { outline: none; }
.composer:focus-within { box-shadow: 0 0 0 3px var(--hero-pop), 0 10px 30px rgba(8, 14, 40, 0.28); }
/* the composer is a white card, so the amber ring used on the blue band would vanish inside it */
.composer :focus-visible { outline-color: var(--accent); }
.composer-row { display: flex; align-items: center; gap: 8px; padding: 0 4px 4px; }
.composer .chips { flex-wrap: nowrap; }
.composer .chips legend { margin-left: 6px; }
/* with a keyboard, pasting is a keystroke; the button is for touch screens */
@media (pointer: fine) { #btn-paste { display: none; } }
.composer .chips label { padding: 6px 11px; }
.composer .note { padding: 0 12px 8px; }
.pop { background: var(--hero-pop); border-color: var(--hero-pop); color: #1B1300; }
.btn.pop { min-width: 104px; font-size: 16px; }
.btn.pop:hover { border-color: #1B1300; }
.top .hint { font-size: 13px; color: var(--hero-muted); padding-left: 6px; }
.hint kbd { font-family: var(--mono); font-size: 12px; background: rgba(255, 255, 255, 0.16); border-radius: 5px; padding: 1px 6px; color: var(--hero-ink); }

/* phones get one labelled picker instead of a row of chips */
.ttl-pick { display: none; align-items: center; flex: none; }
.ttl-pick select { font: inherit; font-size: 16px; font-weight: 600; color: var(--timer); background: var(--timer-soft); border: 1px solid var(--timer-bar); border-radius: 999px; min-height: 44px; padding: 0 12px; max-width: 170px; }
@media (max-width: 560px) {
  .composer .chips { display: none; }
  .composer .ttl-pick { display: inline-flex; }
  .btn.pop { min-width: 92px; }
}
/* small phones: the picker gives way so Paste and the send button always stay inside the card */
@media (max-width: 400px) {
  .composer-row { gap: 6px; }
  .composer-row .spacer { display: none; }
  .composer .ttl-pick { flex: 1 1 auto; min-width: 0; }
  .composer .ttl-pick select { width: 100%; min-width: 0; max-width: none; }
  .btn.pop { min-width: 80px; }
}
/* the narrowest phones: one row would cut the picker's label short, so it takes a row of its own */
@media (max-width: 340px) {
  .composer-row { flex-wrap: wrap; }
  .composer .ttl-pick { flex: 1 1 100%; }
  .composer-row .btn { flex: 1 1 0; }
}

/* ---------- below the band ---------- */
.body { display: flex; flex-direction: column; gap: 12px; padding-top: 26px; padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
.banner { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner.warn { background: var(--timer-soft); color: var(--timer); font-weight: 500; }
.tools .field { padding: 10px 14px; font-size: 16px; border-radius: 999px; }

/* ---------- list ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 16px 4px 2px; }
.list-head .count { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--sunk); border-radius: 999px; padding: 1px 7px; }

.slip { position: relative; padding: 0; gap: 0; overflow: hidden; border-radius: 14px; }
.slip-top { padding: 8px 6px 0 14px; gap: 6px; min-height: 40px; }/* sender and age travel together; the age always stays, the sender gives its place away */
.slip-who { flex: 1; min-width: 0; display: flex; align-items: baseline; font-size: 12px; color: var(--muted); white-space: nowrap; }
.slip-who .slip-from { flex: 0 1000 auto; }
.slip-from::after { content: '·'; margin: 0 6px; }
.slip-who .ago { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 460px) { .slip-who .slip-from { display: none; } }
.stamp.latest { color: var(--accent); }
.ago { font-variant-numeric: tabular-nums; }

/* the text is the button: tap anywhere on it to copy */
.slip-copy { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 2px 10px 14px 14px; cursor: pointer; }
.slip-copy.still { cursor: default; }
.slip-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 10px; }
.slip-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.slip-text .slip-body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; font-size: 16px; }
.slip-text .slip-body.mono { font-size: 14px; }
.slip.open .slip-text .slip-body { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.slip-hint { display: block; line-height: 1.4; }

.cue { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--accent); background: var(--accent-soft); white-space: nowrap; flex: none; }
button.cue { cursor: pointer; }
button.cue:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cue.solid { background: var(--accent); color: var(--accent-ink); }
.slip-copy:hover .cue { filter: brightness(0.96); }
.ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.slip.copied { border-color: var(--keep-bar); }
.slip.copied .cue { background: var(--keep-soft); color: var(--keep); }

/* the newest item is the one you came for */
.slip.featured { box-shadow: var(--shadow); border-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  /* when a new arrival steals focus, slide it in; for everything else the highlight is enough */
  .slip.featured:focus-visible { animation: slideIn 0.22s ease-out; }
  @keyframes slideIn { from { transform: translateY(-6px); } to { transform: none; } }
}
.slip.featured .slip-copy { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 4px 14px 16px; }
.slip.featured .slip-text .slip-body { font-size: 20px; line-height: 1.35; -webkit-line-clamp: 8; line-clamp: 8; }
.slip.featured .slip-text .slip-body.mono { font-size: 16px; }
.slip.featured .cue { min-height: 46px; font-size: 16px; padding: 0 22px; justify-self: start; }
@media (max-width: 560px) {
  .slip.featured .cue { justify-self: stretch; }
  /* "until copied" items stack on a phone so their button gets the full width */
  .slip-copy.still { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-right: 14px; }
  .slip-copy.still .cue { justify-self: stretch; min-height: 44px; }
  .top .hint { display: none; }
}

.icon-btn { all: unset; box-sizing: border-box; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--sunk); color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.icon-btn .ico { stroke-width: 3.4; width: 20px; height: 20px; }

.slip-more { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 14px; border-top: 1px dashed var(--line); }
.slip-more a.btn { text-decoration: none; }
.slip .lifebar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }

/* the time pill doubles as the lifetime picker */
.life.pick { position: relative; cursor: pointer; padding-right: 8px; min-height: 28px; }
.life.pick::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0.7; margin-left: 2px; }
.life.pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.life.pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) {
  .life.pick { min-height: 36px; padding: 0 10px 0 13px; font-size: 13px; }
  .btn.small { min-height: 44px; padding-inline: 14px; }
  .fold summary { min-height: 44px; }
}

/* a deleted or used-up item, holding its place while Undo is still possible */
.slip.gone { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--sunk); border-style: dashed; }
.gone-text { color: var(--muted); font-size: 15px; }

/* ---------- empty states ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h2 { color: var(--ink); font-size: 24px; }
.empty p { max-width: 30em; }
.empty-art { width: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; transform: rotate(-4deg); box-shadow: var(--shadow); margin-bottom: 10px; }
.empty-art i { height: 7px; border-radius: 4px; background: var(--sunk); }
.empty-art i:last-child { width: 60%; background: var(--timer-bar); }

/* ---------- first run and the switch warning ---------- */
#welcome .top, #switch .top { padding-top: calc(22px + env(safe-area-inset-top, 0px)); padding-bottom: 40px; }
#welcome .top > .col, #switch .top > .col { gap: 18px; }
#welcome h1, #switch h1 { font-size: clamp(34px, 8vw, 54px); font-weight: 800; letter-spacing: -0.035em; line-height: 0.98; }
h1 .pop { background: none; color: var(--hero-pop); }
.lede { color: var(--hero-muted); font-size: 17px; max-width: 34em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: 20px; }
.panel p { color: var(--muted); font-size: 15px; }
.panel p.error { color: var(--danger); }
.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.how li { display: flex; gap: 12px; align-items: baseline; }
.how b { font-family: var(--mono); font-size: 12px; font-weight: 500; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; flex: none; }
.btn.wide { width: 100%; font-size: 17px; min-height: 52px; }
.btn.wide-plain { width: 100%; }
.fold { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.fold summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 32px; display: flex; align-items: center; gap: 8px; list-style: none; }
.notice-box { display: flex; flex-direction: column; gap: 12px; }
.notice { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.45; margin: 2px 0 10px; }
.notice input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "+"; font-family: var(--mono); color: var(--muted); width: 14px; }
.fold[open] summary::before { content: "–"; }
.fold[open] > :not(summary) { margin-top: 10px; }

/* ---------- devices dialog ---------- */
.dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); padding: 20px; width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.dialog::backdrop { background: rgba(8, 12, 20, 0.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -20px; background: var(--surface); padding-block: 4px; margin-block: -4px; z-index: 1; }
.dialog h2 { font-size: 24px; }
.dialog h3 { font-size: 17px; margin-top: 4px; }
.dialog p { font-size: 15px; }
.dialog .qr { align-self: center; border: 1px solid var(--line); }
.dialog .fold p { font-size: 14px; color: var(--muted); }
.online { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--keep); background: var(--keep-soft); border-radius: 999px; padding: 5px 12px; align-self: flex-start; font-weight: 600; }
.online.joined { animation: joined 0.5s ease-out; }
@keyframes joined { from { transform: scale(0.9); } 60% { transform: scale(1.06); } to { transform: scale(1); } }
.links { display: flex; align-items: center; gap: 4px 20px; flex-wrap: wrap; font-size: 15px; border-top: 1px solid var(--line); padding-top: 6px; }
.links a { padding-block: 10px; }
/* night mode lives with the other odds and ends, not in the dialog's header */
.links .btn { margin-left: auto; }
.links .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 500; line-height: 1.35; padding: 11px 16px; border-radius: 14px; width: max-content; max-width: min(420px, calc(100vw - 32px)); display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); z-index: 10; }
.toast-btn { all: unset; cursor: pointer; font-weight: 700; color: var(--bg); text-decoration: underline; text-underline-offset: 3px; padding: 4px 2px; white-space: nowrap; }
.toast-btn:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; border-radius: 4px; }

/* ---------- the one-time note about what is coming ---------- */
.wl { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.wl-q { font-weight: 650; font-size: 15px; }
.wl-a { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.wl-form { display: flex; gap: 8px; align-items: center; }
.wl-form .field { flex: 1; min-width: 0; }
.wl-msg { font-size: 13px; font-weight: 600; color: var(--danger); }
@media (pointer: coarse) { .wl-form .btn { min-height: 44px; } }
/* on a narrow phone the email field takes its own line, so the address being typed stays readable */
@media (max-width: 420px) {
  .wl-form { flex-wrap: wrap; }
  .wl-form .field { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) { .devices i, .online.joined { animation: none !important; } }
