:root {
  color-scheme: light;
  --ink: #24312e;
  --muted: #6c776f;
  --line: #dfe5de;
  --paper: #f6f4ef;
  --panel: #ffffff;
  --green: #367967;
  --green-dark: #245848;
  --coral: #db6d68;
  --sun: #e6b85b;
  --blue: #587f91;
  --pink: #c9798b;
  --cream: #fffaf2;
  --shadow: 0 18px 48px rgba(45, 55, 49, 0.12);
  --soft-shadow: 0 10px 28px rgba(45, 55, 49, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(219, 109, 104, 0.14), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(54, 121, 103, 0.13), transparent 32%),
    linear-gradient(180deg, #fffaf3 0%, #f4f0e8 48%, #eef5f1 100%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(292px, 368px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
}

.side-panel,
.main-panel {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(223, 229, 222, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.side-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  padding: 20px;
  border-radius: 8px;
}

.main-panel {
  min-height: calc(100vh - 48px);
  border-radius: 8px;
  overflow: hidden;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(223, 229, 222, 0.76);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--coral));
  font-weight: 800;
  letter-spacing: 0;
  overflow: hidden;
}

.brand-mark.has-image {
  background: #eef4f1;
}

.brand-mark img,
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.32rem;
  line-height: 1.25;
}

.brand-lockup p,
.eyebrow,
.city-list-block h2,
.composer h2,
.muted-text {
  color: var(--muted);
}

.brand-lockup p {
  margin-top: 4px;
  font-size: 0.84rem;
}

.hero-photo-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  grid-template-rows: 140px 140px;
  gap: 6px;
  margin: 18px 0;
  padding: 7px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(54, 121, 103, 0.95), rgba(219, 109, 104, 0.95));
  box-shadow: var(--soft-shadow);
  clip-path: polygon(3% 0, 100% 5%, 97% 100%, 0 94%);
}

.anniversary-panel {
  margin-top: 16px;
  padding: 9px;
  border: 1px solid rgba(223, 229, 222, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(45, 55, 49, 0.06);
}

.section-heading {
  margin-bottom: 7px;
}

.section-heading h2 {
  margin-top: 1px;
  font-size: 0.94rem;
}

.eyebrow {
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.together-clock {
  display: grid;
  gap: 1px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.together-clock span,
.together-clock em {
  font-style: normal;
  opacity: 0.86;
}

.together-clock strong {
  font-size: 1.04rem;
  line-height: 1.22;
}

.together-clock em {
  font-size: 0.76rem;
  line-height: 1.35;
}

.together-clock small {
  font-size: 0.68rem;
  line-height: 1.32;
}

.birthday-list {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.birthday-card {
  display: grid;
  gap: 3px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 253, 252, 0.76);
  min-width: 0;
}

.birthday-card h3 {
  font-size: 0.84rem;
  line-height: 1.22;
}

.birthday-card p,
.birthday-card span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.birthday-countdowns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.birthday-countdowns strong {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 8px;
  padding: 2px 6px;
  color: var(--coral);
  background: rgba(232, 93, 85, 0.1);
  font-size: 0.71rem;
  line-height: 1.35;
  white-space: normal;
}

.birthday-card span {
  display: block;
}

.hero-photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  background: #eef4f1;
}

.hero-photo-grid img:first-child {
  grid-row: span 2;
}

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

.stats-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats-grid dt {
  font-size: 1.42rem;
  font-weight: 800;
}

.stats-grid dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.city-list-block {
  margin-top: 24px;
}

.city-list-block h2,
.composer h2 {
  margin-bottom: 10px;
  font-size: 0.92rem;
  font-weight: 700;
}

.city-list {
  display: grid;
  gap: 8px;
}

.city-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.city-row span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.city-row span:last-child {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(223, 229, 222, 0.82);
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.94), rgba(245, 251, 248, 0.92)),
    #fbfdfc;
}

.toolbar-title .eyebrow {
  display: block;
  margin-bottom: 3px;
}

.toolbar-title h2 {
  font-size: 1.32rem;
  line-height: 1.25;
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 20px rgba(45, 55, 49, 0.06);
}

.icon-button:hover {
  border-color: var(--green);
}

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

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.composer {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.wide {
  grid-column: span 4;
}

input,
select,
textarea,
.editable-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

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

.editable-field {
  min-height: 44px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.editable-field:empty::before {
  content: attr(data-placeholder);
  color: #95a1a8;
}

.compact-editable {
  min-height: 42px;
}

.story-editable {
  min-height: 112px;
  white-space: pre-wrap;
}

input:focus,
select:focus,
textarea:focus,
.editable-field:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.14);
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  align-items: center;
}

.choice-grid button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.choice-grid button.active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.record-field {
  display: grid;
  gap: 8px;
}

.record-field > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.record-value {
  display: block;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.record-value.empty {
  color: #95a1a8;
  font-weight: 600;
}

.record-value.multiline {
  min-height: 88px;
  white-space: pre-wrap;
}

.record-field-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.record-field-dialog::backdrop {
  background: rgba(16, 24, 32, 0.38);
}

.record-field-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.record-field-dialog h2 {
  font-size: 1.15rem;
}

.record-field-dialog textarea {
  min-height: 160px;
}

.records-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(234, 245, 241, 0.9), rgba(255, 246, 238, 0.85)),
    #f5f1ea;
}

.records-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.records-login-card {
  max-width: 440px;
  margin: 12vh auto 0;
}

.records-dashboard {
  display: grid;
  gap: 18px;
}

.records-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 6px;
}

.records-header h1 {
  margin: 4px 0 8px;
  font-size: clamp(28px, 5vw, 44px);
}

.records-header-actions,
.records-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.records-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.25fr);
  gap: 18px;
  align-items: start;
}

.records-form,
.records-list-card {
  min-width: 0;
}

.records-mini-import,
.records-editor {
  grid-column: 1;
}

.records-list-card {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.records-form {
  display: grid;
  gap: 14px;
}

.records-form label,
.records-filter-row label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.records-form label > span,
.records-filter-row label > span {
  color: #49635c;
  font-size: 13px;
  font-weight: 700;
}

.records-form input,
.records-form select,
.records-form textarea,
.records-filter-row select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(68, 92, 84, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2d2a;
  font: inherit;
  line-height: 1.45;
  padding: 11px 12px;
}

.records-form textarea {
  resize: vertical;
  min-height: 180px;
}

.records-form input:focus,
.records-form select:focus,
.records-form textarea:focus,
.records-filter-row select:focus {
  border-color: #2f7d67;
  box-shadow: 0 0 0 3px rgba(47, 125, 103, 0.14);
  outline: none;
}

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

.records-upload-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px dashed rgba(68, 92, 84, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.records-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.records-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(68, 92, 84, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.records-item-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.records-item h3 {
  margin: 0 0 6px;
  color: #1e312d;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.records-item-meta,
.records-item-story {
  margin: 0;
  overflow-wrap: anywhere;
}

.records-item-meta {
  color: #5a6f68;
  font-size: 13px;
}

.records-item-story {
  margin-top: 8px;
  color: #30423d;
  line-height: 1.65;
  white-space: pre-wrap;
}

.records-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.records-media-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
}

.records-media-card {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.records-media-card img,
.records-media-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #e3ebe6;
}

.records-media-card figcaption {
  color: #62766f;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.records-media-card .text-button {
  justify-self: start;
  min-height: 32px;
  padding: 7px 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.text-button.primary {
  color: #fff;
  background: var(--green);
}

.text-button.primary:hover {
  background: var(--green-dark);
}

.text-button.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.text-button.danger {
  color: #a3312c;
  border-color: #f0b4b0;
  background: #fff7f6;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(223, 229, 222, 0.82);
  background: rgba(255, 255, 255, 0.72);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  max-width: 420px;
  flex: 1;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.search-box input {
  border: 0;
  padding-inline: 0;
  background: transparent;
  box-shadow: none;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  background: rgba(246, 244, 239, 0.74);
}

.segmented button {
  min-width: 58px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 6px 14px rgba(54, 121, 103, 0.18);
}

.timeline {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.photo-wall-section,
.story-preview-section,
.mini-section {
  padding: 18px 22px 0;
}

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

.story-preview-card,
.story-library-card {
  min-width: 0;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
}

.story-preview-card {
  padding: 15px;
}

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

.story-preview-head h3 {
  font-size: 0.98rem;
  line-height: 1.25;
}

.story-preview-head a,
.mini-more-link {
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

.story-preview-list {
  display: grid;
  gap: 8px;
}

.story-preview-item {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid rgba(223, 229, 222, 0.84);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.72), rgba(251, 253, 252, 0.92)),
    #fbfdfc;
}

.story-preview-item h4 {
  margin: 0;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.story-preview-item p {
  color: #40505a;
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.story-library-view {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
}

.story-library-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.story-library-list {
  display: grid;
  gap: 12px;
}

.story-library-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.story-library-card[role="link"],
.story-preview-item,
.mini-card,
.memory-detail-link,
.memory-detail-media-card {
  cursor: pointer;
}

.story-library-card[role="link"]:hover,
.story-preview-item:hover,
.mini-card:hover {
  border-color: rgba(54, 121, 103, 0.42);
  box-shadow: 0 14px 30px rgba(45, 55, 49, 0.1);
}

.story-library-card h3 {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.story-library-card p {
  color: #40505a;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.story-library-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.story-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.story-pagination span {
  min-width: 56px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.story-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.memory-detail-view {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
}

.memory-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.memory-detail-content {
  min-width: 0;
}

.memory-detail-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
}

.memory-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-detail-card h3 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.memory-detail-story {
  color: #40505a;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.memory-detail-summary {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.memory-detail-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.memory-detail-media-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #fbfdfc;
  box-shadow: 0 8px 18px rgba(45, 55, 49, 0.07);
}

.memory-detail-media-card img,
.memory-detail-media-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #edf3ef;
}

.memory-detail-media-card img {
  object-fit: contain;
}

.memory-detail-media-card video {
  object-fit: cover;
}

.memory-detail-media-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.photo-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.photo-wall-item {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  min-height: 0;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(47, 125, 104, 0.14), rgba(232, 93, 85, 0.1)),
    #f3f7f5;
  box-shadow: 0 10px 24px rgba(45, 55, 49, 0.08);
}

.photo-wall-item img,
.photo-wall-item video {
  width: 100%;
  height: 100%;
  transition: transform 220ms ease;
}

.photo-wall-item img {
  object-fit: contain;
}

.photo-wall-item video {
  object-fit: cover;
}

.photo-wall-item:hover img,
.photo-wall-item:hover video {
  transform: scale(1.025);
}

.photo-wall-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 10px 9px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.68));
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.media-play-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  border-radius: 8px;
  padding: 5px 8px;
  color: #fff;
  background: rgba(16, 24, 32, 0.72);
  font-size: 0.72rem;
  line-height: 1;
}

.photo-viewer {
  width: min(920px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: #101820;
  color: #fff;
}

.photo-viewer::backdrop {
  background: rgba(16, 24, 32, 0.72);
}

.photo-viewer img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 6px;
}

.photo-viewer video {
  display: block;
  width: 100%;
  max-height: 76vh;
  border-radius: 6px;
  background: #000;
}

.photo-viewer p {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.84);
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
}

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

.mini-library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mini-library-block {
  min-width: 0;
}

.mini-library-block h3 {
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.mini-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
}

.mini-gallery-item {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(223, 229, 222, 0.92);
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(54, 121, 103, 0.22), rgba(201, 121, 139, 0.18)),
    #21313a;
  box-shadow: 0 8px 18px rgba(45, 55, 49, 0.08);
}

.mini-gallery-item img,
.mini-gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-gallery-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 8px 7px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.64));
  font-size: 0.74rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.mini-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(45, 55, 49, 0.06);
}

.mini-card img {
  width: 110px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
}

.mini-card h3 {
  margin-top: 2px;
  font-size: 1rem;
}

.mini-card p {
  margin-top: 4px;
  color: #40505a;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.compact-empty {
  min-height: 120px;
}

.memory-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
}

.memory-image {
  min-height: 190px;
  background-position: center;
  background-size: cover;
  border-right: 1px solid var(--line);
}

.memory-content {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
}

.memory-meta,
.memory-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-meta {
  justify-content: space-between;
}

time {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.pill,
.city-tag,
.cat-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.pill {
  color: #fff;
  background: var(--coral);
}

.city-tag {
  color: var(--green-dark);
  background: rgba(47, 125, 104, 0.13);
}

.cat-tag {
  color: #6e3850;
  background: rgba(216, 111, 138, 0.18);
}

.memory-content h3 {
  font-size: 1.24rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.photo-strip {
  display: flex;
  gap: 8px;
  min-height: 0;
  overflow-x: auto;
}

.photo-strip img,
.photo-strip video {
  width: 72px;
  height: 54px;
  flex: 0 0 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.avatar-preview {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--coral));
  font-weight: 800;
}

.photo-admin-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.hero-upload-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.hero-cropper {
  display: grid;
  gap: 12px;
}

.hero-crop-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  max-height: 440px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #17212a;
}

.hero-crop-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.hero-crop-frame {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.hero-crop-frame::before,
.hero-crop-frame::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
}

.hero-crop-frame::after {
  inset: 66.666% 0 auto;
}

.hero-crop-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-library-admin-list .admin-row strong,
.mini-story-row strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.photo-delete-button {
  border: 1px solid #f0b4b0;
  border-radius: 999px;
  padding: 5px 9px;
  color: #a3312c;
  background: #fff7f6;
  font-size: 0.78rem;
  font-weight: 800;
}

.hero-photo-admin-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hero-photo-option {
  position: relative;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfdfc;
}

.hero-photo-option img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}

.hero-photo-option span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.hero-photo-option .text-button {
  min-height: 34px;
  padding: 0 10px;
}

.story {
  color: #40505a;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.admin-shell {
  min-height: 100vh;
  padding: 20px;
}

.public-footer {
  display: flex;
  justify-content: center;
  padding: 22px;
}

.public-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(45, 55, 49, 0.06);
  font-size: 0.86rem;
  font-weight: 800;
}

.public-footer a:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.admin-login {
  display: grid;
  gap: 18px;
  max-width: 460px;
  margin: 12vh auto 0;
}

.admin-dashboard {
  max-width: 1280px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
}

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

.admin-card {
  padding: 18px;
  border: 1px solid rgba(223, 229, 222, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
}

.admin-wide {
  grid-column: 1 / -1;
}

.stack-form,
.inline-form,
.admin-memory-form {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) 110px auto;
  align-items: end;
}

.admin-memory-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-wide-field {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 1 / -1;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(223, 229, 222, 0.9);
  border-radius: 8px;
  background: rgba(251, 253, 252, 0.84);
}

.admin-row span,
.admin-row strong {
  overflow-wrap: anywhere;
}

.memory-row div:first-child {
  display: grid;
  gap: 2px;
}

.memory-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.form-message {
  min-height: 22px;
  color: var(--coral);
  font-weight: 700;
}

.delete-button {
  margin-left: auto;
  border: 1px solid #f0b4b0;
  border-radius: 8px;
  padding: 6px 10px;
  color: #a3312c;
  background: #fff7f6;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfc;
  text-align: center;
  padding: 24px;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .records-layout {
    grid-template-columns: 1fr;
  }

  .records-mini-import,
  .records-editor,
  .records-list-card {
    grid-column: auto;
    grid-row: auto;
  }

  .side-panel {
    position: static;
    min-height: auto;
  }

  .hero-photo-grid {
    grid-template-columns: 1.18fr 0.82fr;
    grid-template-rows: 120px 120px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .side-panel,
  .main-panel {
    border-radius: 8px;
  }

  .toolbar,
  .filters,
  .composer,
  .photo-wall-section,
  .story-preview-section,
  .mini-section,
  .timeline,
  .memory-detail-view {
    padding-inline: 14px;
  }

  .photo-wall,
  .hero-photo-admin-list,
  .hero-crop-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-preview-grid,
  .mini-records {
    grid-template-columns: 1fr;
  }

  .mini-gallery {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .mini-library-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .records-header,
  .admin-grid,
  .admin-memory-form,
  .records-form-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .records-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-wide,
  .admin-wide-field,
  .admin-form-actions {
    grid-column: auto;
  }

  .admin-form-actions,
  .row-actions,
  .records-header-actions,
  .records-item-actions,
  .toolbar-actions {
    flex-wrap: wrap;
  }

  .records-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .records-item-body {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .story-library-header,
  .memory-detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
    max-width: none;
  }

  .segmented {
    overflow-x: auto;
  }

  .segmented button {
    flex: 0 0 auto;
  }

  .memory-card {
    grid-template-columns: 1fr;
  }

  .memory-image {
    min-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 440px) {
  .brand-lockup {
    align-items: flex-start;
  }

  .hero-photo-grid {
    grid-template-columns: 1.16fr 0.84fr;
    grid-template-rows: 96px 96px;
    gap: 5px;
    padding: 6px;
  }

  .hero-photo-grid img:first-child {
    grid-row: span 2;
  }

  .toolbar {
    align-items: flex-start;
  }

  .form-actions {
    flex-direction: column;
  }

  .text-button {
    width: 100%;
  }

  .story-preview-grid,
  .mini-records,
  .records-media-strip,
  .hero-photo-admin-list,
  .hero-crop-controls,
  .memory-detail-media-grid {
    grid-template-columns: 1fr;
  }

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

  .mini-card {
    grid-template-columns: 1fr;
  }

  .mini-card img {
    width: 100%;
    height: 150px;
  }
}
