/* ── Dark Minimalism · Orange Accent ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0e0f14;
  --surface:     #14161d;
  --surface2:    #1a1d25;
  --surface3:    #20232e;
  --border:      #252836;
  --border2:     #1c1f2a;
  --text:        #e4e7f0;
  --text-muted:  #788095;
  --text-dim:    #3d4259;
  --accent:      #f97316;
  --accent-l:    #fb923c;
  --accent-dim:  rgba(249,115,22,0.11);
  --accent-glow: rgba(249,115,22,0.22);
  --radius:      10px;
}

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.header-left {
  display: flex; align-items: center;
}
.header-sub {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-align: center;
}
.header-center {
  display: flex; align-items: center; justify-content: center;
}
.header-logo { display: flex; align-items: center; text-decoration: none; }
.header-logo-img { height: 80px; width: auto; display: block; }

.header-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.header-admin-link {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.header-admin-link:hover { color: var(--accent); border-color: rgba(249,115,22,0.4); }
.header-credit {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: right;
  line-height: 1.4;
  opacity: 0.8;
}
.header-credit strong { font-weight: 600; }

/* ── HEADER RESPONSIVE ── */
@media (max-width: 640px) {
  header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
    padding: 12px 16px;
  }
  .header-left  { justify-content: center; }
  .header-right { align-items: center; }
}

/* ── LAYOUT ── */
.container {
  display: flex;
  gap: 16px;
  padding: 20px;
  max-width: 1460px;
  margin: 0 auto;
  align-items: flex-start;
}

/* ── LEFT PANEL ── */
.left-panel {
  flex: 0 0 350px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.section-title {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  margin-bottom: 11px;
}

/* ── CARD LIST ── */
.card-list { display: flex; flex-direction: column; gap: 2px; }

.card-radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
}
.card-radio-item:hover { background: var(--surface2); }
.card-radio-item.selected {
  background: var(--accent-dim);
  border-color: rgba(249,115,22,0.28);
}
.card-radio-item input[type="radio"] {
  accent-color: var(--accent);
  width: 14px; height: 14px;
  flex-shrink: 0; cursor: pointer;
}

.card-thumb {
  width: 50px; height: 33px;
  border-radius: 4px; flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface3) center/cover no-repeat;
}
.card-info { flex: 1; min-width: 0; }
.card-name { font-size: 0.82rem; font-weight: 600; color: #b8bed0; }
.card-desc { font-size: 0.67rem; color: var(--text-dim); margin-top: 1px; }

/* ── FIELDS SECTION ── */
.fields-divider {
  height: 1px;
  background: var(--border);
  margin: 13px 0;
}

.text-group { display: none; margin-bottom: 13px; }
.text-group.show { display: block; }
.text-group:last-child { margin-bottom: 0; }

.text-group-label {
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
}
.text-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.text-group-label span { font-size: 0.74rem; font-weight: 600; color: #9da5be; }

.text-input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface2);
  color-scheme: dark;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.text-input::placeholder { color: var(--text-dim); }


/* ── RIGHT PANEL ── */
.right-panel {
  flex: 1;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  min-height: 520px;
  display: flex;
  flex-direction: column;
}
.right-panel-title {
  font-size: 0.64rem; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1.8px; margin-bottom: 14px;
}

.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-dim); gap: 12px;
}
.empty-state svg { opacity: 0.35; }
.empty-state p { font-size: 0.84rem; font-weight: 500; }

.canvas-area {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#cardCanvas {
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border), 0 12px 48px rgba(0,0,0,0.6);
  cursor: default;
  max-width: 100%;
  height: auto;
}

.canvas-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.canvas-spinner {
  display: none;
  position: absolute;
  width: 36px; height: 36px;
  border: 3px solid rgba(249,115,22,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  pointer-events: none;
}
.canvas-wrap.loading .canvas-spinner { display: block; }
.canvas-wrap.loading #cardCanvas { opacity: 0.3; }
@keyframes spin { to { transform: rotate(360deg); } }


.btn-download {
  padding: 11px 44px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.btn-download:hover {
  background: var(--accent-l);
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-download:active { transform: scale(0.97); }
.btn-download:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── IMAGE OVERLAY (mobile save) ── */
#imgOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.img-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 100%;
}
.img-overlay-img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  display: block;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.img-overlay-hint {
  color: #ccc;
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
  line-height: 1.6;
}
.img-overlay-hint strong { color: #fff; }
.img-overlay-close {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 0.9rem;
  cursor: pointer;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ── TOAST ── */
#dlToast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a1d25;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.84rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 9999;
}
#dlToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
}
.site-footer strong { color: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 940px) {
  .container { flex-direction: column; padding: 12px; }
  .left-panel { flex: none; width: 100%; }

}
