/* Moment Story Videos — Sway. Dark maroon surface, 9:16 card grid, review modal. */

:root {
  --bg: #160809;
  --bg-glow: #2e1116;
  --accent: #e8536a;
  --accent-hover: #f26e83;

  --surface-1: #261015;   /* raised control */
  --surface-2: #31161c;   /* raised control, hover */
  --surface-3: #251015;   /* popover */
  --surface-4: #33161d;   /* inset chip / icon button */
  --surface-5: #4a2028;   /* inset chip, hover */
  --surface-6: #220f14;   /* modal panel */
  --surface-7: #2a1218;   /* logged note */
  --field: #180a0e;       /* textarea */
  --field-focus: #2c1218; /* search, focused */

  --text: #fff;
  --text-strong: #f0dde1;
  --text-soft: #e6c9ce;
  --text-tag: #e0bcc2;
  --text-pill: #c9aeb3;
  --text-muted: #8d7378;
  --text-dim: #7b6469;
  --text-faint: #5c4449;

  --hairline: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .1);
  --border-strong: rgba(255, 255, 255, .12);

  --shell: 1560px;
  --gutter: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  /* CJK fallbacks matter: the review data from the CSV is Chinese. */
  font-family: Manrope, ui-sans-serif, system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

[hidden] { display: none !important; }

a { color: #ff5a6e; text-decoration: none; }
a:hover { color: #ff8894; }

input, textarea, button { font-family: inherit; }
textarea::placeholder, input::placeholder { color: var(--text-dim); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a1d22; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes fadeup {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes popin {
  from { opacity: 0; transform: scale(.965); }
  to   { opacity: 1; transform: none; }
}
.page {
  min-height: 100vh;
  padding-bottom: 110px;
  background-image: radial-gradient(1300px 640px at 80% -12%, var(--bg-glow) 0%, rgba(46, 17, 22, 0) 62%);
}

/* --- top bar -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(22, 8, 9, .88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 20px var(--gutter);
  display: flex;
  align-items: center;
  gap: 26px;
}

.topbar-spacer { flex: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 7px;
}

.brand-mark {
  display: block;
  fill: #f0176b;
}

.brand-word {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #fff;
}

.brand-rule {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, .14);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--text-strong);
}

/* --- date picker ---------------------------------------------------------- */

.datepicker {
  position: relative;
  flex-shrink: 0;
  margin-left: 14px;
}

.date-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.date-btn:hover {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, .2);
}

.cal {
  position: absolute;
  top: 52px;
  left: 0;
  z-index: 50;
  width: 312px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .62);
  animation: popin .16s ease-out;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cal-month { font-size: 14px; font-weight: 700; }

.cal-nav {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: var(--surface-4);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .18s;
}
.cal-nav:hover { background: var(--surface-5); }

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-weekdays { margin-bottom: 6px; }

.cal-weekday {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-dim);
}

.cal-blank { height: 34px; }

.cal-day {
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
}
.cal-day.is-available {
  color: var(--text-strong);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(232, 83, 106, .34);
}
.cal-day.is-available:hover { background: rgba(232, 83, 106, .18); }
.cal-day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.cal-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-today {
  border: none;
  padding: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* --- search --------------------------------------------------------------- */

.search {
  position: relative;
  width: 420px;
  max-width: 36vw;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 14px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(38, 16, 21, .6);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color .18s, background .18s;
}
.search-input:focus {
  border-color: var(--accent);
  background: var(--field-focus);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-5);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* --- page head ------------------------------------------------------------ */

.page-head {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 40px var(--gutter) 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.page-sub {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 760px;
}

.tag-filter {
  height: 34px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(38, 16, 21, .6);
  color: var(--text-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.tag-filter:hover { border-color: rgba(232, 83, 106, .5); color: var(--text-strong); }
.tag-filter.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tag-count {
  margin-left: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}
.tag-filter.is-on .tag-count { color: rgba(255, 255, 255, .78); }

/* --- grid ----------------------------------------------------------------- */

.content {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px var(--gutter) 0;
}

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

.card {
  cursor: pointer;
  animation: fadeup .3s ease-out both;
}

.card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  transition: transform .28s cubic-bezier(.2, .7, .3, 1), box-shadow .28s, border-color .28s;
}
.card:hover .card-frame,
.card:focus-visible .card-frame {
  transform: translateY(-6px);
  box-shadow: 0 26px 54px rgba(0, 0, 0, .55);
  border-color: rgba(232, 83, 106, .5);
}

/* Poster frame until hover; app.js attaches the mp4 and plays it in place. */
.card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1d0d11;
  display: block;
}

.card-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .4) 0%, rgba(0, 0, 0, 0) 26%, rgba(0, 0, 0, .06) 52%, rgba(0, 0, 0, .86) 100%);
}

.card-duration,
.card-badge {
  position: absolute;
  top: 12px;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
}

.card-duration {
  left: 12px;
  background: rgba(12, 4, 6, .7);
  backdrop-filter: blur(6px);
  color: #f3dfe3;
}

.card-badge {
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: .04em;
}

.card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.card:hover .card-play,
.card:focus-visible .card-play { opacity: 1; }

.card-play-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 83, 106, .94);
  box-shadow: 0 12px 32px rgba(232, 83, 106, .45);
}

.card-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 16px 16px;
  pointer-events: none;
}

.card-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.012em;
  line-height: 1.28;
  text-wrap: pretty;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .75);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .68);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

.dot-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-status.is-pass { background: #4ec38a; }
.dot-status.is-pending { background: #e8a33f; }

.empty {
  padding: 120px 0;
  text-align: center;
}
.empty-title { font-size: 19px; font-weight: 700; color: var(--text-soft); }
.empty-sub { margin-top: 10px; font-size: 14px; color: var(--text-muted); }

/* --- modal ---------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px;
  background: rgba(9, 3, 4, .84);
  backdrop-filter: blur(12px);
  animation: popin .18s ease-out;
}

.modal {
  display: flex;
  gap: 26px;
  align-items: stretch;
}

.player {
  position: relative;
  aspect-ratio: 9 / 16;
  height: min(78vh, 780px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 44px 96px rgba(0, 0, 0, .6);
}

.player-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.detail {
  display: flex;
  flex-direction: column;
  width: 392px;
  height: min(78vh, 780px);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface-6);
  border: 1px solid var(--border);
  box-shadow: 0 44px 96px rgba(0, 0, 0, .6);
}

.detail-head {
  padding: 24px 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.detail-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  text-wrap: pretty;
}

.detail-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--surface-4);
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s;
}
.detail-close:hover { background: var(--surface-5); }

.detail-tags {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-tag {
  height: 24px;
  padding: 0 10px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  background: var(--surface-4);
  color: var(--text-tag);
  font-size: 11px;
  font-weight: 700;
}
.detail-tag.is-accent { background: var(--accent); color: #fff; }

.detail-meta {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 18px;
  font-size: 12px;
}
.detail-meta dt { color: var(--text-dim); font-weight: 600; }
.detail-meta dd { margin: 0; color: var(--text-tag); font-weight: 600; }
.detail-meta dd.is-mono { font-family: ui-monospace, Menlo, monospace; }
.detail-meta dd.is-wrap { overflow-wrap: anywhere; }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 24px;
}

.section-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--text-muted);
}

.feedback-input {
  margin-top: 12px;
  width: 100%;
  min-height: 148px;
  resize: vertical;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--field);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  transition: border-color .18s;
}
.feedback-input:focus { border-color: var(--accent); }

.feedback-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-primary {
  height: 42px;
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
}
.btn-primary:hover { background: var(--accent-hover); }

.save-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.logged:not(:empty) { margin-top: 28px; }

.note-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note {
  padding: 13px 14px;
  border-radius: 13px;
  background: var(--surface-7);
  border: 1px solid rgba(255, 255, 255, .07);
}

.note-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-strong);
  text-wrap: pretty;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-when {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 1400px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  :root { --gutter: 24px; }
  .topbar-inner { flex-wrap: wrap; gap: 16px; }
  .topbar-spacer { display: none; }
  .search { width: 100%; max-width: none; order: 3; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
  .page-title { font-size: 26px; }
  .filters { justify-content: flex-start; }
}

/* Below this the side-by-side modal no longer fits; stack and scroll instead. */
@media (max-width: 980px), (max-height: 620px) {
  .modal-overlay {
    padding: 20px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .modal {
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    margin: auto;
  }
  .player { height: auto; width: 100%; }
  .detail { width: 100%; height: auto; max-height: none; }
  .detail-body { overflow: visible; }
}

@media (max-width: 620px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .brand-title { display: none; }
  .brand-rule { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
