:root {
  --ink: #16130f;
  --muted: #756f66;
  --paper: #f7f1e7;
  --soft: #eee3d4;
  --line: rgba(22, 19, 15, 0.12);
  --wine: #802f43;
  --gold: #c6a15b;
  --forest: #19352f;
  --night: #0d0b0a;
  --white: #fffaf2;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
}

body.memory-mode .topbar {
  display: none;
}

body.admin-mode .topbar {
  display: none;
}

button,
input,
select {
  font: inherit;
}

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

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
  color: var(--white);
  background: linear-gradient(180deg, rgba(13, 11, 10, 0.78), rgba(13, 11, 10, 0));
}

.brand,
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 250, 242, 0.42);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(13, 11, 10, 0.42);
}

.nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 250, 242, 0.16);
  border-radius: 999px;
  background: rgba(13, 11, 10, 0.32);
  backdrop-filter: blur(16px);
}

.nav a {
  min-width: 88px;
  padding: 9px 14px;
  border-radius: 999px;
  color: rgba(255, 250, 242, 0.78);
  text-align: center;
}

.nav a:hover {
  color: var(--white);
  background: rgba(255, 250, 242, 0.12);
}

.view {
  display: none;
  min-height: 100vh;
}

.view.is-active {
  display: block;
}

.hero {
  position: relative;
  overflow: hidden;
  color: var(--white);
  background: var(--night);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("./assets/hero-nfc-memory.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 11, 10, 0.92) 0%, rgba(13, 11, 10, 0.66) 38%, rgba(13, 11, 10, 0.12) 76%),
    linear-gradient(0deg, rgba(13, 11, 10, 0.72) 0%, rgba(13, 11, 10, 0) 38%);
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 86vh;
  max-width: 760px;
  flex-direction: column;
  justify-content: center;
  padding: 118px clamp(22px, 6vw, 72px) 110px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 24px;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  color: rgba(255, 250, 242, 0.78);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #140f0b;
  background: var(--gold);
}

.button.ghost {
  color: var(--white);
  border-color: rgba(255, 250, 242, 0.32);
  background: rgba(255, 250, 242, 0.08);
}

.button.danger {
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, 0.22);
  background: rgba(127, 29, 29, 0.08);
}

.button.danger:hover {
  border-color: rgba(127, 29, 29, 0.36);
  background: rgba(127, 29, 29, 0.12);
}

.button.danger.solid {
  color: #fffaf2;
  border-color: rgba(127, 29, 29, 0.62);
  background: #7f1d1d;
}

.button.danger.solid:hover {
  background: #991b1b;
}

.template-dialog {
  width: min(860px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

.template-dialog::backdrop {
  background: rgba(13, 11, 10, 0.56);
  backdrop-filter: blur(4px);
}

.template-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fffaf2;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.22);
}

.template-panel .panel-head {
  margin-bottom: 0;
}

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

.template-option {
  display: grid;
  gap: 8px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
}

.template-option:hover {
  border-color: rgba(198, 161, 91, 0.58);
  background: rgba(198, 161, 91, 0.08);
}

.template-option strong {
  font-size: 18px;
}

.template-option span {
  color: var(--muted);
  line-height: 1.6;
}

.hero-status {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255, 250, 242, 0.14);
  background: rgba(13, 11, 10, 0.72);
}

.hero-status span {
  padding: 22px clamp(18px, 4vw, 56px);
  color: rgba(255, 250, 242, 0.72);
  border-right: 1px solid rgba(255, 250, 242, 0.12);
}

.admin-shell {
  grid-template-columns: 260px minmax(0, 1fr);
  background: #f2ece1;
}

.admin-shell.is-active {
  display: grid;
}

.sidebar {
  min-height: 100vh;
  padding: 28px 20px;
  color: var(--white);
  background: #17120f;
}

.admin-brand {
  margin-bottom: 34px;
}

.admin-brand small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 250, 242, 0.52);
}

.side-item {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  color: rgba(255, 250, 242, 0.68);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.side-item.is-current,
.side-item:hover {
  color: var(--white);
  background: rgba(255, 250, 242, 0.1);
}

.admin-main {
  padding: 40px clamp(18px, 3vw, 40px) 40px;
}

.admin-heading,
.panel-head,
.memory-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-heading h2,
.memory-title-row h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 3.2vw, 46px);
  line-height: 1.12;
  letter-spacing: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0;
}

.metric,
.panel,
.memory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.72);
  box-shadow: 0 24px 70px rgba(27, 22, 16, 0.08);
}

.metric {
  padding: 20px;
}

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

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 34px;
}

.metric small {
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.3fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0;
}

.panel-head {
  margin-bottom: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.8);
}

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

.password-field button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.92);
  cursor: pointer;
}

textarea {
  resize: vertical;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.compact {
  max-width: 720px;
  margin-top: 22px;
}

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

.login-panel {
  max-width: 820px;
  margin: 0 auto;
}

.login-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 54px);
}

.table {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.row-main {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 6px 0;
  text-align: left;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.row.is-selected,
.row:hover {
  border-color: rgba(128, 47, 67, 0.28);
  background: rgba(128, 47, 67, 0.08);
}

.row strong,
.pill {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--forest);
  font-size: 12px;
  background: rgba(25, 53, 47, 0.12);
}

.row-check {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

.bulk-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.bulk-select {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.bulk-select input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
}

.bulk-actions .button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.bulk-actions .button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.upload-zone {
  display: grid;
  min-height: 144px;
  place-items: center;
  margin: 18px 0;
  border: 1px dashed rgba(128, 47, 67, 0.36);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(128, 47, 67, 0.04);
}

.upload-zone span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--white);
  font-size: 26px;
  line-height: 36px;
  background: var(--wine);
}

.upload-zone strong {
  color: var(--ink);
}

.media-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.media-thumb {
  position: relative;
  display: grid;
  min-height: 92px;
  place-items: end start;
  border-radius: 8px;
  padding: 12px;
  color: var(--white);
  background: var(--night);
  overflow: hidden;
  word-break: break-word;
}

.media-preview {
  color: inherit;
  text-decoration: none;
}

.media-thumb.has-preview {
  grid-template-rows: minmax(120px, 1fr) auto auto;
  place-items: stretch;
  padding: 10px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.72);
}

.media-thumb.has-preview img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(13, 11, 10, 0.12);
}

.media-thumb.has-preview span {
  margin-top: 8px;
  font-weight: 700;
}

.media-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.media-actions button {
  min-width: 32px;
  border: 1px solid rgba(13, 11, 10, 0.14);
  border-radius: 999px;
  padding: 6px 8px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.82);
  cursor: pointer;
}

.media-actions button:hover {
  border-color: rgba(128, 47, 67, 0.28);
  background: #fffaf2;
}

.media-actions .danger-mini {
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, 0.28);
  background: rgba(255, 250, 242, 0.9);
}

.media-actions .danger-mini:hover {
  color: #fffaf2;
  background: #7f1d1d;
}

.media-thumb small {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  color: rgba(255, 250, 242, 0.7);
}

.media-thumb.is-archived {
  opacity: 0.58;
  filter: grayscale(0.35);
}

.media-thumb.is-archived::after {
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fffaf2;
  content: "已归档";
  font-size: 12px;
  background: rgba(13, 11, 10, 0.68);
}

.media-thumb.audio {
  background: var(--wine);
}

.media-thumb.video {
  background: var(--forest);
}

.media-thumb.file {
  background: #54453d;
}

.empty-state,
.empty-memory {
  display: grid;
  min-height: 92px;
  place-items: center;
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.link-box {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.upload-hint {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.record-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 250, 242, 0.52);
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.record-grid span,
.record-history p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.record-grid strong,
.record-history strong {
  display: block;
  color: var(--ink);
}

.record-history {
  display: grid;
  gap: 6px;
}

.record-history time {
  display: inline-block;
  min-width: 138px;
  color: var(--muted);
}

.compact-admins {
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
}

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

.admin-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.48);
}

.admin-account strong,
.admin-account span,
.admin-account small {
  display: block;
}

.admin-account strong {
  margin-bottom: 4px;
  font-size: 18px;
}

.admin-account span,
.admin-account small {
  color: var(--muted);
  line-height: 1.7;
}

.admin-account.is-disabled {
  opacity: 0.62;
  background: rgba(13, 11, 10, 0.04);
}

.button.dark,
.ghost.dark {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 250, 242, 0.72);
}

.file-button {
  position: relative;
}

.memory-shell {
  padding: 110px clamp(16px, 4vw, 48px) 42px;
  color: var(--white);
  background:
    radial-gradient(circle at 72% 18%, rgba(198, 161, 91, 0.18), transparent 34%),
    linear-gradient(135deg, #0f0b0a, #1a1211 46%, #241c18);
}

body.memory-mode .memory-shell {
  padding-top: clamp(16px, 4vw, 48px);
}

.memory-card {
  max-width: 1040px;
  min-height: calc(100vh - 152px);
  margin: 0 auto;
  overflow: hidden;
  color: var(--white);
  background: rgba(255, 250, 242, 0.06);
  backdrop-filter: blur(26px);
}

.memory-intro {
  display: grid;
  min-height: calc(100vh - 152px);
  place-items: center;
  padding: 44px;
  text-align: center;
}

.memory-intro h2 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(38px, 7vw, 76px);
  line-height: 1.04;
}

.memory-intro p:not(.eyebrow) {
  max-width: 520px;
  color: rgba(255, 250, 242, 0.7);
  line-height: 1.8;
}

.memory-content {
  padding: clamp(28px, 5vw, 56px);
  animation: reveal 0.7s ease both;
}

.memory-content[data-template="video"] .gallery,
.memory-content[data-template="audio"] .gallery,
.memory-content[data-template="empty"] .gallery,
.memory-content[data-template="text"] .gallery,
.memory-content[data-template="photo"] .gallery {
  grid-template-columns: 1fr;
}

.memory-content[data-template="photo"] .message {
  min-height: auto;
}

.memory-content[data-template="audio"] {
  max-width: 900px;
  margin: 0 auto;
}

.memory-content[data-template="audio"] .gallery {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.memory-content[data-template="audio"] .message {
  min-height: auto;
  border-color: rgba(255, 250, 242, 0.08);
  padding: 14px 18px;
  background: rgba(255, 250, 242, 0.035);
}

.memory-content[data-template="audio"] .message h3 {
  display: none;
}

.memory-content[data-template="audio"] .message p {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.7;
}

.memory-content[data-template="audio"] .player-grid {
  grid-template-columns: 1fr;
  max-width: 760px;
  margin: 0 auto;
}

.memory-content[data-template="mixed"] .gallery {
  grid-template-columns: 1fr;
}

.memory-content[data-template="mixed"] .gallery .message {
  min-height: auto;
  border-color: rgba(255, 250, 242, 0.08);
  padding: 14px 18px;
  background: rgba(255, 250, 242, 0.035);
}

.memory-content[data-template="mixed"] .gallery .message h3 {
  display: none;
}

.memory-content[data-template="mixed"] .gallery .message p {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.7;
}

.memory-content[data-template="text"] {
  max-width: 980px;
  margin: 0 auto;
}

.memory-content[data-template="text"] .player-grid {
  grid-template-columns: 1fr;
  max-width: 820px;
  gap: 0;
  margin: 0 auto;
}

.memory-content[data-template="text"] .gallery {
  margin-bottom: 10px;
}

.memory-content[data-template="photo"] .player-grid:empty,
.memory-content[data-template="audio"] .player-grid:empty,
.memory-content[data-template="video"] .player-grid:empty,
.memory-content[data-template="mixed"] .player-grid:empty {
  display: none;
}

.gallery {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 18px;
  margin: 24px 0 18px;
}

.photo-frame,
.message,
.audio-player,
.video-preview {
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.08);
}

.photo-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 250, 242, 0.08), transparent 52%),
    rgba(13, 11, 10, 0.42);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 920px);
  object-fit: contain;
  margin: 0 auto;
  opacity: 1;
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.photo-frame img:not(.is-ready) {
  opacity: 0.92;
}

.hero-photo img {
  max-height: min(82vh, 980px);
}

.photo-showcase {
  display: grid;
  gap: 12px;
  width: 100%;
}

.template-placeholder {
  position: relative;
  overflow: hidden;
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: clamp(28px, 5vw, 56px);
  color: rgba(255, 250, 242, 0.78);
  text-align: center;
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 35%, rgba(198, 161, 91, 0.16), transparent 36%),
    rgba(13, 11, 10, 0.42);
}

.placeholder-backdrop {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(0deg, rgba(13, 11, 10, 0.72), rgba(13, 11, 10, 0.42)),
    url("./assets/hero-nfc-memory.png");
  background-position: center;
  background-size: cover;
  opacity: 0.58;
  filter: saturate(0.9);
}

.template-placeholder::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 42%, rgba(198, 161, 91, 0.2), transparent 34%),
    linear-gradient(180deg, transparent 58%, rgba(13, 11, 10, 0.46));
  pointer-events: none;
}

.template-placeholder span {
  position: relative;
  z-index: 1;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.template-placeholder strong {
  position: relative;
  z-index: 1;
  color: var(--white);
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.18;
}

.template-placeholder small {
  position: relative;
  z-index: 1;
  max-width: 360px;
  line-height: 1.7;
}

.story-hero .template-placeholder {
  min-height: min(72vh, 680px);
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 52% 30%, rgba(198, 161, 91, 0.18), transparent 38%),
    linear-gradient(135deg, rgba(255, 250, 242, 0.09), rgba(255, 250, 242, 0.02)),
    #050403;
}

.placeholder-carousel .carousel-nav {
  opacity: 0.66;
  pointer-events: none;
}

.placeholder-rail {
  grid-auto-columns: minmax(78px, 112px);
}

.placeholder-rail span {
  display: block;
  height: 78px;
  border: 1px solid rgba(255, 250, 242, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(0deg, rgba(13, 11, 10, 0.48), rgba(13, 11, 10, 0.18)),
    url("./assets/hero-nfc-memory.png");
  background-position: center;
  background-size: cover;
  opacity: 0.82;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 250, 242, 0.24);
  border-radius: 50%;
  color: var(--white);
  font-size: 36px;
  line-height: 1;
  background: rgba(13, 11, 10, 0.42);
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(10px);
}

.carousel-nav:hover {
  background: rgba(198, 161, 91, 0.5);
}

.carousel-nav.prev {
  left: 14px;
}

.carousel-nav.next {
  right: 14px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 250, 242, 0.28);
  cursor: pointer;
}

.carousel-dot.is-active {
  width: 28px;
  border-radius: 999px;
  background: var(--gold);
}

.photo-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(78px, 112px);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.photo-thumb {
  border: 1px solid rgba(255, 250, 242, 0.16);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 250, 242, 0.08);
  cursor: pointer;
}

.photo-thumb.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(198, 161, 91, 0.18);
}

.photo-thumb img {
  display: block;
  width: 100%;
  height: 78px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(13, 11, 10, 0.5);
}

.photo-frame figcaption {
  padding: 14px 16px;
  color: rgba(255, 250, 242, 0.68);
}

.message {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
}

.message p {
  margin: 12px 0 0;
  font-size: 20px;
  line-height: 1.7;
}

.message h3 {
  margin: 12px 0 0;
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: 0;
}

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 18px;
}

.audio-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.featured-audio {
  border-color: rgba(198, 161, 91, 0.26);
  background:
    radial-gradient(circle at 20% 20%, rgba(198, 161, 91, 0.16), transparent 36%),
    rgba(255, 250, 242, 0.08);
}

.featured-audio .audio-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.audio-player audio {
  width: 100%;
}

.manual-audio-wrap {
  position: relative;
  display: grid;
}

.manual-audio-wrap audio {
  display: none;
}

.manual-audio-wrap .tap-play {
  top: 50%;
}

.custom-voice {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(198, 161, 91, 0.18);
  border-radius: 999px;
  padding: 10px 14px 10px 10px;
  background: rgba(13, 11, 10, 0.36);
}

.voice-play {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #140f0b;
  font-weight: 800;
  background: var(--gold);
  cursor: pointer;
}

.voice-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.18);
}

.voice-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #f2d99b);
  transition: width 0.18s linear;
}

.voice-time {
  color: rgba(255, 250, 242, 0.72);
  font-size: 12px;
  white-space: nowrap;
}

.play-button,
.video-play {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #140f0b;
  background: var(--gold);
  cursor: pointer;
}

.wave {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  margin-top: 8px;
}

.wave span {
  width: 5px;
  border-radius: 999px;
  background: rgba(198, 161, 91, 0.85);
}

.wave span:nth-child(1) { height: 14px; }
.wave span:nth-child(2) { height: 28px; }
.wave span:nth-child(3) { height: 18px; }
.wave span:nth-child(4) { height: 32px; }
.wave span:nth-child(5) { height: 22px; }
.wave span:nth-child(6) { height: 16px; }

.video-preview {
  position: relative;
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
}

.video-glow {
  position: absolute;
  inset: 0;
  background-image: url("./assets/hero-nfc-memory.png");
  background-position: center;
  background-size: cover;
  opacity: 0.32;
}

.video-preview span,
.video-play {
  position: relative;
  z-index: 1;
}

.video-preview span {
  align-self: end;
  margin-bottom: 18px;
  color: rgba(255, 250, 242, 0.72);
}

.video-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 250, 242, 0.08);
}

.video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  align-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
}

.video-card video,
.story-hero video,
.feature-video video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 6px;
  object-fit: contain;
  background: #000;
}

.video-card:fullscreen,
.story-hero:fullscreen,
.autoplay-wrap:fullscreen,
.video-wrap:fullscreen {
  display: grid;
  width: 100vw;
  height: 100vh;
  padding: 0;
  place-items: center;
  background: #000;
}

.video-card:fullscreen video,
.story-hero:fullscreen video,
.autoplay-wrap:fullscreen video,
.video-wrap:fullscreen video,
video:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}

.memory-content[data-template="video-voice"] .gallery {
  grid-template-columns: 1fr;
}

.memory-content[data-template="video-voice"] .player-grid > .photo-showcase {
  grid-column: 1 / -1;
}

.memory-content[data-template="video-voice"] .player-grid > .story-voice {
  grid-column: 1 / -1;
}

.memory-content[data-template="video-voice"] .photo-showcase .hero-photo img {
  max-height: min(72vh, 760px);
}

.story-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 250, 242, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(198, 161, 91, 0.16), transparent 42%),
    #050403;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.story-hero .autoplay-wrap,
.story-hero video {
  width: 100%;
}

.story-hero .autoplay-wrap {
  background: #050403;
}

.story-hero video {
  opacity: 0.98;
}

.story-hero::after {
  display: none;
}

.story-context {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  padding: 16px 18px;
  color: var(--white);
  background: rgba(255, 250, 242, 0.055);
}

.story-context span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.story-context p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 250, 242, 0.82);
  font-size: 15px;
  line-height: 1.7;
}

.story-overlay {
  position: absolute;
  left: clamp(18px, 4vw, 48px);
  right: clamp(18px, 4vw, 48px);
  bottom: clamp(18px, 4vw, 42px);
  z-index: 2;
  display: grid;
  max-width: 620px;
  gap: 10px;
}

.story-overlay span,
.story-voice span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.story-overlay h3 {
  margin: 12px 0 16px;
  color: var(--white);
  font-size: clamp(38px, 7vw, 86px);
  line-height: 1.02;
}

.story-overlay p {
  max-width: 560px;
  color: rgba(255, 250, 242, 0.82);
  font-size: 16px;
  line-height: 1.7;
}

.story-voice {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  min-height: auto;
  align-content: center;
  align-items: center;
  gap: 12px 16px;
  border: 1px solid rgba(255, 250, 242, 0.18);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.09), rgba(255, 250, 242, 0.04)),
    rgba(255, 250, 242, 0.06);
}

.story-voice::before {
  display: grid;
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(198, 161, 91, 0.34);
  border-radius: 50%;
  color: var(--gold);
  content: "♪";
  font-size: 22px;
  background: rgba(13, 11, 10, 0.34);
}

.story-voice span,
.story-voice strong {
  grid-column: 2;
}

.story-voice strong {
  color: var(--white);
  font-size: clamp(16px, 1.7vw, 22px);
  line-height: 1.25;
}

.story-voice .autoplay-wrap {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.story-voice .tap-play {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-width: 104px;
  padding: 11px 18px;
  font-size: 13px;
  transform: none;
}

.story-voice.is-placeholder {
  border-style: solid;
  border-color: rgba(255, 250, 242, 0.14);
}

.placeholder-button {
  opacity: 0.72;
  cursor: default;
}

.text-note {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  padding: 22px;
  color: var(--white);
  background: rgba(255, 250, 242, 0.08);
}

.memory-content[data-template="text"] .text-note {
  position: relative;
  border-width: 0 0 1px;
  border-radius: 0;
  padding: 28px 0 28px 42px;
  background: transparent;
}

.memory-content[data-template="text"] .text-note::before {
  position: absolute;
  left: 0;
  top: 31px;
  width: 22px;
  height: 1px;
  content: "";
  background: rgba(198, 161, 91, 0.76);
}

.memory-content[data-template="photo"] .text-note {
  max-width: 760px;
}

.text-note span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.text-note p {
  margin: 0;
  color: rgba(255, 250, 242, 0.82);
  font-size: 18px;
  line-height: 1.8;
}

.memory-content[data-template="text"] .text-note p {
  color: rgba(255, 250, 242, 0.86);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 2;
}

.message > span,
.story-context > span,
.template-placeholder > span,
.story-voice > span {
  display: none;
}

.memory-content[data-template="text"] .text-note span {
  display: inline-block;
}

.feature-video {
  padding: 18px;
  align-content: start;
  background:
    radial-gradient(circle at 50% 20%, rgba(198, 161, 91, 0.18), transparent 34%),
    rgba(255, 250, 242, 0.08);
}

.feature-video video {
  width: 100%;
}

.autoplay-wrap {
  position: relative;
  display: grid;
}

.autoplay-wrap video,
.autoplay-wrap audio {
  position: relative;
  z-index: 1;
}

.tap-play {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;
  min-width: 138px;
  border: 1px solid rgba(255, 250, 242, 0.32);
  border-radius: 999px;
  padding: 14px 22px;
  color: #140f0b;
  font-weight: 700;
  background: var(--gold);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.voice-stage {
  display: grid;
  min-height: 420px;
  place-items: center;
  gap: 18px;
  border: 1px solid rgba(255, 250, 242, 0.12);
  border-radius: 8px;
  padding: clamp(28px, 6vw, 72px);
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(198, 161, 91, 0.18), transparent 42%),
    rgba(255, 250, 242, 0.08);
}

.memory-content[data-template="audio"] .voice-stage,
.memory-content[data-template="mixed"] .voice-stage {
  min-height: min(76vh, 720px);
}

.memory-content[data-template="audio"] .voice-stage {
  min-height: 360px;
  gap: 16px;
  padding: clamp(30px, 6vw, 58px);
  background:
    radial-gradient(circle at center 28%, rgba(198, 161, 91, 0.2), transparent 36%),
    linear-gradient(180deg, rgba(255, 250, 242, 0.09), rgba(255, 250, 242, 0.045)),
    rgba(255, 250, 242, 0.05);
}

.voice-stage strong {
  max-width: 680px;
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 700;
}

.memory-content[data-template="audio"] .voice-stage strong {
  max-width: 520px;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.22;
}

.voice-stage audio {
  width: min(640px, 100%);
}

.memory-content[data-template="audio"] .voice-stage audio {
  display: none;
}

.memory-content[data-template="audio"] .voice-stage .autoplay-wrap {
  min-height: 48px;
}

.memory-content[data-template="audio"] .voice-stage .tap-play {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  transform: none;
}

.memory-content[data-template="audio"] .voice-ring {
  width: 92px;
  height: 92px;
  font-size: 36px;
  box-shadow: 0 0 58px rgba(198, 161, 91, 0.2);
}

.featured-voice-stage {
  min-height: 176px;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 22px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.09), rgba(255, 250, 242, 0.04)),
    rgba(255, 250, 242, 0.06);
}

.memory-content[data-template="mixed"] .featured-voice-stage {
  min-height: 176px;
}

.featured-voice-stage strong {
  max-width: 100%;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
}

.featured-voice-stage .autoplay-wrap {
  width: auto;
  min-height: 42px;
}

.featured-voice-stage audio,
.manual-touch-audio audio {
  display: none;
}

.featured-voice-stage .tap-play {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-width: 104px;
  padding: 11px 18px;
  font-size: 13px;
  transform: none;
}

.featured-voice-stage .voice-ring {
  width: 48px;
  height: 48px;
  font-size: 22px;
  box-shadow: 0 0 32px rgba(198, 161, 91, 0.16);
}

.voice-ring {
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid rgba(198, 161, 91, 0.42);
  border-radius: 50%;
  color: var(--gold);
  font-size: 42px;
  background: rgba(13, 11, 10, 0.42);
  box-shadow: 0 0 80px rgba(198, 161, 91, 0.22);
}

.empty-memory.full {
  min-height: 520px;
  padding: clamp(28px, 6vw, 72px);
  text-align: center;
  color: rgba(255, 250, 242, 0.72);
  background: rgba(255, 250, 242, 0.06);
}

.empty-memory.full span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.empty-memory.full h3 {
  margin: 12px 0;
  color: var(--white);
  font-size: clamp(32px, 6vw, 68px);
}

.text-stage {
  position: relative;
  display: grid;
  max-width: 760px;
  min-height: 300px;
  justify-items: start;
  gap: 18px;
  margin: 0 auto;
  border: 1px solid rgba(198, 161, 91, 0.24);
  border-radius: 8px;
  padding: clamp(30px, 6vw, 68px);
  text-align: left;
  background:
    linear-gradient(90deg, rgba(198, 161, 91, 0.22) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 250, 242, 0.11), rgba(255, 250, 242, 0.055)),
    rgba(26, 20, 18, 0.88);
  background-size: 100% 100%, 100% 100%, 100% 100%;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
}

.text-stage::before {
  position: absolute;
  inset: 18px 18px auto auto;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(198, 161, 91, 0.36);
  border-radius: 50%;
  content: "";
  background:
    radial-gradient(circle, rgba(198, 161, 91, 0.2), transparent 62%);
}

.text-stage span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.text-stage h3 {
  max-width: 680px;
  margin: 0;
  color: var(--white);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.12;
}

.text-stage p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 250, 242, 0.84);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 2;
}

.compact-media {
  margin: 0;
}

.compact-media img {
  max-height: 320px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 44px));
  border: 1px solid rgba(255, 250, 242, 0.18);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--white);
  background: rgba(13, 11, 10, 0.88);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .nav {
    max-width: 220px;
    flex-wrap: wrap;
    justify-content: flex-end;
    border-radius: 18px;
  }

  .nav a {
    min-width: auto;
    padding: 8px 10px;
    font-size: 13px;
  }

  .hero-status,
  .metric-grid,
  .admin-layout,
  .compact-admins,
  .gallery,
  .player-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell.is-active {
    display: block;
  }

  .sidebar {
    min-height: auto;
    padding-top: 86px;
  }

  .admin-main {
    padding-top: 28px;
  }

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

  .story-voice {
    grid-template-columns: 1fr;
  }

  .story-voice::before {
    grid-column: 1;
    grid-row: auto;
  }

  .story-voice span,
  .story-voice strong {
    grid-column: 1;
  }

  .story-voice .autoplay-wrap {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .brand span:last-child {
    display: none;
  }

  .hero-content {
    min-height: 82vh;
    padding-top: 128px;
  }

  h1 {
    font-size: 42px;
  }

  .admin-heading,
  .panel-head,
  .memory-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .media-strip,
  .link-box,
  .record-grid,
  .bulk-actions {
    grid-template-columns: 1fr;
  }

  .row,
  .row-main {
    grid-template-columns: 1fr;
  }

  .admin-account {
    grid-template-columns: 1fr;
  }

  .row strong {
    justify-self: start;
  }

  .memory-shell {
    padding: 0;
  }

  body.memory-mode .memory-shell {
    padding-top: 0;
  }

  .memory-card {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }

  .memory-content {
    padding: 22px 18px 34px;
  }

  .memory-title-row {
    gap: 8px;
  }

  .memory-title-row .pill {
    display: none;
  }

  .video-card,
  .story-hero {
    margin-right: -4px;
    margin-left: -4px;
  }

  .video-wrap {
    aspect-ratio: 16 / 9;
  }

  .video-card {
    padding: 10px;
  }

  .feature-video {
    min-height: 0;
    padding: 10px;
    align-content: start;
  }

  .memory-content[data-template="video"] .gallery,
  .memory-content[data-template="video-voice"] .gallery {
    gap: 12px;
    margin-top: 14px;
  }

  .tap-play {
    min-width: 132px;
    padding: 13px 20px;
  }

  .hero-photo img {
    max-height: min(72vh, 760px);
  }

  .photo-frame img {
    max-height: min(68vh, 700px);
  }
}
