/* If these files aren't present yet, the browser just silently falls
   back to the next font in the stack (see style rules further down) —
   nothing breaks. Drop your real files into assets/fonts/ with these
   exact names. */
@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="dark"] {
  --bg: #15171a;
  --panel: #1d2024;
  --ink: #eef0f2;
  --muted: #9a9fa6;
  --line: #33373d;
  --accent: #d97757;
  --track: #2a2d32;
  --canvas-frame: #33373d;
}

[data-theme="light"] {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e2e0da;
  --accent: #3a5a78;
  --track: #e5e2da;
  --canvas-frame: #e2e0da;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

header p {
  margin: 0 0 24px;
  color: var(--muted);
}

#theme-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field .hint {
  font-size: 0.75rem;
  opacity: 0.8;
}

.checkbox-field label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  display: flex;
}

input[type="text"],
input[type="date"],
textarea,
select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

input[type="range"] {
  width: 100%;
}

input[type="color"] {
  width: 60px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

textarea {
  resize: vertical;
}

#download-btn {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

#download-btn:hover {
  filter: brightness(1.1);
}

/* Toggle switch (Featured badge field) */
.toggle-field label {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  display: flex;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--track);
  border-radius: 999px;
  transition: background 0.15s ease;
  cursor: pointer;
}

.switch .slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.additional-options {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 12px 4px;
}

.additional-options summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
}

.additional-options summary::-webkit-details-marker {
  display: none;
}

.additional-options summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.additional-options[open] summary::before {
  transform: rotate(90deg);
}

.additional-options .field {
  padding-top: 4px;
}

.additional-options .field:last-child {
  margin-bottom: 10px;
}

.preview-panel {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

#card-canvas {
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--canvas-frame);
  border-radius: 4px;
  /* Classic black/gray transparency checkerboard — purely visual, this
     CSS background is never part of the exported PNG. */
  background-color: #1a1a1a;
  background-image:
    linear-gradient(45deg, #4d4d4d 25%, transparent 25%),
    linear-gradient(-45deg, #4d4d4d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #4d4d4d 75%),
    linear-gradient(-45deg, transparent 75%, #4d4d4d 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.site-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover {
  border-color: var(--accent);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--track);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  color: var(--muted);
}

.dropzone-text {
  margin: 0 0 2px;
  font-size: 0.85rem;
  color: var(--ink);
}

.dropzone-text strong {
  color: var(--accent);
}

.dropzone-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.stat-grid .field {
  min-width: 0;
}

.stat-grid input {
  width: 100%;
  min-width: 0;
}