:root {
  --paper: #ffffff;
  --ink: #20252d;
  --muted: #8b93a0;
  --line: #dfe4ec;
  --green: #5fb32b;
  --green-dark: #428e18;
  --yellow: #f6d400;
  --orange: #ff8a2c;
  --red: #ff312b;
  --shadow: 0 22px 60px rgba(73, 84, 103, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(246, 212, 0, 0.18), transparent 24%),
    linear-gradient(180deg, #fbfcff 0%, #f7faf4 100%);
}

button,
input {
  font: inherit;
}

.pdf-app {
  min-height: 100vh;
  padding: 28px clamp(18px, 3vw, 42px) 92px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto 22px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #a7aaa7, #878b86);
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(92, 98, 93, 0.2);
}

.eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(246, 212, 0, 0.28);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1 {
  margin: 10px 0 8px;
  text-align: center;
  font-size: clamp(30px, 3vw, 46px);
  line-height: 1;
}

.topbar p {
  margin: 0;
  color: #65707f;
  text-align: center;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  max-width: 920px;
  margin: 0 auto 34px;
}

.step {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #a7adb6;
  font-weight: 700;
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: #aeb4bc;
}

.step span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dedfe3;
  color: #fff;
  font-weight: 800;
}

.step.is-active span {
  background: var(--yellow);
  color: #111;
}

.step.is-active strong {
  color: #111;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto;
}

.settings-card,
.preview-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.settings-card {
  align-self: start;
  padding: 22px;
  display: grid;
  gap: 20px;
}

.field-block {
  display: grid;
  gap: 10px;
}

.field-block label,
.field-label {
  color: #3f4652;
  font-size: 16px;
  font-weight: 800;
}

.field-block input[type="text"],
.field-block input[type="number"],
.custom-size input {
  width: 100%;
  border: none;
  border-bottom: 2px solid #c9ced7;
  background: transparent;
  padding: 8px 4px;
  color: #4c5563;
  font-size: 17px;
}

.field-block input:focus,
.custom-size input:focus {
  outline: none;
  border-color: var(--green);
}

.radio-grid {
  display: grid;
  gap: 10px;
}

.radio-grid label {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}

.radio-grid input {
  accent-color: var(--yellow);
}

.radio-grid span {
  font-weight: 800;
}

.radio-grid small {
  grid-column: 2;
  color: var(--muted);
}

.custom-size,
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.custom-size label,
.two-col label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #525b67;
}

.check-line input {
  accent-color: var(--green);
}

.preview-card {
  padding: 22px;
}

.upload-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 14px;
}

.upload-button,
.primary-btn,
.ghost-btn {
  border: none;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.upload-button {
  padding: 10px 28px;
  background: linear-gradient(180deg, #63bf34, var(--green-dark));
}

.upload-panel p,
.upload-panel strong {
  margin: 0;
  color: var(--green-dark);
  font-size: 16px;
}

.thumb-strip {
  display: flex;
  gap: 10px;
  min-height: 74px;
  margin-bottom: 18px;
  padding: 10px;
  overflow-x: auto;
  border: 1px dashed #c6dfb9;
  border-radius: 18px;
  color: var(--muted);
}

.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border: 1px solid #75bf4b;
  background: #fff;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  cursor: pointer;
}

.paper-shell {
  min-height: 600px;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 28px;
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(222, 228, 236, 0.56) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(222, 228, 236, 0.56) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(222, 228, 236, 0.56) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(222, 228, 236, 0.56) 75%);
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}

.paper-shell.is-dragover {
  outline: 3px dashed var(--green);
  outline-offset: -10px;
}

.paper-a4 {
  position: relative;
  width: min(100%, 794px);
  aspect-ratio: 210 / 297;
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(63, 72, 88, 0.22);
}

.cards-page {
  position: relative;
  width: 100%;
  height: 100%;
}

.card-slot {
  position: absolute;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fffef8;
  border: 2px solid var(--red);
}

.card-slot::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 2px dashed var(--orange);
  border-radius: 8%;
  pointer-events: none;
}

.card-slot.no-bleed {
  border-color: #e2e6ed;
}

.card-slot.no-safe::after {
  display: none;
}

.card-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-slot.contain img {
  object-fit: contain;
}

.empty-slot {
  color: var(--orange);
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 800;
}

.print-note {
  margin: 18px 0 0;
  color: #111;
  font-size: 15px;
  font-weight: 800;
}

.print-note::first-letter {
  color: var(--red);
}

.action-bar {
  position: fixed;
  right: 24px;
  bottom: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(73, 84, 103, 0.18);
}

.summary {
  color: #525c68;
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 12px;
}

.ghost-btn,
.primary-btn {
  min-width: 104px;
  padding: 11px 22px;
}

.ghost-btn {
  background: linear-gradient(180deg, #aaaead, #858a87);
}

.primary-btn {
  background: linear-gradient(180deg, #69bf2f, #4f9f19);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    text-align: center;
  }

  .back-link {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .pdf-app {
    padding: 18px 12px 126px;
  }

  .stepper {
    overflow-x: auto;
    grid-template-columns: repeat(5, 140px);
    justify-content: start;
  }

  .settings-card,
  .preview-card {
    border-radius: 22px;
  }

  .custom-size,
  .two-col {
    grid-template-columns: 1fr;
  }

  .paper-shell {
    padding: 14px;
    min-height: 420px;
  }

  .paper-a4 {
    width: min(100%, 420px);
  }

  .action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .ghost-btn,
  .primary-btn {
    flex: 1;
  }
}
