:root {
  --line: #06c755;
  --line-dark: #079744;
  --ink: #173323;
  --muted: #64766b;
  --paper: #f4f8f3;
  --card: #ffffff;
  --soft: #e5f6eb;
  --border: #dbe8dc;
  --danger: #c4362f;
  --shadow: 0 12px 34px rgba(31, 71, 45, .09);
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(6, 199, 85, .11), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.65;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: var(--line-dark); }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(219, 232, 220, .9);
  background: rgba(244, 248, 243, .9);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--line);
  font-size: .55rem;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.live-status span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e7ad28;
  box-shadow: 0 0 0 4px rgba(231, 173, 40, .14);
}

.live-status.online span {
  background: var(--line);
  box-shadow: 0 0 0 4px rgba(6, 199, 85, .14);
}

.live-status.error span {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(196, 54, 47, .14);
}

main { width: min(1180px, 92vw); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: end;
  padding: clamp(3.4rem, 8vw, 6.5rem) 0 clamp(2.6rem, 6vw, 4.5rem);
}

.eyebrow, .step-label {
  margin: 0 0 .55rem;
  color: var(--line-dark);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1, h2 { line-height: 1.22; }

h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.3rem, 6vw, 5rem);
  letter-spacing: -.045em;
}

h1 em { color: var(--line-dark); font-style: normal; }

.hero-copy {
  max-width: 44rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
}

.hero-count {
  display: grid;
  width: clamp(130px, 13vw, 170px);
  aspect-ratio: 1;
  place-content: center;
  border: 1px solid rgba(6, 199, 85, .28);
  border-radius: 36% 64% 55% 45% / 42% 37% 63% 58%;
  background: var(--soft);
  text-align: center;
  transform: rotate(2deg);
}

.hero-count strong {
  color: var(--line-dark);
  font-size: clamp(2.5rem, 6vw, 4.7rem);
  line-height: 1;
}

.hero-count span { color: var(--muted); font-weight: 800; }

.upload-shell, .wall-section {
  margin-bottom: 2.2rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.section-heading, .wall-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.4rem;
  margin-bottom: 1.3rem;
}

.section-heading h2, .wall-toolbar h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
}

.section-heading > p {
  max-width: 35rem;
  margin-bottom: .2rem;
  color: var(--muted);
  font-size: .9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

label > span:first-child {
  display: block;
  margin-bottom: .4rem;
  font-size: .9rem;
  font-weight: 900;
}

input[type="text"], input[type="password"], input:not([type]) {
  width: 100%;
  min-height: 48px;
  padding: .65rem .85rem;
  border: 1px solid #cadacb;
  border-radius: 13px;
  outline: none;
  background: #fff;
}

input:focus { border-color: var(--line); box-shadow: 0 0 0 4px rgba(6, 199, 85, .12); }

.dropzone {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  padding: 1.4rem;
  border: 2px dashed #a9c9ae;
  border-radius: 22px;
  background: #f8fbf7;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}

.dropzone:hover, .dropzone.dragging {
  border-color: var(--line);
  background: var(--soft);
  transform: translateY(-1px);
}

.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: 1.08rem; }
.dropzone small { color: var(--muted); }
.drop-icon { color: var(--line-dark); font-size: 2.4rem; font-weight: 400; line-height: 1; }

.zip-preview {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: #edf7f0;
}

.preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.text-button, .footer-button { padding: 0; border: 0; color: var(--line-dark); background: none; font-weight: 800; cursor: pointer; }

.preview-grid, .pack-images, .viewer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}

.preview-grid img, .pack-images img, .viewer-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1.14 / 1;
  object-fit: contain;
  border-radius: 10px;
  background:
    linear-gradient(45deg, #e7ece7 25%, transparent 25%),
    linear-gradient(-45deg, #e7ece7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7ece7 75%),
    linear-gradient(-45deg, transparent 75%, #e7ece7 75%), #fff;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
}

.consent-row {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  margin: 1rem 0;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
}

.consent-row input { width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--line); }

.submit-row { display: flex; align-items: center; gap: 1rem; }

.primary-button, .secondary-button, .tab {
  min-height: 44px;
  padding: .65rem 1rem;
  border-radius: 13px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  min-width: 220px;
  border: 1px solid var(--line);
  color: #fff;
  background: var(--line);
  box-shadow: 0 7px 18px rgba(6, 199, 85, .22);
}

.primary-button:hover { background: #05b94f; }
.primary-button:disabled { opacity: .55; cursor: wait; }

.secondary-button {
  border: 1px solid var(--border);
  background: #fff;
}

.secondary-button:hover { border-color: var(--line); }

.form-status { margin: 0; color: var(--muted); font-size: .9rem; }
.form-status.error { color: var(--danger); font-weight: 800; }
.form-status.success { color: var(--line-dark); font-weight: 900; }

.toolbar-actions { display: flex; gap: .7rem; align-items: center; }
.tabs { display: inline-flex; padding: 4px; border-radius: 15px; background: #eef3ee; }

.tab {
  min-height: 38px;
  padding: .45rem .85rem;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tab.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(30, 67, 40, .08); }
.tab span { display: inline-grid; min-width: 1.45rem; place-items: center; margin-left: .25rem; border-radius: 999px; background: var(--soft); color: var(--line-dark); }

.wall-message {
  padding: 3.5rem 1rem;
  border: 1px dashed #bdd1bf;
  border-radius: 18px;
  color: var(--muted);
  background: #f8fbf7;
  text-align: center;
}

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

.pack-card {
  position: relative;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 15px rgba(31, 71, 45, .055);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.pack-card:hover { border-color: #a9d9b4; box-shadow: 0 10px 24px rgba(31, 71, 45, .1); transform: translateY(-2px); }
.pack-card.is-mine { border-color: rgba(6, 199, 85, .55); }
.pack-card.is-new { animation: arrive 1.15s ease both; }

@keyframes arrive {
  0% { transform: translateY(14px) scale(.98); opacity: .2; box-shadow: 0 0 0 8px rgba(6, 199, 85, .15); }
  100% { transform: none; opacity: 1; box-shadow: 0 4px 15px rgba(31, 71, 45, .055); }
}

.pack-heading { display: flex; align-items: start; justify-content: space-between; gap: .8rem; margin-bottom: .7rem; }
.pack-heading h3 { margin: 0; font-size: 1.08rem; }
.pack-heading time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.mine-badge { display: inline-block; margin-left: .4rem; padding: .08rem .42rem; border-radius: 999px; color: var(--line-dark); background: var(--soft); font-size: .68rem; vertical-align: .15rem; }

.pack-images { cursor: zoom-in; }
.pack-actions { display: flex; gap: .45rem; justify-content: flex-end; margin-top: .75rem; }
.pack-actions button { padding: .32rem .55rem; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--muted); font-size: .76rem; font-weight: 800; cursor: pointer; }
.pack-actions button:hover { color: var(--ink); border-color: var(--line); }
.pack-actions .danger:hover { color: var(--danger); border-color: var(--danger); }

.viewer {
  width: min(1120px, 94vw);
  max-height: 94vh;
  padding: clamp(1rem, 3vw, 2rem);
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(8, 37, 18, .28);
}

.viewer::backdrop { background: rgba(8, 30, 16, .74); backdrop-filter: blur(4px); }
.viewer-close { position: absolute; top: .8rem; right: .9rem; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #fff; font-size: 1.6rem; cursor: pointer; }
.viewer-heading { padding-right: 3rem; }
.viewer-heading p, .viewer-heading time { color: var(--muted); font-size: .82rem; }
.viewer-heading h2 { margin-bottom: .25rem; font-size: clamp(1.5rem, 3vw, 2.4rem); }
.viewer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1rem 0; }
.viewer-nav { display: flex; justify-content: space-between; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 1rem 0 2rem;
  color: var(--muted);
  font-size: .82rem;
}

.legal-page main { display: grid; min-height: 100vh; place-items: center; padding: 3rem 0; }
.legal-card { width: min(720px, 100%); padding: clamp(1.4rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.legal-card h1 { margin-top: 1.5rem; font-size: clamp(2rem, 5vw, 3.4rem); }
.legal-card p { color: var(--muted); }
.legal-card .updated { margin-top: 2rem; font-size: .82rem; }

.display-mode .site-header { min-height: 36px; padding-inline: 1.5vw; }
.display-mode .brand { font-size: .82rem; }
.display-mode .brand-mark { width: 20px; height: 20px; border-radius: 6px; }
.display-mode main { width: 98vw; }
.display-mode .hero { display: flex; align-items: center; justify-content: space-between; padding: .45rem .6rem .3rem; }
.display-mode .hero h1 { margin: 0; font-size: clamp(1.35rem, 3.2vw, 2.4rem); }
.display-mode .hero h1 br, .display-mode .hero-copy, .display-mode .eyebrow { display: none; }
.display-mode .hero-count { width: auto; aspect-ratio: auto; gap: .25rem; grid-auto-flow: column; padding: .4rem .75rem; border-radius: 999px; transform: none; }
.display-mode .hero-count strong { font-size: 1.3rem; }
.display-mode .upload-shell, .display-mode footer, .display-mode .toolbar-actions, .display-mode .step-label { display: none; }
.display-mode .wall-section { margin: 0; padding: .5rem; border: 0; border-radius: 16px; box-shadow: none; }
.display-mode .wall-toolbar { margin-bottom: .35rem; }
.display-mode .wall-toolbar h2 { font-size: 1.15rem; }
.display-mode .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.display-mode .pack-card { padding: .55rem; border-radius: 14px; }
.display-mode .pack-heading { margin-bottom: .4rem; }
.display-mode .pack-heading h3 { font-size: .9rem; }
.display-mode .pack-heading time, .display-mode .pack-actions { display: none; }
.display-mode .pack-images { gap: .3rem; }
.display-mode .viewer { width: min(900px, 92vw); max-height: 96vh; padding: .75rem 1rem; border-radius: 18px; }
.display-mode .viewer-heading p { margin-bottom: .1rem; }
.display-mode .viewer-heading h2 { margin-bottom: 0; font-size: 1.45rem; }
.display-mode .viewer-grid { gap: .35rem; margin: .45rem 0 .6rem; }
.display-mode .viewer-nav .secondary-button { min-height: 36px; padding-block: .4rem; }

@media (max-width: 760px) {
  .site-header { padding-inline: 4vw; }
  main { width: min(94vw, 680px); }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; align-items: start; padding-top: 3rem; }
  .hero-count { width: 118px; }
  .section-heading, .wall-toolbar { align-items: start; flex-direction: column; }
  .form-grid, .gallery { grid-template-columns: 1fr; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .tabs { flex: 1; }
  .tab { flex: 1; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .viewer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  footer { align-items: flex-start; flex-direction: column; }
  .display-mode .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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