:root {
  color-scheme: light;
  --bg: #fff8f4;
  --card: #ffffff;
  --primary: #ff6b8a;
  --primary-soft: #ffe1e8;
  --text-main: #2f2a2a;
  --text-sub: #8f7f7f;
  --border: rgba(255, 107, 138, 0.16);
  --radius-card: 20px;
  --radius-chip: 999px;
  --shadow-card: 0 8px 24px rgba(255, 107, 138, 0.10);
  --surface: var(--card);
  --surface-2: var(--primary-soft);
  --ink: var(--text-main);
  --muted: var(--text-sub);
  --line: var(--border);
  --accent: var(--primary);
  --accent-2: #ffc07a;
  --mint: #4f8a8b;
  --violet: #8e6fc6;
  --shadow: var(--shadow-card);
  --radius: var(--radius-card);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 225, 232, 0.78), transparent 32%),
    linear-gradient(180deg, #fff8f4 0%, #fff4ef 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img,
video {
  max-width: 100%;
  display: block;
}

.shell {
  min-height: 100vh;
  padding: 14px 14px calc(82px + env(safe-area-inset-bottom));
}

.login {
  min-height: 100vh;
  display: grid;
  align-content: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 247, 244, 0.38), rgba(255, 247, 244, 0.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='1200' viewBox='0 0 900 1200'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%23f4a08b'/%3E%3Cstop offset='0.55' stop-color='%23f8d7cc'/%3E%3Cstop offset='1' stop-color='%239ad0c9'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='900' height='1200'/%3E%3Cpath d='M0 790 C210 700 320 910 510 800 C650 720 720 610 900 660 L900 1200 L0 1200 Z' fill='%23fff7f4' fill-opacity='.76'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.login-panel {
  width: min(430px, 100%);
  margin: 0 auto;
}

.brand-title {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.12;
}

.brand-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  min-height: 44px;
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 78px;
}

.tag-editor {
  padding: 12px;
  border: 1px dashed rgba(255, 107, 138, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.tag-list,
.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill,
.tag-suggestion,
.tag-empty {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-chip);
  font-size: 13px;
}

.tag-pill {
  gap: 6px;
  padding: 0 7px 0 11px;
  background: var(--primary-soft);
  color: var(--accent);
  font-weight: 700;
}

.tag-pill button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  line-height: 1;
}

.tag-empty {
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.tag-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tag-input-row .btn {
  min-width: 76px;
}

.tag-suggestion {
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.tag-suggestion.active {
  border-color: var(--accent);
  background: var(--primary-soft);
  color: var(--accent);
}

.tag-editor small {
  color: var(--muted);
  line-height: 1.5;
}

.btn {
  min-height: 42px;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
}

.btn.secondary {
  background: var(--primary-soft);
  color: var(--accent);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
  border: 1px solid var(--line);
}

.btn.warn {
  background: #b94058;
}

.eyebrow {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  width: fit-content;
  border-radius: var(--radius-chip);
  padding: 0 10px;
  background: rgba(255, 225, 232, 0.86);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.top-card {
  position: relative;
  overflow: hidden;
  min-height: 278px;
  padding: 22px 18px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(47, 42, 42, 0.06), rgba(47, 42, 42, 0.30)),
    radial-gradient(52% 62% at 62% 4%, rgba(255, 252, 220, 0.96), transparent 56%),
    radial-gradient(42% 36% at 70% 48%, rgba(255, 209, 141, 0.7), transparent 62%),
    radial-gradient(58% 54% at 18% 22%, rgba(246, 123, 163, 0.74), transparent 68%),
    radial-gradient(50% 54% at 88% 28%, rgba(255, 145, 178, 0.56), transparent 65%),
    radial-gradient(90% 38% at 55% 100%, rgba(118, 169, 151, 0.5), transparent 62%),
    linear-gradient(135deg, #f5a7be 0%, #ffc9be 46%, #ffe8c4 72%, #d9eadc 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  align-content: end;
  gap: 16px;
}

.top-card::before,
.top-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.top-card::before {
  background:
    linear-gradient(104deg, transparent 0 47%, rgba(255, 255, 236, 0.34) 48% 51%, transparent 52%),
    linear-gradient(78deg, transparent 0 57%, rgba(255, 255, 236, 0.26) 58% 60%, transparent 61%),
    radial-gradient(circle at 57% 1%, rgba(255, 255, 240, 0.92) 0 6px, transparent 7px),
    radial-gradient(circle at 66% 31%, rgba(255, 255, 255, 0.68) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 19%, rgba(255, 176, 203, 0.72) 0 9px, transparent 10px),
    radial-gradient(circle at 83% 16%, rgba(186, 155, 221, 0.52) 0 7px, transparent 8px),
    radial-gradient(circle at 89% 32%, rgba(255, 236, 169, 0.72) 0 10px, transparent 11px),
    radial-gradient(circle at 72% 45%, rgba(255, 141, 179, 0.48) 0 12px, transparent 13px),
    radial-gradient(circle at 94% 71%, rgba(255, 178, 200, 0.82) 0 14px, transparent 15px),
    radial-gradient(circle at 97% 78%, rgba(255, 235, 169, 0.68) 0 7px, transparent 8px),
    radial-gradient(circle at 7% 86%, rgba(255, 188, 206, 0.86) 0 16px, transparent 17px),
    radial-gradient(circle at 14% 90%, rgba(255, 233, 171, 0.52) 0 10px, transparent 11px),
    repeating-linear-gradient(169deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 22px);
  filter: blur(0.35px);
  mix-blend-mode: screen;
  opacity: 0.94;
}

.top-card::after {
  background:
    linear-gradient(166deg, transparent 8%, rgba(255, 255, 255, 0.18) 33%, transparent 48%),
    radial-gradient(120% 30% at 50% 100%, rgba(255, 144, 176, 0.68), transparent 58%),
    radial-gradient(72% 30% at 15% 94%, rgba(255, 219, 155, 0.38), transparent 62%),
    radial-gradient(84% 38% at 84% 99%, rgba(67, 132, 116, 0.40), transparent 64%),
    radial-gradient(72% 26% at 92% 74%, rgba(255, 245, 199, 0.28), transparent 70%),
    linear-gradient(0deg, rgba(28, 26, 32, 0.24), transparent 48%);
}

.top-card > * {
  position: relative;
  z-index: 1;
}

.top-card .profile-name,
.top-card .profile-bio,
.top-card .stat {
  text-shadow: 0 1px 14px rgba(29, 20, 25, 0.38);
}

.avatars {
  display: flex;
  align-items: center;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border: 3px solid rgba(255, 255, 255, 0.8);
  font-weight: 800;
  overflow: hidden;
}

.avatar + .avatar {
  margin-left: -14px;
  background: var(--mint);
}

.profile-name {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.profile-bio {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.privacy-line {
  display: inline-flex;
  width: fit-content;
  margin: 10px 0 0;
  min-height: 28px;
  align-items: center;
  border-radius: var(--radius-chip);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stat {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  padding: 10px 8px;
  backdrop-filter: blur(7px);
}

.stat strong {
  display: block;
  font-size: 18px;
}

.stat span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-size: 18px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chips::-webkit-scrollbar,
.template-strip::-webkit-scrollbar,
.media-strip::-webkit-scrollbar {
  display: none;
}

.home-album {
  margin-top: 14px;
}

.profile-tags {
  margin-bottom: 10px;
}

.album-head {
  align-items: flex-end;
}

.album-tabs {
  margin: 0 0 12px;
}

.album-waterfall {
  column-count: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  margin-top: 4px;
}

.album-waterfall .memory-card {
  margin-bottom: 0;
}

.chip {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
}

.chip.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.waterfall {
  column-count: 2;
  column-gap: 12px;
}

.waterfall.album-waterfall {
  column-count: auto;
}

.memory-card,
.plain-card {
  break-inside: avoid;
  overflow: hidden;
  margin: 0 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-click {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.diary-card,
.plan-card {
  position: relative;
  display: grid;
  gap: 10px;
}

.diary-card::before,
.plan-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--primary), var(--accent-2));
  opacity: 0.52;
}

.diary-card h3,
.plan-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.diary-card p,
.plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.diary-compose,
.plan-compose {
  background:
    linear-gradient(135deg, rgba(255, 225, 232, 0.5), rgba(255, 255, 255, 0.9)),
    var(--surface);
}

.diary-content {
  white-space: normal;
  line-height: 1.9;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 244, 0.76);
}

.plan-card.done {
  opacity: 0.78;
}

.plan-card.done h3 {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 107, 138, 0.5);
}

.memory-card {
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.memory-card:active {
  transform: scale(0.985);
  box-shadow: 0 6px 18px rgba(255, 107, 138, 0.08);
}

.memory-card img,
.memory-card video {
  width: 100%;
  min-height: 128px;
  object-fit: cover;
  background: var(--surface-2);
}

.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}

.media-frame video {
  display: block;
}

.video-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(48, 43, 49, 0.76);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.memory-zone {
  position: relative;
}

.memory-zone .section-head {
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.memory-zone-bob .section-head {
  border-left-color: var(--mint);
}

.memory-zone-spring .section-head {
  border-left-color: var(--violet);
}

.card-body {
  padding: 11px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: start;
}

.card-title-row .card-title {
  margin-bottom: 6px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  display: grid;
  place-items: center;
  line-height: 1;
  font-weight: 800;
}

.icon-btn:active {
  transform: scale(0.96);
}

.meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.tag-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(217, 93, 119, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 12px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-strip,
.media-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.template {
  flex: 0 0 132px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  text-align: left;
}

.template.active {
  outline: 2px solid var(--accent);
}

.media-pick {
  position: relative;
  flex: 0 0 92px;
  height: 118px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.media-pick.compact {
  flex-basis: 78px;
  height: 96px;
}

.media-pick.active {
  border-color: var(--accent);
}

.media-pick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-pick span {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  font-weight: 800;
}

.ai-plan {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(217, 93, 119, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(217, 93, 119, 0.08), rgba(79, 138, 139, 0.08));
  padding: 12px;
}

.ai-plan p {
  margin: 0;
  line-height: 1.6;
}

.ai-plan-box {
  display: grid;
  gap: 4px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.warn-text {
  color: #b94058;
}

.creation-entry-card {
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 225, 232, 0.94), transparent 38%),
    radial-gradient(circle at 88% 20%, rgba(255, 192, 122, 0.28), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 244, 0.86));
}

.creation-entry-card p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.creation-entry-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.creation-entry-stats span {
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 12px;
}

.creation-entry-stats strong {
  color: var(--ink);
  font-size: 18px;
}

.secondary-page-head {
  display: grid;
  gap: 12px;
  padding-bottom: 4px;
}

.secondary-page-head .btn {
  width: fit-content;
}

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 8px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 107, 138, 0.12);
  border-radius: 24px 24px 22px 22px;
  box-shadow: 0 10px 30px rgba(255, 107, 138, 0.13);
  backdrop-filter: blur(20px);
}

.nav-btn {
  min-width: 0;
  min-height: 58px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.nav-btn:active {
  transform: scale(0.96);
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(143, 127, 127, 0.92);
  background: rgba(255, 248, 244, 0.46);
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.active {
  color: var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 225, 232, 0.78), rgba(255, 248, 244, 0.58));
  box-shadow: inset 0 0 0 1px rgba(255, 107, 138, 0.10);
}

.nav-btn.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #ff91a8);
  box-shadow: 0 8px 18px rgba(255, 107, 138, 0.26);
}

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 9;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 28px;
}

.creation-gallery {
  display: grid;
  gap: 14px;
}

.creation-card {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.creation-preview-button {
  width: 100%;
  padding: 0;
  text-align: left;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.creation-preview-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, rgba(255, 107, 138, 0.12), rgba(255, 192, 122, 0.18));
}

.creation-preview-media.is-video {
  aspect-ratio: 9 / 16;
  max-height: 420px;
}

.creation-preview-media img,
.creation-detail-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(255, 241, 236, 0.76);
}

.creation-preview-media .cover-fallback {
  width: 100%;
  height: 100%;
}

.creation-preview-media img {
  object-fit: cover;
}

.creation-preview-media span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: var(--radius-chip);
  padding: 5px 10px;
  background: rgba(47, 42, 42, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.creation-detail-panel {
  display: grid;
  gap: 12px;
  background: var(--bg);
}

.creation-detail-stage {
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(47, 42, 42, 0.08);
  border: 1px solid var(--line);
}

.creation-detail-media {
  max-height: 68vh;
}

video.creation-detail-media {
  background: #000;
}

.creation-detail-info {
  display: grid;
  gap: 10px;
}

.creation-sources {
  display: grid;
  gap: 8px;
}

.source-thumb {
  flex: 0 0 62px;
  width: 62px;
  height: 78px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.source-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.status.done {
  background: rgba(79, 138, 139, 0.14);
  color: var(--mint);
}

.status.failed {
  background: rgba(185, 64, 88, 0.12);
  color: #b94058;
}

.status.processing,
.status.queued {
  background: rgba(239, 149, 95, 0.15);
  color: #bd6530;
}

.timeline-month {
  border-left: 2px solid var(--line);
  padding-left: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  max-width: min(340px, calc(100vw - 28px));
  background: rgba(48, 43, 49, 0.94);
  color: #fff;
  border-radius: var(--radius);
  padding: 10px 13px;
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(28, 22, 27, 0.45);
  display: grid;
  align-items: end;
}

.modal-panel {
  max-height: 88vh;
  overflow: auto;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
}

.dialog-panel {
  margin: 0 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.action-sheet {
  display: grid;
  gap: 10px;
  background: var(--bg);
}

.sheet-action {
  min-height: 48px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
  box-shadow: var(--shadow-card);
}

.sheet-action.danger {
  color: #b94058;
}

.edit-media-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.edit-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edit-media-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.edit-media-item.cover {
  outline: 2px solid var(--accent);
}

.edit-media-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-2);
}

.cover-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(48, 43, 49, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.edit-media-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.mini-btn {
  min-height: 30px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.mini-btn.primary {
  grid-column: 1 / -1;
  background: rgba(217, 93, 119, 0.14);
  color: var(--accent);
}

.mini-btn.danger {
  color: #b94058;
}

.add-media-form {
  margin-top: 12px;
}

.compact-head {
  margin-top: 14px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preview-grid img,
.preview-grid video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.empty {
  position: relative;
  padding: 26px 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 225, 232, 0.74), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 248, 244, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.state-empty {
  display: grid;
  gap: 8px;
  min-height: 96px;
  align-content: center;
}

.state-empty strong {
  color: var(--ink);
  font-size: 15px;
}

.state-empty span {
  color: var(--muted);
  font-size: 13px;
}

.upload-result .plain-card {
  background:
    linear-gradient(135deg, rgba(255, 107, 138, 0.13), rgba(255, 255, 255, 0.92)),
    var(--surface);
}

.upload-failure .plain-card,
.state-failure {
  border-color: rgba(185, 64, 88, 0.22);
  background:
    linear-gradient(135deg, rgba(185, 64, 88, 0.08), rgba(255, 255, 255, 0.92)),
    var(--surface);
}

.form-divider {
  margin-top: 2px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-chip);
  background: var(--primary-soft);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffc07a);
}

.task-copy {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
}

.task-copy strong {
  color: var(--ink);
  font-size: 14px;
}

.task-copy span {
  color: var(--muted);
  font-size: 12px;
}

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.privacy-item {
  display: grid;
  gap: 5px;
  min-height: 76px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  box-shadow: 0 6px 16px rgba(255, 107, 138, 0.06);
}

.privacy-item strong {
  color: var(--ink);
}

.privacy-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.permission-panel .btn {
  width: 100%;
}

.permission-list {
  display: grid;
  gap: 10px;
}

.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 12px;
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  color: var(--ink);
  font-size: 14px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.switch-row input {
  appearance: none;
  width: 50px;
  height: 30px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--line);
  background: #eadfdb;
  position: relative;
  transition: background 0.18s ease;
}

.switch-row input::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(47, 42, 42, 0.16);
  transition: transform 0.18s ease;
}

.switch-row input:checked {
  background: var(--accent);
}

.switch-row input:checked::after {
  transform: translateX(20px);
}

.switch-row input:disabled {
  opacity: 0.5;
}

.backup-list,
.recovery-list {
  display: grid;
  gap: 8px;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.backup-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recovery-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

.recovery-item strong {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.recovery-item .btn {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

body.dark {
  color-scheme: dark;
  --bg: #171416;
  --surface: #221e22;
  --surface-2: #2f282e;
  --ink: #f8eff2;
  --muted: #c4b7bd;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ee7891;
  --accent-2: #f0a267;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.26);
}

@media (min-width: 760px) {
  .shell {
    width: min(760px, 100%);
    margin: 0 auto;
  }

  .waterfall {
    column-count: 3;
  }

  .album-waterfall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creation-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
