:root {
  --fp-green: #009844;
  --fp-green-dark: #007a37;
  --fp-blue: #0a5fb4;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #687482;
  --border: #e2e8f0;
  --danger: #d4351c;
  --radius: 14px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--fp-green), var(--fp-blue));
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: 0.5px; }
.logo b { color: #ffe14d; }
.brand-sub { font-size: 13px; opacity: 0.9; }
.topbar-link { color: #fff; text-decoration: none; font-size: 13px; opacity: 0.9; }
.topbar-link:hover { opacity: 1; text-decoration: underline; }

/* Layout */
.container {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--fp-green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* Notice */
.notice {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  color: #7a5a00;
}

/* Dropzone */
.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--fp-green);
  background: #f0fbf4;
}
.dz-icon { font-size: 34px; }
.dz-title { margin: 8px 0 4px; font-weight: 600; }
.dz-title u { color: var(--fp-green); }
.dz-hint { margin: 0; font-size: 12.5px; color: var(--muted); }

/* File list */
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}
.file-item .fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fi-size { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.file-item .fi-state { font-size: 12px; white-space: nowrap; }
.file-item .fi-state.ok { color: var(--fp-green); }
.file-item .fi-state.err { color: var(--danger); }
.file-item .fi-state.busy { color: var(--fp-blue); }
.file-item .fi-remove {
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px;
}
.file-item .fi-remove:hover { color: var(--danger); }
.file-item.invalid { border-color: #f5c6c0; background: #fdf2f1; }

/* Size bar */
.size-bar {
  position: relative;
  margin-top: 12px;
  height: 22px;
  background: #eef2f6;
  border-radius: 11px;
  overflow: hidden;
}
.size-bar-fill { height: 100%; width: 0; background: var(--fp-green); transition: width 0.2s; }
.size-bar-fill.over { background: var(--danger); }
.size-bar-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text);
}

/* Spec grid */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field select, .field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}
.field select:focus, .field input:focus { outline: 2px solid var(--fp-green); border-color: transparent; }

/* Submit */
.submit-card { text-align: center; }
.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--fp-green);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--fp-green-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.loading { position: relative; color: transparent; }
.btn-primary.loading::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-msg { margin: 12px 0 0; font-size: 14px; color: var(--fp-blue); min-height: 20px; }
.status-msg.err { color: var(--danger); }

/* Result */
.result-card { border: 2px solid var(--fp-green); }
.result-body { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.qr-box {
  background: #fff; padding: 8px; border: 1px solid var(--border);
  border-radius: 12px; line-height: 0;
}
.qr-box img, .qr-box canvas { width: 168px; height: 168px; }
.result-info { flex: 1; min-width: 220px; }
.code-label { font-size: 13px; color: var(--muted); }
.code-value {
  font-size: 34px; font-weight: 800; letter-spacing: 3px;
  color: var(--fp-blue); margin: 2px 0 10px; word-break: break-all;
}
.result-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0; }
.result-meta div { font-size: 14px; }
.result-meta dt { display: inline; color: var(--muted); margin-right: 6px; }
.result-meta dd { display: inline; margin: 0; font-weight: 600; }
.result-tip { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.btn-ghost {
  margin-top: 8px;
  padding: 9px 16px;
  border: 1px solid var(--fp-green);
  background: #fff;
  color: var(--fp-green);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.btn-ghost:hover { background: #f0fbf4; }
.result-card > .btn-ghost { display: block; width: 100%; margin-top: 20px; }

.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }

@media (max-width: 540px) {
  .spec-grid { grid-template-columns: 1fr; }
  .code-value { font-size: 28px; }
}
