/* Hush. A minimal messenger look: the conventions of Signal and Telegram (own messages on the right in the accent
   color, others on the left, a group of one author's messages with joined corners, the time inside the bubble,
   actions next to the message), system font, light and dark themes from the same tokens. */

:root {
  --bg: #ffffff;
  --bg-chat: #eef1f5;
  --group-bg: #f2f3f7;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #111418;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2f6cf6;
  --accent-2: #e8eefe;
  --on-accent: #ffffff;
  --bubble-in: #ffffff;
  --bubble-out: #2f6cf6;
  --bubble-out-text: #ffffff;
  --chip-bg: rgba(255, 255, 255, .85);
  --danger: #e5484d;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --ok: #30a46c;
  --shadow-bubble: 0 1px 1px rgba(16, 24, 40, .08);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .22);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --bg-chat: #0b0e12;
    --group-bg: #0b0e12;
    --surface: #171b21;
    --surface-2: #222830;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --line: #2a3038;
    --accent: #5b8cff;
    --accent-2: #1c2842;
    --bubble-in: #1f242b;
    --bubble-out: #3b6ee6;
    --chip-bg: rgba(31, 36, 43, .9);
    --danger: #ff6b6b;
    --warn: #ffbf66;
    --warn-bg: #3a2a12;
    --shadow-bubble: none;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55);
  }
}

/* colors of avatars and nicks: the same room or person keeps its color */
.c0 { --c: #e5484d; } .c1 { --c: #ef6a1a; } .c2 { --c: #b88400; } .c3 { --c: #2f9e66; }
.c4 { --c: #0f9a8e; } .c5 { --c: #1a8cf0; } .c6 { --c: #7a5ce0; } .c7 { --c: #d6409f; }

/* ---- base ---- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--group-bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { height: 100%; }
[hidden] { display: none !important; }
.boot { padding: 24px 16px; color: var(--muted); }
h1, h2, p { margin: 0; }
p + p { margin-top: 8px; }
a { color: var(--accent); overflow-wrap: anywhere; }
.ic { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.primary, .tonal, .danger-fill, .btn, .filebtn, .banner button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
}
.primary { background: var(--accent); color: var(--on-accent); }
.tonal, .btn, .filebtn, .banner button { background: var(--accent-2); color: var(--accent); }
.danger-fill { background: var(--danger); color: #fff; }
.wide { width: 100%; }
.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.link { padding: 0; border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; }
button.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}
button.icon:hover { background: var(--surface-2); }

input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
input:focus-visible, textarea:focus-visible { outline: none; } /* the border shows the focus */
input::placeholder, textarea::placeholder { color: var(--muted); }
.pin { font-size: 22px; letter-spacing: .3em; text-align: center; }

/* ---- layout ---- */
.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: var(--group-bg);
}
@media (min-width: 761px) {
  .screen { border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
}
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: env(safe-area-inset-top) 8px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar .avatar { margin: 0 2px; }
.bar-title { flex: 1; min-width: 0; padding: 0 6px; }
.bar-title h1 { overflow: hidden; font-size: 17px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.bar-title.big h1 { padding-left: 8px; font-size: 24px; font-weight: 700; }
.sub { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px; scrollbar-width: thin; }
.content.plain { padding-bottom: 0; background: var(--surface); }
.pane { padding: 16px; }
.center { text-align: center; }
.hint { margin-top: 8px; color: var(--muted); font-size: 14px; }
.error { margin: 10px 16px; color: var(--danger); font-size: 14px; }
.error.in-card { margin: 0 16px 12px; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.row.pad { margin: 0; padding: 20px 16px 0; }
.row.pad > * { flex: 1; }
.note { margin: 16px; padding: 14px 16px; border-radius: 14px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.note button { margin-top: 10px; }
.hero { padding: 28px 24px 4px; text-align: center; }
.empty { padding: 48px 28px; color: var(--muted); text-align: center; }
.empty strong { color: var(--text); }
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--accent);
}
.empty-icon.ok { background: rgba(48, 164, 108, .15); color: var(--ok); }
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner button { min-height: 30px; margin-left: auto; padding: 0 12px; font-size: 14px; }

/* ---- settings-like sections ---- */
.section { margin: 22px 16px 0; }
.section-title { margin: 0 4px 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.section-foot { margin: 8px 4px 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.card { overflow: hidden; border-radius: 14px; background: var(--surface); }
.card > input { width: calc(100% - 24px); margin: 12px; }
.card > .seg { margin: 12px; }
.card-text { padding: 14px 16px; font-size: 15px; }
.card-text.muted { color: var(--muted); }
.card-text + .row-btn, .row-btn + .row-btn, .row-btn + .card-text { border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; padding: 12px; }
.inline-form input { flex: 1; min-width: 0; }
.row-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  text-align: left;
}
.row-btn:hover:not(:disabled) { background: var(--surface-2); }
.row-btn .ic { color: var(--accent); }
.row-label { flex: 1; }
.row-value { color: var(--muted); font-size: 15px; }
.row-chevron { display: flex; color: var(--muted); }
.row-btn.danger, .row-btn.danger .ic { color: var(--danger); }

/* segmented control (also for radio choices) */
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg > label, .seg > button {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.seg > .on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); font-weight: 600; }
.seg input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.seg label:focus-within { outline: 2px solid var(--accent); }
.seg.tabs { margin: 14px 16px 0; }

/* ---- home ---- */
.rooms { margin: 0; padding: 0; list-style: none; background: var(--surface); }
.room {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.room:hover { background: var(--surface-2); }
.room-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rooms li:last-child .room-main { border-bottom: 0; }
.room-top, .room-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.room-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.room-flag { display: inline-flex; flex: none; color: var(--muted); font-size: 13px; }
.room-time { flex: none; margin-left: auto; color: var(--muted); font-size: 13px; }
.room-last { flex: 1; overflow: hidden; color: var(--muted); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  flex: none;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
/* generated pictures (jdenticon): geometric patterns read best in a rounded square */
.avatar {
  display: block;
  flex: none;
  width: 52px;
  height: 52px;
  padding: 3px;
  border-radius: 15px;
  background: var(--surface-2);
}
.avatar.small { width: 38px; height: 38px; padding: 2px; border-radius: 11px; }
.avatar.tiny { width: 32px; height: 32px; padding: 2px; border-radius: 9px; }
.actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.actions button { flex: 1; }

/* ---- chat ---- */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-chat);
  scrollbar-width: thin;
  touch-action: manipulation; /* a double tap is ours (reply), not the browser's zoom */
}
.feed { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding: 8px 10px 14px; }
.day { position: sticky; top: 8px; z-index: 1; align-self: center; margin: 18px 0 8px; }
.day span, .system span {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 13px;
}
.system { align-self: center; margin: 8px 16px; text-align: center; }
.older { align-self: center; margin: 8px 0; text-align: center; }

/* one message: (the author's picture) + a column with the bubble, a failure note and reactions */
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 4px; } /* the whole width: a double click beside replies */
.msg.mine { justify-content: flex-end; }
.msg.single, .msg.first { margin-top: 14px; } /* another author or a pause: a clear gap */
.msg-av { flex: none; width: 32px; }
.msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(86%, 600px); }
.mine .msg-col { align-items: flex-end; }
.bubble {
  position: relative;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 18px;
  background: var(--bubble-in);
  box-shadow: var(--shadow-bubble);
  overflow-wrap: anywhere;
  -webkit-touch-callout: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mine .bubble { background: var(--bubble-out); color: var(--bubble-out-text); }
.msg.selected .bubble { box-shadow: 0 0 0 2px var(--accent); }
.msg.pending .bubble { opacity: .75; }
.msg.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow-bubble); } }

.nick { margin-bottom: 1px; color: var(--c); font-size: 13px; font-weight: 600; }
.text { white-space: pre-wrap; }
.text::after { content: ""; display: inline-block; width: 44px; } /* room for the time on the last line */
.mine .text::after { width: 60px; }
.text a { color: inherit; text-decoration: underline; }
.in .text a { color: var(--accent); }
.meta {
  position: absolute;
  right: 10px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}
.mine .meta { color: rgba(255, 255, 255, .8); }
.quote {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 140px;
  margin: 3px 0 5px;
  padding: 4px 8px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: rgba(127, 127, 127, .12);
  color: inherit;
  font-size: 13px;
  text-align: left;
}
.quote b { color: var(--accent); font-weight: 600; }
.quote span { max-width: 100%; overflow: hidden; opacity: .85; text-overflow: ellipsis; white-space: nowrap; }
.mine .quote { border-left-color: rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .16); }
.mine .quote b { color: #fff; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chip {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  font-size: 13px;
}
.chip.mine { border-color: var(--accent); background: var(--accent-2); color: var(--accent); }
.failed { margin-top: 3px; color: var(--danger); font-size: 12px; }
.failed .link { color: var(--danger); }

/* photos, voice, the viewer */
/* a photo sits in a thin frame of the bubble's color: it is clearly a picture, not a part of the screen */
.bubble.media { padding: 3px; }
.bubble.media .nick { margin: 3px 9px 4px; }
.bubble.media .quote { width: auto; margin: 3px 3px 4px; }
.bubble.media .meta { right: 9px; bottom: 9px; padding: 3px 6px; border-radius: 10px; background: rgba(0, 0, 0, .5); color: #fff; }
.photo { position: relative; width: min(64vw, 300px); overflow: hidden; border-radius: 15px; background: var(--line); }
.photo::after { position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); content: ""; pointer-events: none; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo img.preview { filter: blur(10px); transform: scale(1.1); cursor: default; }
.media-note { position: absolute; right: 6px; bottom: 6px; left: 6px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; text-align: center; }
.bubble.audio { padding: 8px 12px 18px 8px; }
.voice { min-width: 250px; }
.player { display: flex; align-items: center; gap: 10px; }
.player audio { display: none; }
.speed {
  flex: none;
  min-width: 38px;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 13px;
  background: rgba(127, 127, 127, .18);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
}
.mine .speed { background: rgba(255, 255, 255, .22); }
.play {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.mine .play { background: rgba(255, 255, 255, .95); color: var(--bubble-out); }
.track { position: relative; flex: 1; min-width: 90px; height: 22px; cursor: pointer; }
.track::before, .track-fill { position: absolute; top: 9px; left: 0; height: 4px; border-radius: 2px; content: ""; }
.track::before { right: 0; background: rgba(127, 127, 127, .3); }
.mine .track::before { background: rgba(255, 255, 255, .35); }
.track-fill { width: 0; background: var(--accent); }
.mine .track-fill { background: #fff; }
.voice-dur { min-width: 34px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }
.voice .media-note { position: static; margin: 4px 0 0; padding: 0; background: none; color: inherit; text-align: left; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .55);
  animation: fade .15s;
}
.viewer-box {
  position: relative;
  max-width: min(100%, 960px);
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  animation: pop .15s ease-out;
}
.viewer-box img { display: block; cursor: zoom-out; max-width: min(calc(100vw - 48px), 960px); max-height: calc(100vh - 48px); object-fit: contain; }
.viewer-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
}
.tool:hover { background: rgba(0, 0, 0, .75); }

.to-bottom {
  position: absolute;
  right: 14px;
  bottom: 86px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}
.closed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.closed button { margin-left: auto; }

/* the input line */
.composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.composer .error { margin: 0 8px 6px; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 16px;
  border-radius: 21px;
  line-height: 1.35;
  resize: none;
}
.attach, .send {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
}
.attach { color: var(--muted); cursor: pointer; }
.attach:hover { background: var(--surface-2); }
.attach input { display: none; }
.attach.busy { opacity: .5; }
.send { background: var(--accent); color: var(--on-accent); }
.send.idle { background: transparent; color: var(--muted); }
.send.idle:hover { background: var(--surface-2); }
.replybar { display: flex; align-items: center; gap: 10px; padding: 2px 4px 8px 10px; color: var(--accent); }
.replytext { display: flex; flex: 1; flex-direction: column; min-width: 0; padding-left: 8px; border-left: 3px solid var(--accent); font-size: 13px; }
.replytext span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.replybar button.icon { width: 32px; height: 32px; color: var(--muted); }
.rec { align-items: center; }
/* recording a voice message: the time, the limit, then cancel / stop / send; after "Стоп" a player to listen first */
.rec-line { display: flex; align-items: center; gap: 8px; padding: 2px 8px 8px; font-variant-numeric: tabular-nums; }
.rec-time { font-weight: 600; }
.rec-max { color: var(--muted); }
.rec-warn { margin-left: auto; color: var(--danger); font-size: 13px; font-weight: 600; }
.rec-note { padding: 2px 8px 8px; color: var(--warn); font-size: 13px; }
.stop { flex: 1; min-height: 42px; }
.rec-preview { flex: 1; min-width: 0; padding: 4px 10px 4px 4px; border-radius: 21px; background: var(--surface-2); }
.rec-preview .play { width: 34px; height: 34px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.dot.still { animation: none; opacity: .5; }
@keyframes blink { 50% { opacity: .25; } }
.counter { margin: 4px 8px 0; color: var(--muted); font-size: 12px; text-align: right; }
.counter.over { color: var(--danger); }

/* ---- a menu next to a message or a button ---- */
.pop-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .12); }
.pop {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 230px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-pop), 0 0 0 1px var(--line);
  visibility: hidden;
}
.pop.placed { visibility: visible; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.react-row { display: flex; gap: 2px; margin-bottom: 4px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); }
.emoji { flex: 1; min-width: 40px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; font-size: 24px; }
.emoji:hover { background: var(--surface-2); }
.emoji.on { background: var(--accent-2); }
.pop-menu { display: flex; flex-direction: column; }
.pop-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 15.5px;
  text-align: left;
}
.pop-menu button:hover { background: var(--surface-2); }
.pop-menu .ic { color: var(--muted); }
.pop-menu .danger, .pop-menu .danger .ic { color: var(--danger); }
.pop-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---- dialogs: a sheet from the bottom on a phone, a card in the middle on a wide screen ---- */
.backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .4); animation: fade .15s; }
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92%;
  overflow-y: auto;
  padding: 6px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  animation: up .2s ease-out;
}
.grabber { width: 36px; height: 5px; margin: 4px auto 6px; border-radius: 3px; background: var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h2 { font-size: 18px; }
.sheet .hint { margin: 10px 0; }
@media (min-width: 600px) {
  .backdrop { align-items: center; }
  .sheet { max-width: 420px; padding-bottom: 20px; border-radius: 20px; }
  .grabber { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: .6; transform: translateY(24px); } }

/* ---- QR, camera, add device ---- */
.qr-wrap { width: fit-content; margin: 8px auto; padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.qr { display: block; width: min(64vw, 260px); height: auto; }
.link-field { margin-top: 8px; font-size: 13px; }
.countdown { margin-top: 8px; font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: center; }
.scan-frame { max-width: 420px; margin: 0 auto; overflow: hidden; border-radius: 20px; background: #000; aspect-ratio: 1; }
.scanner { display: block; width: 100%; height: 100%; object-fit: cover; }
.filebtn { margin-top: 8px; cursor: pointer; }
.filebtn input { display: none; }

/* the first start */
.welcome { display: flex; flex-direction: column; justify-content: center; }
.welcome h1 { margin-bottom: 8px; font-size: 22px; }
