:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
  background: #111111;
  color: #ffffff;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(10, 132, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #121214 0%, #111111 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.safe-page {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.nav-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-bar,
.page-body {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.nav-bar {
  padding:
    calc(10px + env(safe-area-inset-top))
    14px
    8px;
}

.editor-nav {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-spacer {
  width: 56px;
}

.editor-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.editor-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.editor-subtitle {
  color: #8e8e93;
  font-size: 12px;
}

.editor-subtitle-only {
  font-size: 13px;
  line-height: 1.4;
}

.page-body {
  padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
}

.editor-body,
.editor-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  border-radius: 20px;
}

.upload-card {
  min-height: min(72vh, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  cursor: pointer;
  background:
    radial-gradient(circle at top, rgba(10, 132, 255, 0.24), transparent 34%),
    linear-gradient(180deg, #1a1b1f 0%, #17181c 52%, #111214 100%);
}

.upload-input {
  display: none;
}

.upload-card:focus-visible,
.editor-btn:focus-visible,
.chip:focus-visible,
.color-chip:focus-visible,
.source-thumb:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.72);
  outline-offset: 2px;
}

.upload-icon {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-title {
  font-size: 26px;
  font-weight: 600;
}

.upload-desc {
  margin: 10px 0 18px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1.7;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.status-main {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.6;
}

.status-side {
  flex-shrink: 0;
  font-size: 13px;
  color: #8e8e93;
}

.source-strip {
  white-space: nowrap;
}

.source-row {
  display: inline-block;
}

.source-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #161618;
  cursor: default;
}

.source-thumb-active {
  border-color: #0a84ff;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.18);
}

.source-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.source-index {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 12px;
  line-height: 24px;
  text-align: center;
}

.preview-wrap {
  position: relative;
  padding: 16px;
}

.preview-shell {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 0;
  padding-top: var(--preview-padding-top, 140.1937%);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 22px;
  background-color: #151517;
}

.preview-shell-idphoto {
  background-color: #182232;
}

.checkerboard {
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-image,
.preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background-color: transparent;
}

.info-bubble {
  margin-top: 18px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.86);
  border: 1px solid #2a2a2c;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info-label {
  color: #8e8e93;
  font-size: 12px;
}

.info-label.active,
.info-value.active {
  color: #0a84ff;
}

.info-value {
  margin-top: 6px;
  font-size: 14px;
}

.info-arrow {
  color: #8e8e93;
  font-size: 16px;
}

.preview-note {
  margin-top: 16px;
}

.control-panel {
  padding: 22px 18px 18px;
}

.sub-title {
  margin: 4px 0 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

.helper-text {
  color: #8e8e93;
  font-size: 13px;
  line-height: 1.7;
}

.helper-card {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 16px;
  background: #17181a;
  border: 1px solid #2a2a2c;
}

.helper-card-title {
  display: block;
  font-size: 13px;
  color: #78b7ff;
  margin-bottom: 8px;
}

.helper-card-text {
  display: block;
  font-size: 13px;
  color: #a9a9af;
  line-height: 1.7;
}

.chip-row {
  margin-bottom: 6px;
  font-size: 0;
}

.chip,
.color-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  margin: 0 12px 12px 0;
  border-radius: 999px;
  background: #202022;
  border: 1px solid #2a2a2c;
  color: #d8d8dc;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chip-active,
.color-chip-active {
  background: rgba(10, 132, 255, 0.18);
  border-color: rgba(10, 132, 255, 0.48);
  color: #78b7ff;
}

.color-chip {
  gap: 8px;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.editor-btn {
  flex: 1 1 180px;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.editor-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.editor-btn:not(:disabled):active {
  transform: scale(0.99);
}

.primary-btn {
  background: #0a84ff;
  color: #ffffff;
  font-weight: 600;
}

.secondary-btn {
  background: #202022;
  color: #ffffff;
  border: 1px solid #2a2a2c;
}

@media (max-width: 640px) {
  .nav-bar {
    padding:
      calc(10px + env(safe-area-inset-top))
      12px
      8px;
  }

  .page-body {
    padding: 12px 12px calc(20px + env(safe-area-inset-bottom));
  }

  .upload-card {
    min-height: 68vh;
    padding: 32px 20px;
  }

  .upload-title {
    font-size: 24px;
  }

  .preview-shell {
    max-width: 340px;
  }

  .control-panel,
  .preview-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 420px) {
  .button-row {
    display: block;
  }

  .info-bubble {
    gap: 14px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .editor-btn {
    display: block;
    margin-bottom: 12px;
  }

  .editor-btn:last-child {
    margin-bottom: 0;
  }
}
