:root {
  color-scheme: light;
  --ink: #20312d;
  --muted: #687772;
  --line: #dce5e1;
  --surface: #ffffff;
  --soft: #f4f8f6;
  --coral: #ed6b5d;
  --coral-dark: #cc4f43;
  --teal: #197967;
  --teal-dark: #105d4f;
  --gold: #e2a934;
  --danger: #b33a32;
  --shadow: 0 12px 34px rgba(31, 56, 49, 0.1);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--soft);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--soft);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button,
summary,
.file-button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(25, 121, 103, 0.25);
  outline-offset: 2px;
}

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

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.muted,
.section-help,
.privacy-note {
  color: var(--muted);
  line-height: 1.7;
}

.app-header,
.viewer-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.header-inner,
.viewer-header,
.page-shell,
.viewer-shell {
  width: min(100% - 28px, 1080px);
  margin-inline: auto;
}

.header-inner,
.viewer-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-lockup,
.viewer-cover {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup img,
.viewer-cover img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand-lockup h1,
.viewer-cover h1 {
  margin: 0;
  font-size: 19px;
}

.page-shell,
.viewer-shell {
  padding-block: 24px 64px;
}

#upload,
#records,
#share {
  scroll-margin-top: 96px;
}

.admin-shortcuts {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-shortcuts a {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal-dark);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  background: #fff;
}

.summary-band > div {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.summary-band > div + div {
  border-left: 1px solid var(--line);
}

.summary-band strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}

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

.workspace-section,
.settings-panel,
.timeline-section {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.share-section {
  margin-top: 24px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--line);
}

.share-section .copy-row {
  margin-top: 14px;
}

.share-section .secondary-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.workspace-section,
.timeline-section {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.section-help {
  margin: 12px 0 0;
  font-size: 13px;
}

.primary-button,
.secondary-button,
.quiet-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0;
}

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

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

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

.danger-button {
  color: var(--danger);
  background: #fff;
  border-color: #e8c4c0;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-button.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.storage-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.storage-value {
  white-space: nowrap;
}

.storage-warning {
  color: var(--danger);
}

.upload-queue {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.upload-item {
  min-height: 86px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.upload-preview {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 5px;
  background: #edf2f0;
}

.upload-preview img,
.upload-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.upload-item strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.upload-detail {
  min-width: 0;
}

.upload-item-status {
  color: var(--teal);
}

.upload-item.has-error .upload-item-status {
  color: var(--danger);
}

.upload-item progress {
  width: 100%;
  height: 8px;
  display: block;
  margin-top: 8px;
  accent-color: var(--teal);
}

.upload-item label {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.upload-item input {
  min-height: 34px;
}

.upload-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.remove-upload {
  border: 0;
  color: var(--danger);
  background: transparent;
}

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

.upload-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--teal);
  font-size: 13px;
}

.settings-panel summary {
  padding: 18px 22px;
  font-weight: 750;
}

.settings-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.settings-form {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-form > label,
.stack-form label,
.photo-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #bdcbc6;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
}

.share-block,
.check-row,
.settings-form > button {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

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

.share-block p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 9px !important;
  color: var(--ink) !important;
}

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

.timeline-day {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.timeline-day:first-of-type {
  margin-top: 18px;
}

.timeline-label {
  margin-bottom: 13px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.timeline-label time {
  font-size: 17px;
  font-weight: 760;
}

.timeline-label span {
  color: var(--coral-dark);
  font-size: 13px;
  font-weight: 720;
}

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

.photo-card,
.viewer-photo {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.photo-open {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  display: block;
  border: 0;
  background: #edf2f0;
}

.photo-open img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #111;
}

.media-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-open {
  display: block;
  color: #fff;
}

.video-open:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: -3px;
}

.play-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding-left: 4px;
  border-radius: 50%;
  background: rgb(16 22 20 / 78%);
  font-size: 25px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.media-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  color: #fff;
  background: rgb(20 28 26 / 78%);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

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

.photo-form input {
  min-height: 38px;
}

.delete-form {
  padding: 0 12px 12px;
}

.delete-form button {
  width: 100%;
}

.viewer-photo figcaption {
  padding: 10px 12px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.viewer-header {
  padding-block: 16px;
}

.viewer-header .quiet-button {
  white-space: nowrap;
}

.viewer-cover p:last-child {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.viewer-day {
  border-color: #d6e0dc;
}

.empty-state {
  min-height: 260px;
  padding: 40px 20px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-state img {
  width: 82px;
  height: 82px;
  margin-bottom: 14px;
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 7px;
}

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

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.notice.success {
  color: var(--teal-dark);
  background: #e8f4f0;
  border: 1px solid #b9dbcf;
}

.notice.error {
  color: #7a2520;
  background: #fff0ee;
  border: 1px solid #efc1bc;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f7faf8;
}

.auth-shell {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  object-fit: contain;
}

.auth-shell h1 {
  margin-bottom: 9px;
  font-size: 27px;
}

.stack-form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.stack-form .primary-button {
  margin-top: 4px;
}

.code-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 0;
}

.privacy-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
}

.image-dialog {
  width: min(96vw, 1080px);
  height: min(94vh, 900px);
  padding: 52px 12px 12px;
  border: 0;
  border-radius: 8px;
  background: #101614;
}

.image-dialog::backdrop {
  background: rgba(8, 12, 11, 0.82);
}

.image-dialog img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-player-open {
  overflow: hidden;
}

.video-player {
  position: fixed;
  inset: 0;
  z-index: 100;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: #fff;
  background: #101614;
  overscroll-behavior: contain;
}

.video-player-header {
  min-height: 56px;
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.video-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.video-close,
.video-toggle,
.video-main-play {
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  color: #fff;
  background: transparent;
}

.video-close {
  width: 44px;
  height: 44px;
  font-size: 30px;
  line-height: 1;
}

.video-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #090d0c;
}

.video-stage video {
  width: 100%;
  height: 100%;
  max-width: 1200px;
  display: block;
  object-fit: contain;
}

.video-main-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  padding-left: 5px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 50%;
  background: rgb(8 13 11 / 78%);
  font-size: 30px;
  transform: translate(-50%, -50%);
}

.video-state {
  position: absolute;
  bottom: 14px;
  left: 50%;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 7px 11px;
  border-radius: 4px;
  color: #fff;
  background: rgb(8 13 11 / 82%);
  font-size: 13px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.video-controls {
  width: min(100%, 960px);
  margin-inline: auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.video-seek-shell {
  position: relative;
  height: 44px;
}

.video-seek-track {
  position: absolute;
  top: 50%;
  right: 8px;
  left: 8px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #46534d;
  transform: translateY(-50%);
  pointer-events: none;
}

.video-buffer-fill,
.video-play-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
}

.video-buffer-fill {
  background: #9baaa3;
}

.video-play-fill {
  background: #70d6ba;
}

.video-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.video-seek::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.video-seek::-moz-range-track {
  height: 6px;
  background: transparent;
}

.video-seek::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: #70d6ba;
}

.video-seek::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #70d6ba;
}

.video-seek:focus-visible::-webkit-slider-thumb {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.video-seek:focus-visible::-moz-range-thumb {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.video-seek:disabled {
  cursor: default;
}

.video-controls-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-toggle {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.video-time {
  color: #e4ebe8;
  font-size: 13px;
  white-space: nowrap;
}

.video-fallback {
  display: inline-block;
  margin-top: 6px;
  color: #fff;
  font-size: 13px;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #4d5b56;
  border-radius: 5px;
  color: #fff;
  background: #26312e;
}

@media (max-width: 760px) {
  body {
    background: var(--soft);
  }

  .header-inner,
  .viewer-header,
  .page-shell,
  .viewer-shell {
    width: min(100% - 20px, 1080px);
  }

  .workspace-section,
  .timeline-section {
    padding: 17px;
  }

  .settings-form {
    grid-template-columns: 1fr;
    padding: 17px;
  }

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

  .summary-band > div:nth-child(3) {
    border-left: 0;
  }

  .summary-band > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .share-block,
  .check-row,
  .settings-form > button {
    grid-column: auto;
  }

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

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

  .photo-card {
    display: grid;
    grid-template-columns: 42% minmax(0, 1fr);
  }

  .photo-card .photo-open,
  .photo-card .media-preview {
    height: 100%;
    aspect-ratio: auto;
    grid-row: 1 / 3;
  }

  .photo-form {
    padding-bottom: 8px;
  }

  .delete-form {
    grid-column: 2;
  }

  .viewer-header {
    align-items: flex-start;
  }

  .share-section .section-heading {
    flex-direction: row;
    align-items: center;
  }

  .viewer-cover img {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 430px) {
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-button {
    width: 100%;
    text-align: center;
  }

  .summary-band > div {
    padding: 17px 14px;
  }

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

  .summary-band strong {
    font-size: 19px;
  }

  .upload-item {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .upload-preview {
    width: 60px;
    height: 60px;
  }

  .remove-upload {
    grid-column: 2;
    justify-self: start;
    padding: 0;
  }

  .photo-card {
    grid-template-columns: 38% minmax(0, 1fr);
  }

  .auth-shell {
    padding: 26px 20px;
  }
}
