* {
  box-sizing: border-box;
}
html {
  font:
    16px/1.45 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'PingFang SC',
    sans-serif;
  color: #172234;
  background: #f5f7fa;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #6c9af5;
  outline-offset: 2px;
}
a {
  color: #2563eb;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.6rem;
  line-height: 1.22;
  letter-spacing: -0.04em;
}
h2 {
  font-size: 1.2rem;
  line-height: 1.3;
}
h3 {
  font-size: 1rem;
}
small,
.muted,
time {
  color: #637084;
  font-size: 0.82rem;
}
.line-icon {
  width: 1.3em;
  height: 1.3em;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#shell,
.gate {
  background: white;
  max-width: 900px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: auto;
}
header,
.bar,
.row,
.actions,
.card-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
header {
  justify-content: space-between;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem 0.75rem;
  border-bottom: 1px solid #e5e9ef;
}
#page {
  padding: 0.8rem 0.85rem calc(6.2rem + env(safe-area-inset-bottom));
}
.grow {
  flex: 1;
  min-width: 0;
}
.actions {
  flex-wrap: wrap;
}
.icon-btn,
.compact,
.primary,
.secondary,
.pill,
.danger {
  min-height: 42px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
}
.icon-btn {
  width: 42px;
  padding: 0;
}
.primary {
  background: #2563eb;
  color: white;
}
.secondary,
.pill {
  background: #f1f4f8;
}
.compact {
  color: #245dd3;
}
.danger {
  color: #bc263c;
}
.pill {
  font-size: 0.88rem;
  white-space: nowrap;
  border-radius: 30px;
}
.pill.active {
  background: #2563eb;
  color: white;
}
.bar {
  justify-content: space-between;
}
.scroll-row {
  display: flex;
  gap: 0.45rem;
  overflow: auto;
  align-items: center;
  margin: 0.65rem 0;
}
.search,
input:not([type='file']):not([type='checkbox']),
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d9dfe7;
  border-radius: 10px;
  padding: 0.65rem;
  background: #fff;
  font-size: 16px;
}
.search {
  background: #f3f5f8;
  border: 0;
}
label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}
.stack {
  display: grid;
  gap: 0.85rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}
.day {
  grid-column: 1/-1;
  padding: 0.85rem 0.1rem 0.4rem;
}
.tile {
  position: relative;
  overflow: hidden;
  padding: 0;
  text-align: left;
  background: #eef1f5;
  border-radius: 4px;
}
.tile img,
.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile {
  aspect-ratio: 1.17;
}
.tick {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid white;
  background: #15223966;
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.tick.on {
  background: #2563eb;
}
.album-grid,
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.album-card {
  text-align: left;
  padding: 0;
  overflow: hidden;
}
.album-card .cover,
.empty-cover {
  aspect-ratio: 1.45;
  height: auto;
  border-radius: 12px;
  background: #eff3f8;
}
.empty-cover {
  display: grid;
  place-items: center;
  color: #91a0b5;
}
.hero {
  max-height: 36vh;
  border-radius: 12px;
}
.album-card h3 {
  margin: 0.4rem 0 0.1rem;
}
.group,
.thread,
.panel {
  border: 1px solid #e0e5ec;
  border-radius: 13px;
  overflow: hidden;
}
.group > button,
.menu-row {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  min-height: 48px;
}
.group > * + * {
  border-top: 1px solid #ecf0f4;
}
.thread,
.panel {
  padding: 0.8rem;
}
.thread .cover {
  width: 78px;
  height: 78px;
  flex: none;
  border-radius: 8px;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snippet {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
}
.badge {
  font-size: 0.78rem;
  color: #2563eb;
  background: #eaf1ff;
  border-radius: 10px;
  padding: 0.2rem 0.5rem;
}
.avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #e6eeff;
  color: #2358ac;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}
.avatar img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.avatar.large {
  width: 4rem;
  height: 4rem;
  font-size: 1.4rem;
}
.gate {
  padding: max(10vh, 2rem) 1.4rem;
  max-width: 460px;
}
.gate h1 {
  font-size: 2.15rem;
  margin-bottom: 1.7rem;
}
.gate .choices button {
  padding: 0.85rem;
  background: #f2f5fa;
  border-radius: 10px;
}
.empty {
  text-align: center;
  color: #657388;
  padding: 2rem 1rem;
}
nav {
  position: fixed;
  z-index: 3;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 900px);
  display: flex;
  background: white;
  border-top: 1px solid #e0e5ec;
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  display: grid;
  place-items: center;
  gap: 0.12rem;
  flex: 1;
  min-height: 56px;
  color: #657388;
  font-size: 0.74rem;
}
nav .active {
  color: #2563eb;
  font-weight: 700;
}
dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(94vw, 520px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  color: inherit;
}
dialog::backdrop {
  background: #111c2e75;
}
.dialog-head {
  position: sticky;
  z-index: 1;
  top: 0;
  background: inherit;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e4e9ee;
}
.dialog-body {
  padding: 1rem;
  background: white;
}
.viewer {
  background: #101317;
  color: white;
  width: min(100vw, 960px);
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100vw;
  border-radius: 0;
}
.viewer[open] {
  display: flex;
  flex-direction: column;
}
.viewer .dialog-head {
  padding-top: max(0.6rem, env(safe-area-inset-top));
  border: 0;
}
.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.stage img {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
}
.original {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #161c24ba;
  color: white;
}
.viewer-foot {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem calc(0.7rem + env(safe-area-inset-bottom));
}
.viewer-foot .secondary {
  background: #28313c;
  color: white;
}
.sheet .dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 73dvh;
}
.comments {
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.comment {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #e8ecf0;
}
.comment p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.composer {
  border-top: 1px solid #e3e7ee;
  padding-top: 0.6rem;
}
.voice {
  background: #e6efff;
  color: #2454a7;
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
}
.more {
  width: 100%;
  margin: 0.5rem 0;
}
.sticky-actions {
  position: sticky;
  bottom: calc(58px + env(safe-area-inset-bottom));
  background: white;
  border: 1px solid #e0e5ed;
  padding: 0.4rem;
  border-radius: 12px;
  justify-content: space-around;
  z-index: 2;
}
#feedback:not(:empty) {
  position: fixed;
  z-index: 999;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90vw;
  background: #1d293b;
  color: white;
  padding: 0.55rem 1rem;
  border-radius: 12px;
}
.notice {
  color: #ac2838;
  overflow-wrap: anywhere;
}
.file-input {
  display: none;
}
progress {
  width: 100%;
  accent-color: #2563eb;
}
.record {
  border: 1px solid #dde3eb;
  padding: 0.7rem;
  border-radius: 10px;
}
body:has(dialog[open]) {
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
.pull-zone {
  position: relative;
}
body:has(#page > .pull-zone) {
  overscroll-behavior-y: contain;
}
.pull-indicator {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: white;
  color: #2563eb;
  box-shadow: 0 2px 8px #17223424;
  pointer-events: none;
}
.pull-indicator.refreshing .line-icon {
  animation: pull-spin 0.8s linear infinite;
}
@keyframes pull-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .pull-indicator.refreshing .line-icon { animation: none; }
}
@media (min-width: 700px) {
  #page {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .album-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tile {
    aspect-ratio: 1.2;
  }
  .gate {
    margin-top: 4vh;
    border-radius: 20px;
    min-height: 80vh;
  }
}
