:root {
  color-scheme: light;
  --paper: #eef2f1;
  --white: #fff;
  --ink: #152c3a;
  --muted: #496069;
  --line: #b9c8c9;
  --accent: #fbd365;
  font-family: 'Noto Sans CJK SC', 'Microsoft YaHei UI', 'PingFang SC', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: clamp(1rem, 6vw, 5rem) 1rem 2rem; }
main { max-width: 66rem; margin: 0 auto; }
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, .file-button, .download { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible, .file-button:focus-within {
  outline: 3px solid #28738c;
  outline-offset: 3px;
}

.masthead {
  display: flex;
  align-items: center;
  gap: clamp(.6rem, 2vw, 1.25rem);
  padding: 1.05rem clamp(1rem, 3.6vw, 2.5rem);
  background: var(--ink);
  color: var(--white);
  border-radius: 1rem 1rem 0 0;
}
h1 { font-size: clamp(1.45rem, 5vw, 2.7rem); font-weight: 750; letter-spacing: .035em; }
.masthead button { margin-left: auto; color: var(--white); border-color: #8da2aa; }
.mark { position: relative; width: 2.5rem; height: 2.2rem; flex: 0 0 auto; }
.mark i {
  position: absolute;
  height: 1.24rem;
  width: 1.7rem;
  border: 2px solid var(--accent);
  border-radius: .2rem;
  transform: rotate(-12deg);
}
.mark i:first-child { left: .12rem; top: .19rem; }
.mark i:last-child { top: .75rem; left: .62rem; background: var(--accent); }

#status {
  min-height: 3.1rem;
  display: flex;
  align-items: center;
  padding: .65rem clamp(1rem, 3.6vw, 2.5rem);
  font-size: .9rem;
  background: #e1e9e9;
  border: 1px solid var(--line);
}
#status.error, #device-status.error { color: #922e24; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 1rem 1rem;
  overflow: hidden;
}
.outbox, .inbox, .onboarding { padding: clamp(1.1rem, 4vw, 2.5rem); }
h2 { font-size: 1.4rem; font-weight: 720; }
.outbox h2, .inbox .section-heading { margin-bottom: 1.35rem; }
.inbox { background: #f6f8f7; border-left: 1px solid var(--line); }
.section-heading, .dialog-heading, .send-actions, .attachment, #devices-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
#inbox-count {
  font-family: Bahnschrift, 'DIN Alternate', sans-serif;
  font-size: 1.15rem;
  padding: .18rem .6rem;
  min-width: 2rem;
  text-align: center;
  border-bottom: 2px solid #c28d16;
}
label { display: block; font-size: .9rem; font-weight: 620; margin-bottom: .4rem; }
select, input:not([type=file]), textarea {
  display: block;
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid #91a7ad;
  border-radius: .32rem;
  background: var(--white);
  font-size: 1rem;
}
select, input:not([type=file]) { margin-bottom: 1.2rem; min-height: 2.75rem; }
textarea {
  resize: vertical;
  min-height: 10rem;
  line-height: 1.55;
  background: #fbfcfc;
}
textarea::placeholder, input::placeholder { color: var(--muted); }
.send-actions { margin-top: .95rem; }
.primary, .quiet, .file-button, .download {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  padding: .45rem .9rem;
  border: 1px solid #91a7ad;
  border-radius: .35rem;
  background: transparent;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 650;
  white-space: nowrap;
}
.primary { background: var(--accent); color: var(--ink); border-color: #8d681d; padding-inline: 1.35rem; }
.primary:hover:not(:disabled) { background: #ffdf83; }
.quiet:hover, .download:hover, .file-button:hover { box-shadow: inset 0 0 0 1px currentColor; }
.file-button { position: relative; margin: 0; }
.file-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.attachment { margin-top: .7rem; padding: .45rem .6rem; background: var(--paper); }
.attachment span, #devices-list span { overflow-wrap: anywhere; min-width: 0; }
#empty, #onboarding-hint, #invite p { color: var(--muted); line-height: 1.65; }
#empty { padding-block: .85rem; border-block: 1px dashed var(--line); }
ul { list-style: none; margin: 0; padding: 0; }
.received { padding: .75rem 0 1rem; border-top: 1px solid var(--line); }
.received .meta, footer { font-size: .85rem; color: var(--muted); }
.received textarea { margin-block: .55rem; min-height: 0; }
.received .filename { font-weight: 650; overflow-wrap: anywhere; margin: .6rem 0; }
.item-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
footer { padding: .85rem .2rem; }
.onboarding {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 1rem 1rem;
}
.onboarding p { margin: .6rem 0 1.4rem; }
.onboarding form { max-width: 25rem; }
dialog {
  max-width: min(calc(100vw - 2rem), 29rem);
  max-height: calc(100dvh - 2rem);
  width: 100%;
  padding: 1.25rem;
  border: 1px solid var(--ink);
  border-radius: .65rem;
  color: var(--ink);
}
dialog::backdrop { background: #152c3a99; }
#devices-list { margin-block: 1rem; border-top: 1px solid var(--line); }
#devices-list li { min-height: 3.25rem; border-bottom: 1px solid var(--line); padding-block: .35rem; }
#invite { margin-top: 1rem; }
#qr { display: block; max-width: 100%; height: auto; margin: .55rem 0; }
#device-status:not(:empty) { margin-top: .6rem; }
@media (max-width: 43rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .inbox { border-left: 0; border-top: 1px solid var(--line); }
}
