:root {
  --bg: #f4f7f6;
  --surface: #fff;
  --ink: #17342f;
  --muted: #526760;
  --primary: #08695a;
  --primary-dark: #065044;
  --soft: #e4f1ec;
  --line: #cedbd5;
  --warning: #855000;
  --warning-bg: #fff5df;
  --danger: #a72e34;
  --danger-bg: #fff0ef;
  --shadow: 0 8px 28px #17342f08;
  --radius: 18px
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system,"PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;
  overflow-wrap: anywhere
}

button,input,select,textarea {
  font: inherit;
  color: inherit
}

button,a,input,select,textarea {
  touch-action: manipulation
}

a {
  color: var(--primary);
  text-decoration: none
}

button,.button,summary {
  min-height: 44px;
  min-width: 44px
}

button,.button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 17px;
  cursor: pointer;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  line-height: 1.5
}

button:disabled {
  cursor: not-allowed;
  opacity: .5
}

.primary {
  color: white;
  background: var(--primary)
}

.primary:hover {
  background: var(--primary-dark)
}

.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--primary)
}

.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #e8bbbe
}

.text-button {
  color: var(--primary);
  background: transparent
}

.wide {
  width: 100%
}

.wide + .wide {
  margin-top: 12px
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--line)
}

.header-inner {
  max-width: 720px;
  padding: 12px 20px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px
}

.brand {
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  white-space: nowrap
}

.brand-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 10px
}

.menu {
  position: relative
}

.menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  max-width: 160px;
  list-style: none
}

.menu .chevron {
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 2px 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg)
}

.menu nav {
  position: absolute;
  right: 0;
  top: 52px;
  width: 180px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px #17342f25;
  z-index: 20
}

.menu a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 12px
}

.menu form button {
  width: 100%;
  justify-content: flex-start
}

main {
  max-width: 720px;
  padding: 24px 20px 36px;
  margin: auto;
  min-height: 75vh
}

h1,h2,h3,p {
  margin-top: 0
}

h1 {
  font-size: 30px;
  letter-spacing: -.6px;
  line-height: 1.3;
  margin-bottom: 12px
}

h2 {
  font-size: 22px;
  line-height: 1.45;
  margin-bottom: 14px
}

h3 {
  font-size: 18px;
  margin-bottom: 12px
}

p {
  margin-bottom: 16px
}

.eyebrow {
  display: block;
  font-weight: 650;
  color: var(--primary);
  margin-bottom: 10px
}

.page-heading {
  margin: 8px 0 24px
}

.page-heading p,.intro p {
  color: var(--muted)
}

.intro {
  padding: 22px 0 16px
}

.intro h1 {
  font-size: 38px
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow)
}

.login-panel {
  max-width: 480px;
  margin: 0 auto
}

.intro {
  max-width: 480px;
  margin: auto
}

label {
  display: block;
  font-weight: 650;
  margin-bottom: 20px
}

input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),select,textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #9db1a7;
  background: white;
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 48px;
  margin-top: 7px
}

textarea {
  resize: vertical
}

.hint,.muted {
  color: var(--muted);
  font-weight: 400
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 16px
}

.counter {
  display: block;
  text-align: right;
  font-weight: 400;
  color: var(--muted)
}

.claim-warning {
  display: block;
  font-weight: 400
}

.warning-text {
  color: var(--warning)
}

.error-text {
  color: var(--danger)!important
}

.notice {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0
}

.notice.error {
  background: var(--danger-bg);
  border-color: #e8bbbe;
  color: var(--danger)
}

.notice.success {
  background: var(--soft);
  color: var(--primary-dark)
}

.notice p:last-child {
  margin-bottom: 0
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 16px
}

.quota {
  text-align: center;
  margin: 12px 0 26px
}

.job-list {
  display: grid;
  gap: 14px
}

.job-card {
  display: grid;
  grid-template-columns: 78px minmax(0,1fr);
  gap: 16px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius)
}

.job-card h2 {
  font-size: 20px;
  margin: 2px 0 5px
}

.job-card p {
  margin: 4px 0;
  color: var(--muted)
}

.job-card .thumb {
  width: 78px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--soft)
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  font-size: 24px;
  color: var(--primary)
}

.job-card .card-link {
  display: block;
  min-height: 44px;
  color: var(--ink)
}

.badge {
  display: inline-block;
  border-radius: 7px;
  background: var(--soft);
  padding: 3px 8px;
  font-weight: 650;
  font-size: 16px
}

.badge.queued {
  color: var(--warning);
  background: var(--warning-bg)
}

.badge.running {
  color: var(--primary)
}

.badge.failed {
  color: var(--danger);
  background: var(--danger-bg)
}

.badge.expired {
  color: var(--muted);
  background: var(--bg)
}

.job-card .error-copy {
  color: var(--danger)
}

.text-link,.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline
}

.video {
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 570px;
  margin: 18px auto;
  border-radius: 12px;
  background: #13211d
}

.contact {
  width: 100%;
  border-radius: 10px;
  margin: 0 0 20px
}

.reminders h2 {
  font-size: 18px
}

.status-placeholder {
  padding: 35px 0;
  text-align: center
}

.spinner {
  display: inline-block;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.progress-line {
  height: 5px;
  background: var(--soft);
  overflow: hidden;
  border-radius: 5px;
  margin-top: 9px
}

.progress-line:after {
  content: '';
  display: block;
  width: 30%;
  height: 100%;
  background: var(--primary);
  animation: progress 1.8s infinite alternate
}

@keyframes progress {
  to {
    transform: translateX(230%)
  }
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.stats .panel {
  margin: 0 0 4px;
  padding: 17px
}

.stats strong,.stats span {
  display: block
}

.stats strong {
  font-size: 25px;
  margin: 6px 0
}

.users {
  width: 100%;
  border-collapse: collapse
}

.users th {
  text-align: left;
  font-size: 16px
}

.users td {
  padding: 14px 5px;
  border-top: 1px solid var(--line);
  vertical-align: top
}

.users td span {
  display: block
}

.users form {
  margin: 0 0 6px
}

.temporary-password {
  font-size: 24px;
  letter-spacing: 1px
}

.compact {
  margin-bottom: 18px
}

.steps {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 5px;
  margin: 0 0 26px
}

.steps button {
  background: transparent;
  border-radius: 12px;
  padding: 8px 0;
  flex-direction: column;
  gap: 5px;
  font-size: 16px
}

.steps button span {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center
}

.steps button.active {
  background: var(--soft);
  color: var(--primary-dark)
}

.steps button.active span {
  color: white;
  background: var(--primary);
  border-color: var(--primary)
}

.steps button.completed span {
  border-color: var(--primary)
}

.step-panel {
  padding-bottom: 85px
}

.step-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffffed;
  border-top: 1px solid var(--line);
  z-index: 15;
  padding: 12px 20px max(12px,env(safe-area-inset-bottom));
  backdrop-filter: blur(10px)
}

.step-actions>div {
  max-width: 680px;
  margin: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between
}

.step-actions button {
  min-width: 100px
}

.keyboard-open .step-actions {
  display: none
}

.layout-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.choice {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  min-height: 52px
}

.choice:has(input:checked) {
  border: 2px solid var(--primary);
  background: var(--soft);
  padding: 13px
}

.choice input {
  accent-color: var(--primary);
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0
}

.layout-choice {
  flex-direction: column;
  position: relative;
  text-align: center;
  font-size: 16px
}

.layout-choice input {
  position: absolute;
  top: 12px;
  left: 12px
}

.layout-demo {
  width: 68px;
  height: 100px;
  background: #d4e1db;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.layout-demo i {
  width: 42px;
  height: 57px;
  background: white;
  border-radius: 4px;
  display: block
}

.layout-demo b {
  width: 36px;
  height: 5px;
  background: #648878;
  border-radius: 4px
}

.layout-demo.full i {
  width: 58px;
  height: 73px;
  background: #95b9a8
}

.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  border: 2px dashed #8aab9e;
  border-radius: 16px;
  background: var(--surface);
  position: relative;
  color: var(--primary);
  cursor: pointer;
  padding: 15px
}

.upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0
}

.check input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--primary);
  margin: 2px 0
}

.consent {
  font-weight: 400
}

.photo-list {
  display: grid;
  gap: 10px;
  margin-bottom: 20px
}

.photo-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: white;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px
}

.photo-row img {
  width: 58px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px
}

.photo-row .photo-actions {
  display: flex;
  gap: 3px;
  margin-left: auto
}

.photo-actions button {
  padding: 8px;
  min-width: 44px
}

.crop-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px
}

.crop-stage {
  width: 100%;
  height: 350px;
  background: #dde6e1;
  border-radius: 12px;
  touch-action: none;
  display: block
}

.crop-card input[type=range] {
  display: block;
  width: 100%;
  height: 44px;
  accent-color: var(--primary)
}

.crop-card p {
  margin: 8px 0 14px
}

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.segmented .choice {
  flex: 1;
  white-space: nowrap;
  padding: 12px 8px;
  justify-content: center
}

.segmented .choice:has(input:checked) {
  padding: 11px 7px
}

.themes {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 8px
}

.theme-choice {
  flex-direction: column;
  padding: 10px 4px;
  gap: 7px;
  font-size: 16px
}

.theme-choice:has(input:checked) {
  padding: 9px 3px
}

.swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #0002
}

.navy {
  background: #13294b
}

.cream {
  background: #e8d9bd
}

.forest {
  background: #275343
}

.wine {
  background: #4a1626
}

audio {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 44px
}

progress {
  width: 100%;
  height: 10px;
  accent-color: var(--primary);
  display: block;
  margin-top: 16px
}

#summary img {
  width: 55px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0 8px 10px 0
}

#summary ol {
  padding-left: 24px
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 10px
}

.preview-grid button {
  padding: 0;
  display: block;
  background: transparent;
  border-radius: 8px
}

.preview-grid img {
  width: 100%;
  display: block;
  border-radius: 8px
}

.preview-grid span {
  display: block;
  padding: 8px 0
}

.preview-wrap {
  position: relative
}

#preview-stale {
  position: absolute;
  inset: 0;
  background: #ffffffe0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  font-weight: 700;
  padding: 15px;
  border-radius: 12px
}

dialog {
  width: calc(100% - 32px);
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  color: var(--ink);
  background: white
}

dialog::backdrop {
  background: #0c2926aa
}

#preview-dialog {
  max-width: 720px
}

.preview-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 15px;
  margin-top: 16px
}

.preview-carousel figure {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  text-align: center
}

.preview-carousel img {
  max-width: 100%;
  max-height: 65vh;
  display: block;
  margin: auto
}

.preview-carousel figcaption {
  padding: 8px
}

.empty {
  text-align: center;
  padding: 35px 12px;
  color: var(--muted)
}

:focus-visible {
  outline: 3px solid #ba7100;
  outline-offset: 3px
}

[hidden] {
  display: none!important
}

@media(max-width:540px) {
  main {
    padding: 22px 16px 32px
  }
  .header-inner {
    padding: 10px 16px
  }
  .panel {
    padding: 18px
  }
  .users thead {
    display: none
  }
  .users tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 14px 0
  }
  .users td {
    display: block;
    border: 0;
    padding: 4px 0
  }
  .users td:last-child {
    display: flex;
    gap: 8px;
    margin-top: 8px
  }
  .preview-grid {
    grid-template-columns: repeat(2,1fr)
  }
  .segmented {
    gap: 6px
  }
  .segmented .choice {
    font-size: 16px
  }
  .segmented .choice input {
    width: 17px;
    height: 17px
  }
  .themes {
    gap: 6px
  }
  .step-panel {
    padding-bottom: 95px
  }
  .job-card {
    gap: 12px;
    padding: 16px
  }
  .menu summary {
    max-width: 130px
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    animation: none!important;
    scroll-behavior: auto!important
  }
}
