:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --paper: #fffaf3;
  --ink: #1d1a16;
  --muted: #6f665c;
  --line: #ded5ca;
  --brand: #5236ff;
  --danger: #b72b2b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #fff 0, var(--bg) 38rem);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 10px clamp(16px, 4vw, 28px);
  background: rgb(255 253 248 / 92%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgb(50 35 20 / 8%);
  backdrop-filter: blur(14px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-size: clamp(22px, 3vw, 30px);
  text-decoration: none;
}

.brand-mark span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid currentColor;
  border-radius: 11px;
  font-weight: 900;
}

.account-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: min(44vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--brand) 65%, white);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 9px 16px;
  font-weight: 800;
}

.account-chip.pending,
.account-chip.signed-out {
  color: var(--muted);
}

.account-chip.signed-in {
  color: var(--brand);
}

.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 20px 24px;
}

.welcome {
  padding-top: 72px;
  padding-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -.055em;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
}

.button-link:hover {
  filter: brightness(.96);
}

.button-link.secondary {
  background: #e8e1d8;
  color: var(--ink);
}

body:not(.auth-signed-in) .workspace-only {
  display: none;
}

body.auth-signed-in .public-only {
  display: none;
}

body.auth-signed-in .shell {
  padding-top: 36px;
}

.shell {
  display: grid;
  gap: 18px;
  max-width: 960px;
  margin: 0 auto 64px;
  padding: 0 20px;
}

.card {
  background: color-mix(in srgb, var(--paper) 92%, white);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 42px rgb(50 35 20 / 8%);
}

.intro-card {
  background: #fffdf8;
}

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

.timeline-lite article {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: white;
}

.timeline-lite span {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 900;
  margin-bottom: 10px;
}

.timeline-lite h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.timeline-lite p,
.promise-card p,
.workspace-head p {
  margin: 0;
  color: var(--muted);
}

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

.promise-card p {
  border-left: 3px solid var(--brand);
  padding: 10px 12px;
  background: white;
  border-radius: 12px;
}

.workspace-head {
  padding: 18px 4px 4px;
}

.workspace-head h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  font-weight: 700;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 12px;
}

textarea { resize: vertical; }

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: #e8e1d8;
  color: var(--ink);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.hint, .status {
  color: var(--muted);
}

.status[data-state="success"] {
  color: #167444;
}

.status[data-state="error"] {
  color: var(--danger);
}

.hint a {
  color: var(--brand);
  font-weight: 800;
}

.engine-card {
  max-width: 780px;
  margin: 0 auto;
}

.engine-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.engine-card-head h2 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 40px);
}

.engine-card-head p,
.engine-copy {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.engine-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--brand) 12%, white);
  font-size: 34px;
}

.engine-copy {
  margin: 20px 0 14px;
}

.safe-notice {
  border: 1px solid color-mix(in srgb, var(--brand) 55%, white);
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand) 10%, white);
  color: var(--ink);
  padding: 16px 18px;
  font-weight: 700;
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px;
  margin: 12px 0;
}

.login-panel .status {
  margin: 0;
}

.dev-token {
  margin: 12px 0;
  color: var(--muted);
}

.dev-token summary {
  cursor: pointer;
  font-weight: 800;
}

.photo-list {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.progress-panel {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px;
}

.progress-panel[hidden] {
  display: none;
}

.progress-panel[data-state="loading"] {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.progress-panel[data-state="success"] {
  border-color: #85b999;
  background: #f1faf4;
}

.progress-panel[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  background: #fff5f3;
}

.progress-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 12%, white);
  color: var(--brand);
  font-weight: 900;
}

.progress-panel[data-state="loading"] .progress-icon {
  animation: pulse 1.1s ease-in-out infinite;
}

.progress-panel[data-state="success"] .progress-icon {
  background: #dff1e5;
  color: #167444;
}

.progress-panel[data-state="error"] .progress-icon {
  background: #ffe2dd;
  color: var(--danger);
}

.progress-panel p {
  margin: 3px 0 0;
  color: var(--muted);
}

.step-active {
  outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.94); opacity: .72; }
}

.photo-card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 12px;
  background: white;
}

.photo-card img {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.photo-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.photo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.actions.small button {
  padding: 7px 10px;
  font-size: 13px;
}

.state {
  white-space: pre-wrap;
  overflow: auto;
  min-height: 180px;
  border-radius: 14px;
  background: #171512;
  color: #fff7e8;
  padding: 16px;
}

.site-footer {
  max-width: 960px;
  margin: 0 auto 48px;
  padding: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(135deg, #fffaf3, #efe6d8);
  box-shadow: 0 18px 42px rgb(50 35 20 / 7%);
}

.site-footer p {
  margin: 0;
  max-width: 680px;
}

.site-footer h2 {
  margin: 0 0 10px;
  max-width: 680px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.18;
  letter-spacing: -.035em;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
  justify-content: flex-start;
  margin-top: 18px;
}

.site-footer a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.footer-feedback-link {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 800;
}

.site-footer a:hover,
.footer-feedback-link:hover {
  text-decoration: underline;
}

.qr-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  text-decoration: none;
}

.qr-card img {
  width: 132px;
  height: 132px;
  image-rendering: pixelated;
}

.qr-card strong {
  color: var(--ink);
}

.support-widget-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  box-shadow: 0 18px 42px rgb(50 35 20 / 18%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, background .2s ease;
}

.support-widget-button:hover {
  background: #3f29d4;
}

.support-widget-button:active {
  transform: scale(.95);
}

.feedback-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgb(0 0 0 / 28%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.feedback-modal-backdrop[hidden] {
  display: none;
}

.feedback-modal {
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  background: white;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgb(0 0 0 / 28%);
}

.feedback-modal-header {
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.feedback-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.feedback-modal-title svg {
  color: var(--brand);
}

.feedback-modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  padding: 0 0 3px;
}

.feedback-modal-close:hover {
  background: #eee7dd;
  color: var(--ink);
}

.feedback-modal-body {
  padding: 30px 24px 24px;
}

.feedback-help {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 18px;
}

.feedback-modal textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 2px solid color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: 12px;
  padding: 16px;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  outline: none;
}

.feedback-modal textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(82 54 255 / 12%);
}

.feedback-modal-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.feedback-primary,
.feedback-secondary {
  min-height: 48px;
  border-radius: 12px;
  padding: 0 22px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.feedback-primary {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: white;
}

.feedback-secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.feedback-primary:disabled,
.feedback-secondary:disabled {
  cursor: wait;
  opacity: .72;
}

.feedback-privacy {
  color: var(--muted);
  font-size: 14px;
}

.feedback-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 14px;
}

.feedback-result {
  min-height: 300px;
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.feedback-result[hidden],
.feedback-modal-body[hidden] {
  display: none;
}

.feedback-result-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dce9dc;
  color: #236132;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 26px;
}

.feedback-result h2 {
  margin: 0;
}

.feedback-result p {
  margin: 0 0 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-strip {
    width: 100%;
  }

  .account-chip {
    flex: 1;
    max-width: none;
  }

  .engine-card-head {
    align-items: flex-start;
  }

  .grid.two, .grid.three, .timeline-lite, .photo-card, .site-footer {
    grid-template-columns: 1fr;
  }
  .qr-card { justify-self: start; }
  .feedback-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .feedback-modal {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 18px 18px 0 0;
  }
  .photo-card img {
    width: 100%;
    height: auto;
    max-height: 260px;
  }
}
