* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --green: #19be6b;
  --red: #b42318;
  --ink: #1f2328;
  --muted: #667085;
  --line: #e6e8ec;
  --paper: #fff;
  --bg: #f6f2ee;
  --brand: #9f1d24;
  --brand-dark: #5a0d12;
  --brand-soft: #fff4f0;
  --gold: #d7a757;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(215, 167, 87, 0.22), transparent 26%),
    radial-gradient(circle at 88% 2%, rgba(159, 29, 36, 0.12), transparent 28%),
    linear-gradient(135deg, #fffaf4 0%, var(--bg) 42%, #f1e7dd 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button:not(.btn):not(.chip) {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.btn {
  --bs-btn-border-radius: 8px;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-weight: 700;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: #b62830;
  --bs-btn-hover-border-color: #b62830;
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}

.btn-success {
  --bs-btn-bg: var(--green);
  --bs-btn-border-color: var(--green);
  --bs-btn-hover-bg: #159b58;
  --bs-btn-hover-border-color: #159b58;
}

.ghost {
  background: #eef1f4;
  color: #26313d;
}

.danger {
  background: var(--red);
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 54px) 16px 56px;
}

.page-wide {
  width: min(100%, 1180px);
}

.app-shell {
  position: relative;
}

.hero {
  margin-bottom: 18px;
  padding: 4px 2px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
  color: #2c1011;
  font-weight: 850;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(159, 29, 36, 0.1);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(18px, 4vw, 28px);
  box-shadow: 0 18px 48px rgba(89, 40, 31, 0.11);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.field input:not(.form-control),
.field textarea:not(.form-control) {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field textarea {
  min-height: 124px;
  resize: vertical;
  line-height: 1.55;
}

.form-control,
.form-control:focus {
  border-radius: 10px;
}

.form-control:focus {
  border-color: rgba(159, 29, 36, 0.42);
  box-shadow: 0 0 0 0.25rem rgba(159, 29, 36, 0.1);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
}

.wish-rail {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(38px, auto));
  grid-auto-columns: max-content;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 12px;
  margin-right: -4px;
  margin-left: -2px;
  scrollbar-color: rgba(159, 29, 36, 0.34) transparent;
  -webkit-overflow-scrolling: touch;
}

.wish-rail::-webkit-scrollbar {
  height: 6px;
}

.wish-rail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(159, 29, 36, 0.28);
}

.chip {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid #f2c9c3;
  font-size: 13px;
}

.chip:hover {
  background: #ffe8e1;
}

.wish-rail .chip {
  min-width: 188px;
  max-width: 260px;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.bless-submit {
  width: min(100%, 360px);
  min-height: 58px;
  font-size: 18px;
  box-shadow: 0 12px 26px rgba(159, 29, 36, 0.22);
}

.bless-submit.is-shaking {
  animation: blessShake 0.26s ease;
}

.bless-desc {
  margin: 14px auto 0;
  max-width: 620px;
  color: #7a5e5b;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}

.bless-toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 2000;
  max-width: min(88vw, 360px);
  transform: translate(-50%, -14px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(29, 25, 23, 0.92);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.22);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bless-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.bless-toast.err {
  background: rgba(180, 35, 24, 0.96);
}

@keyframes blessShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  36% { transform: translateX(5px); }
  54% { transform: translateX(-3px); }
  72% { transform: translateX(3px); }
}

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

.admin-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -6px -4px 16px;
  padding: 10px;
  border: 1px solid rgba(230, 232, 236, 0.78);
  border-radius: 12px;
  background: rgba(255, 250, 244, 0.92);
  box-shadow: 0 10px 28px rgba(89, 40, 31, 0.09);
  backdrop-filter: blur(12px);
}

.notice {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.notice.ok {
  color: #0f7b42;
}

.notice.err {
  color: var(--red);
}

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

.photo-tile,
.review-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.photo-tile img,
.review-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f1f3f5;
}

.review-card .body {
  padding: 12px;
}

.review-card p {
  margin: 0 0 10px;
  color: #344054;
  line-height: 1.45;
}

.review-card small {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.manage-card textarea {
  min-height: 88px;
  resize: vertical;
}

.manage-grid .actions {
  gap: 7px;
}

.manage-grid .btn,
.review-card .btn {
  white-space: nowrap;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #2c1011;
  font-size: 20px;
  font-weight: 850;
}

.admin-page {
  width: min(100%, 1240px);
  padding-top: 18px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 12px;
}

.admin-topbar h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #2c1011;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-topbar i {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 18px;
}

.admin-home-link {
  flex: 0 0 auto;
  min-height: 38px;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 126px;
  padding: 18px;
  border: 1px solid rgba(230, 232, 236, 0.88);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 34px rgba(89, 40, 31, 0.09);
}

.stat-card > i {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 21px;
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-card span {
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin: 2px 0;
  color: #2c1011;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.stat-card small {
  font-size: 12px;
  line-height: 1.35;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 30px rgba(89, 40, 31, 0.08);
}

.admin-tabs button {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5d6878;
  font-weight: 850;
}

.admin-tabs button.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(159, 29, 36, 0.22);
}

.admin-tabs span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  color: currentColor;
  font-size: 12px;
}

.admin-view {
  display: none;
}

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

.admin-panel-head {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.admin-filterbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto auto;
  gap: 8px;
  align-items: center;
}

.admin-filterbar .form-select,
.admin-filterbar .form-control {
  min-height: 42px;
}

.admin-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.item-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.item-meta small {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.photo-info span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.blessing-list {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.empty-text {
  margin: 0;
  color: var(--muted);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 48px 18px;
  background: rgba(18, 12, 10, 0.82);
  backdrop-filter: blur(10px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0,0,0,0.42);
}

.image-lightbox button {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  width: 44px;
  height: 44px;
  padding: 0;
}

@media (max-width: 720px) {
  .page {
    padding: 18px 10px 42px;
  }

  .page-wide {
    width: min(100%, 560px);
  }

  .hero {
    margin-bottom: 14px;
  }

  .hero h1 {
    font-size: clamp(28px, 10vw, 42px);
  }

  .hero p {
    font-size: 14px;
  }

  .admin-page {
    padding-top: 10px;
  }

  .admin-topbar {
    min-height: 36px;
    margin-bottom: 10px;
  }

  .admin-topbar h1 {
    font-size: 18px;
  }

  .admin-home-link {
    min-height: 36px;
    padding-inline: 10px;
  }

  .admin-topbar i {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .panel {
    padding: 16px;
    border-radius: 10px;
  }

  .admin-toolbar {
    align-items: stretch;
    margin: -2px -2px 14px;
  }

  .admin-toolbar .btn {
    width: 100%;
    min-height: 46px;
  }

  .admin-toolbar .notice {
    width: 100%;
  }

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

  .stat-card {
    min-height: 112px;
    padding: 14px;
  }

  .stat-card strong {
    font-size: 28px;
  }

  .admin-tabs {
    overflow-x: auto;
    padding: 5px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tabs button {
    flex: 0 0 auto;
    min-width: 132px;
    padding: 0 12px;
  }

  .admin-panel-head,
  .admin-filterbar {
    grid-template-columns: 1fr;
  }

  .admin-filterbar .btn {
    min-height: 44px;
  }

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

  .review-card .actions {
    gap: 8px;
  }

  .manage-grid .actions .btn,
  .review-card .actions .btn {
    flex: 1 1 calc(50% - 8px);
    min-height: 42px;
  }

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

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

.screen-body {
  overflow: hidden;
  background: #130505;
  color: #fff;
}

.screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 218, 137, 0.2), transparent 26%),
    linear-gradient(135deg, #3d0608, #160303 48%, #5f0b0b);
}

.photo-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.photo-scene {
  position: absolute;
  inset: 0;
  display: grid;
  gap: clamp(8px, 1vw, 18px);
  padding: clamp(8px, 1vw, 18px);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
}

.photo-scene.active {
  opacity: 1;
  transform: scale(1);
}

.photo-scene.layout-1 {
  display: block;
  padding: 0;
}

.photo-scene.layout-2-a {
  grid-template-columns: 1fr 1fr;
}

.photo-scene.layout-2-b {
  grid-template-rows: 1fr 1fr;
}

.photo-scene.layout-2-c {
  grid-template-columns: 1.22fr 0.78fr;
}

.photo-scene.layout-3-a {
  grid-template-columns: 1.25fr 0.75fr;
  grid-template-rows: 1fr 1fr;
}

.photo-scene.layout-3-a .photo-card:first-child {
  grid-row: 1 / 3;
}

.photo-scene.layout-3-b {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 0.9fr 1.1fr;
}

.photo-scene.layout-3-b .photo-card:first-child {
  grid-column: 1 / 3;
}

.photo-scene.layout-3-c {
  grid-template-columns: 0.78fr 1.22fr;
  grid-template-rows: 1fr 1fr;
}

.photo-scene.layout-3-c .photo-card:last-child {
  grid-row: 1 / 3;
  grid-column: 2;
}

.photo-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #250404;
  box-shadow: 0 16px 50px rgba(0,0,0,0.28);
}

.layout-1 .photo-card {
  width: 100%;
  height: 100%;
  box-shadow: none;
}

.photo-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: scale(1.04);
  animation: photoKenburns 7.2s linear forwards;
}

.photo-card:nth-child(2) img {
  animation-duration: 8s;
  animation-direction: reverse;
}

.photo-card:nth-child(3) img {
  animation-duration: 7.6s;
}

.photo-scene.fx-fade-in {
  animation: sceneFadeIn 0.95s ease forwards;
}

.photo-scene.fx-zoom-in {
  animation: sceneZoomIn 0.95s cubic-bezier(.2,.8,.2,1) forwards;
}

.photo-scene.fx-slide-left {
  animation: sceneSlideLeft 0.9s cubic-bezier(.22,.8,.22,1) forwards;
}

.photo-scene.fx-slide-up {
  animation: sceneSlideUp 0.9s cubic-bezier(.22,.8,.22,1) forwards;
}

.photo-scene.fx-tilt-in {
  animation: sceneTiltIn 1s cubic-bezier(.2,.8,.2,1) forwards;
}

.photo-scene.leaving {
  animation: sceneLeave 0.9s ease forwards;
}

@keyframes photoKenburns {
  from { transform: scale(1.04); }
  to { transform: scale(1.12); }
}

@keyframes sceneFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sceneZoomIn {
  from { opacity: 0; transform: scale(1.08); filter: blur(8px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes sceneSlideLeft {
  from { opacity: 0; transform: translateX(8vw) scale(1.02); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes sceneSlideUp {
  from { opacity: 0; transform: translateY(7vh) scale(1.02); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sceneTiltIn {
  from { opacity: 0; transform: rotate(-2deg) scale(1.08); filter: blur(4px); }
  to { opacity: 1; transform: rotate(0) scale(1); filter: blur(0); }
}

@keyframes sceneLeave {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.04); }
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.28), rgba(0,0,0,0.06) 42%, rgba(0,0,0,0.44)),
    radial-gradient(circle at 50% 100%, rgba(0,0,0,0.46), transparent 48%);
  pointer-events: none;
}

.screen-qr {
  position: absolute;
  z-index: 4;
  right: 4vw;
  bottom: 5vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px);
  text-align: center;
}

.screen-qr img {
  width: clamp(96px, 10vw, 150px);
  aspect-ratio: 1;
  border-radius: 4px;
  background: #fff;
}

.screen-qr strong {
  display: block;
  font-size: clamp(20px, 2.2vw, 34px);
  line-height: 1.1;
}

.barrage-layer {
  position: absolute;
  z-index: 5;
  inset: 16vh 0 20vh;
  overflow: hidden;
  pointer-events: none;
}

.barrage {
  position: absolute;
  left: 100vw;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  color: #fff;
  font-size: clamp(20px, 2.2vw, 38px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  animation: fly var(--duration, 15s) linear forwards;
}

.barrage b {
  color: #ffd37a;
}

@keyframes fly {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 120%)); }
}
