*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
:root {
  --bg:#F4F7FB; --surface:#FFFFFF; --surface-2:#EEF2F8; --border:#D5DDE9;
  --blue:#0078AF; --mint:#34EBB7; --mint-ink:#053D30; --slate:#2F3E50;
  --text:#0E1A2E; --text-secondary:#4A607A;
  --amber:#875500;
  --red:#C0392B; --red-dim:rgba(192,57,43,.08); --green:#1A7F4B;
  --cn:'Microsoft JhengHei','PingFang TC','Noto Sans TC',sans-serif; --en:system-ui,sans-serif;
  --radius:10px; --radius-sm:6px;
  --card-shadow:0 1px 3px rgba(14,26,46,.06),0 4px 16px rgba(14,26,46,.07);
}
:root, .certificate {
  --accent:#0078AF; --accent-ink:#FFFFFF; --accent-hover:#00618F;
  --accent-text:#00618F; --accent-soft:#EEF5FA; --accent-border:#C9DDEB;
}
:root[data-training-type="S"], .certificate[data-type="S"] {
  --accent:#34EBB7; --accent-ink:#053D30; --accent-hover:#2AD6A6;
  --accent-text:#053D30; --accent-soft:#F1F7F5; --accent-border:#CFE3DC;
}
html { scroll-behavior:smooth; }
body { background:var(--bg); color:var(--text); font-family:var(--cn); font-size:16px; line-height:1.7; min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; overflow-wrap:anywhere; }
body > main { flex:1 0 auto; width:100%; }
body > header, body > nav, body > footer { flex-shrink:0; }
[hidden] { display:none!important; }
button, input { font:inherit; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible { outline:3px solid var(--amber); outline-offset:3px; }

/* Official header branding stays blue for both training types. */
.m-head { background:#FFFFFF; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; padding:10px 20px; min-height:56px; flex-wrap:wrap; }
.brand { display:inline-flex; align-items:center; gap:10px; text-decoration:none; flex:none; }
.logo { display:block; width:auto; height:30px; object-fit:contain; flex:none; }
.m-head .sep { width:1px; height:20px; background:var(--border); flex:none; }
.m-head .site { color:var(--text-secondary); font-size:14px; font-weight:500; }
.m-foot { border-top:1px solid var(--border); color:var(--text-secondary); font-size:12px; padding:10px 20px; text-align:center; line-height:1.6; }
.m-foot a { color:var(--blue); }
.foot-sep { margin:0 8px; color:var(--border); }
.notice { display:grid; gap:10px; line-height:1.8; }
.notice p, .notice ul { margin:0; }
.notice ul { padding-left:1.4em; display:grid; gap:4px; }
.notice h2 { margin:14px 0 0; font-size:17px; color:var(--slate); }
.notice .official-url { padding:10px 14px; border-radius:var(--radius); background:var(--accent-soft); color:var(--blue); font-weight:700; font-size:16px; overflow-wrap:anywhere; }
.notice .official-host { font-weight:700; color:var(--blue); }
.fraud-line { margin:8px 0 0; font-size:13px; color:var(--text-secondary); overflow-wrap:anywhere; }
.domain { white-space:nowrap; font-weight:600; }
.fraud-line a, .fraud-tip a { color:var(--blue); margin-left:4px; white-space:nowrap; }
.portal .fraud-tip { display:grid; grid-template-columns:22px minmax(0,1fr); gap:10px; align-items:start; margin-top:22px; padding:10px 14px; border-radius:12px; background:#FFF7E8; border:1px solid #F2DDB3; color:#5C4300; font-size:13.5px; line-height:1.6; }
.portal .fraud-tip svg { width:22px; height:22px; color:#B7791F; }
.portal .fraud-tip strong { margin-right:6px; font-size:14.5px; }
.portal .fraud-tip p { display:inline; margin:0; overflow-wrap:anywhere; }
@media (max-width:600px) { .foot-sep { display:none; } .m-foot a { display:block; } }

/* Landing banner, timeline and entrance cards. */
.portal .m-body { max-width:1000px; margin:0 auto; padding:44px 32px 56px; display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); gap:64px; align-items:start; }
.portal { font-size:14px; line-height:1.6; }
.a1-banner { background:#0B1F3A; }
.a1-banner picture { display:block; }
.a1-banner img { display:block; width:100%; height:auto; max-height:clamp(220px,36vh,440px); object-fit:cover; object-position:50% 47%; }
.portal .visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.portal .eyebrow { margin:0 0 18px; font-size:12px; font-weight:800; letter-spacing:.12em; color:var(--blue); }
.portal .c-steps { margin:0; padding:0; list-style:none; display:grid; gap:22px; counter-reset:step; }
.portal .c-steps li { position:relative; display:grid; grid-template-columns:34px minmax(0,1fr); gap:14px; align-items:center; counter-increment:step; color:var(--slate); font-size:17px; font-weight:600; }
.portal .c-steps li::before { content:counter(step); width:34px; height:34px; border-radius:50%; background:var(--blue); color:var(--surface); display:grid; place-items:center; font-size:14px; position:relative; z-index:1; }
.portal .c-steps li + li::after { content:""; position:absolute; left:16px; bottom:34px; width:2px; height:22px; background:var(--accent-border); }
.portal .c-acts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.portal .c-btn { position:relative; display:flex; flex-direction:column; justify-content:space-between; align-items:flex-start; text-align:left; aspect-ratio:1; gap:6px; padding:24px; border-radius:20px; text-decoration:none; color:var(--surface); background:linear-gradient(150deg,color-mix(in srgb,var(--blue),white 18%),var(--blue) 70%); box-shadow:0 16px 32px -18px rgba(0,120,175,.8); transition:transform .2s ease,box-shadow .2s ease; }
.portal .c-btn strong { font-size:22px; line-height:1.4; }
.portal .c-btn small { font-size:13px; line-height:1.5; }
.portal .c-btn.s { background:linear-gradient(150deg,color-mix(in srgb,var(--mint),white 27%),var(--mint) 70%); color:var(--mint-ink); box-shadow:0 16px 32px -18px rgba(20,160,120,.7); }
.portal .ico { width:48px; height:48px; flex-shrink:0; border-radius:14px; display:grid; place-items:center; background:rgba(255,255,255,.2); }
.portal .s .ico { background:rgba(5,61,48,.1); }
.portal .ico svg, .portal .go svg { width:24px; height:24px; display:block; }
.portal .txt { display:grid; gap:6px; padding-right:28px; }
.portal .go { position:absolute; right:22px; bottom:24px; }
.portal .c-btn.q { grid-column:1 / -1; aspect-ratio:auto; flex-direction:row; align-items:center; gap:14px; padding:16px 22px; border-radius:16px; background:var(--surface); color:var(--slate); border:1.5px solid var(--border); box-shadow:0 8px 20px -16px rgba(8,30,60,.5); }
.portal .q strong { font-size:18px; }
.portal .q .ico { width:40px; height:40px; border-radius:12px; background:var(--accent-soft); color:var(--blue); }
.portal .q .go { position:static; margin-left:auto; color:var(--text-secondary); }
.portal .c-btn:hover { transform:translateY(-3px); }
/* Desktop landing sizes follow the owner's 125% zoom preference. */
@media (min-width:768px) {
  .portal .m-body { max-width:1250px; padding:40px 40px 44px; gap:80px; }
  .portal { font-size:17.5px; }
  .portal .eyebrow { margin:0 0 22.5px; font-size:15px; }
  .portal .c-steps { gap:20px; }
  .portal .c-steps li { grid-template-columns:42.5px minmax(0,1fr); gap:17.5px; font-size:21.5px; }
  .portal .c-steps li::before { width:42.5px; height:42.5px; font-size:17.5px; }
  .portal .c-steps li + li::after { left:20px; bottom:42.5px; width:2.5px; height:20px; }
  .portal .c-acts { gap:20px; max-width:580px; }
  .portal .c-btn { gap:7.5px; padding:30px; border-radius:25px; }
  .portal .c-btn strong { font-size:27.5px; }
  .portal .c-btn small { font-size:16.5px; }
  .portal .ico { width:60px; height:60px; border-radius:17.5px; }
  .portal .ico svg, .portal .go svg { width:30px; height:30px; }
  .portal .txt { gap:7.5px; padding-right:35px; }
  .portal .go { right:27.5px; bottom:30px; }
  .portal .c-btn.q { gap:17.5px; padding:20px 27.5px; border-radius:20px; border:2px solid var(--border); }
  .portal .q strong { font-size:22.5px; }
  .portal .q .ico { width:50px; height:50px; border-radius:15px; }
}
@media (min-width:768px) and (max-width:1100px) {
  .portal .m-body { padding:35px 24px 45px; gap:32px; grid-template-columns:minmax(0,.65fr) minmax(0,1.35fr); }
}
@media (max-width:1100px) {
  .portal .c-btn { padding:16px; }
  .portal .c-btn strong { font-size:16px; }
  .portal .c-btn small { font-size:11.5px; }
  .portal .ico { width:38px; height:38px; }
  .portal .txt { padding-right:0; }
  .portal .go { right:14px; top:18px; bottom:auto; }
}
@media (min-width:768px) and (max-width:1100px) {
  .portal .c-steps li { grid-template-columns:38px minmax(0,1fr); font-size:19px; }
  .portal .c-steps li::before { width:38px; height:38px; font-size:16px; }
  .portal .c-steps li + li::after { left:18px; bottom:38px; }
  .portal .c-btn { padding:22px; }
  .portal .c-btn strong { font-size:21px; }
  .portal .c-btn small { font-size:14px; }
  .portal .ico { width:48px; height:48px; }
  .portal .go { right:20px; top:24px; }
  .portal .q strong { font-size:19px; }
  .portal .q .ico { width:44px; height:44px; }
}
@media (max-width:767px) {
  .portal .m-body { grid-template-columns:minmax(0,1fr); gap:32px; padding:28px 16px 36px; }
  .portal .c-steps { gap:14px; }
  .portal .c-steps li { font-size:15px; grid-template-columns:30px minmax(0,1fr); }
  .portal .c-steps li::before { width:30px; height:30px; font-size:13px; }
  .portal .c-steps li + li::after { left:14px; bottom:30px; height:14px; }
}
@media (max-width:600px) {
  .portal .c-acts { gap:12px; }
  .portal .c-btn { padding:16px; border-radius:16px; }
  .portal .c-btn strong { font-size:16px; }
  .portal .c-btn small { font-size:11.5px; }
  .portal .ico { width:38px; height:38px; border-radius:11px; }
  .portal .ico svg { width:20px; height:20px; }
  .portal .c-btn.q { padding:12px 16px; }
}
@media (prefers-reduced-motion:reduce) { .portal .c-btn { transition:none; } .portal .c-btn:hover { transform:none; } }

.page-heading { width:100%; max-width:720px; margin:0 auto; padding:24px 40px 12px; text-align:left; }
.page-heading h1 { font-size:24px; font-weight:900; line-height:1.4; margin:0 0 4px; overflow-wrap:anywhere; }
.page-heading .lead { font-size:14px; color:var(--text-secondary); overflow-wrap:anywhere; }

.progress-row { width:100%; display:flex; align-items:flex-start; justify-content:center; padding:8px 40px 0; max-width:720px; margin:0 auto; }
.progress-step { display:flex; flex-direction:column; align-items:center; gap:6px; flex:1; min-width:0; }
.progress-dot { width:34px; height:34px; border-radius:50%; border:2px solid var(--border); background:var(--surface); display:flex; align-items:center; justify-content:center; font-family:var(--en); font-size:14px; font-weight:600; color:var(--text-secondary); }
.progress-dot.active { border-color:var(--accent); background:var(--accent); color:var(--accent-ink); }
.progress-dot.done { border-color:var(--green); background:var(--green); color:#FFFFFF; }
.progress-label { font-size:11px; color:var(--text-secondary); text-align:center; }
.form-wrap { max-width:720px; margin:0 auto; padding:16px 40px 40px; }
.step-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--card-shadow); overflow:hidden; }
.step-header { padding:20px 28px; border-bottom:1px solid var(--border); background:var(--surface-2); font-size:15px; font-weight:700; }
.step-body { padding:24px 28px 28px; }
.wizard-nav { display:flex; gap:12px; justify-content:space-between; margin-top:20px; }
.btn-prev, .btn-next { padding:13px 26px; border-radius:var(--radius-sm); font-size:15px; font-weight:600; letter-spacing:.04em; border:1px solid transparent; }
.btn-prev { background:var(--surface); color:var(--text-secondary); border-color:var(--border); }
.btn-prev:hover { background:var(--surface-2); }
.btn-next { background:var(--accent); color:var(--accent-ink); margin-left:auto; }
.btn-next:hover:not(:disabled) { background:var(--accent-hover); }
.btn-next:disabled { background:var(--border); color:var(--text-secondary); }
.field { min-width:0; border:0; padding:0; margin-bottom:20px; }
.field:last-child { margin-bottom:0; }
.required-mark { color:var(--red); }
.field legend { width:100%; font-weight:500; margin-bottom:8px; }
.help { white-space:pre-wrap; font-size:13px; color:var(--text-secondary); margin:8px 0; }
input[type="text"], input[type="date"] { width:100%; min-width:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:11px 14px; font-size:15px; color:var(--text); }
input::placeholder { color:var(--text-secondary); }
input:focus { border-color:var(--accent-text); }
input:disabled { background:var(--surface-2); color:var(--text-secondary); cursor:not-allowed; }
.radio-opt { display:flex; align-items:center; gap:10px; padding:10px 14px; margin-bottom:8px; border:1.5px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; font-size:14px; color:var(--text); }
.radio-opt input { accent-color:var(--accent); flex-shrink:0; }
.radio-opt:hover, .radio-opt:has(input:checked) { border-color:var(--accent-text); background:var(--accent-soft); color:var(--accent-text); }
.radio-opt:has(input:disabled) { cursor:not-allowed; }
.video-wrap { position:relative; width:100%; aspect-ratio:16/9; border-radius:var(--radius-sm); overflow:hidden; border:1px solid var(--border); }
.video-wrap iframe { position:absolute; inset:0; width:100%; height:100%; border:none; }
.privacy-box { white-space:pre-wrap; max-height:320px; overflow-y:auto; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px 18px; font-size:13px; line-height:1.8; color:var(--text-secondary); margin-bottom:16px; }
.field.wrong { border-left:3px solid var(--red); padding-left:12px; background:var(--red-dim); }
.field-error { color:var(--red); font-size:13px; margin-top:8px; }
.field-error:empty, #message:empty { display:none; }
#message { margin:16px 0; white-space:pre-wrap; }
#message.error { color:var(--red); padding:12px; background:var(--red-dim); border-radius:6px; }
#retry { padding:10px 20px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--text); }

#results { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; align-items:start; }
@media (min-width:768px) { #results { grid-template-columns:repeat(2,minmax(0,1fr)); } }
.certificate { display:grid; justify-items:center; gap:12px; margin:12px 0; min-width:0; }
.cert-status { font-size:14px; font-weight:700; text-align:center; }
.badge-preview { width:100%; max-width:300px; }
.badge-preview svg { width:100%; height:auto; display:block; }
.badge-qr { width:240px; max-width:100%; text-align:center; }
.badge-qr svg { width:100%; height:auto; display:block; }
.badge-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.badge-actions a, .badge-actions button { text-decoration:none; font:inherit; font-size:14px; padding:10px 14px; border:1px solid var(--border); border-radius:6px; color:var(--text); background:var(--surface); }
.badge-actions a { background:var(--accent); color:var(--accent-ink); border-color:var(--accent-border); }
.badge-actions a:hover { background:var(--accent-hover); }
.badge-actions button:hover:not(:disabled) { background:var(--surface-2); }
.badge-actions button:disabled { background:var(--border); color:var(--text-secondary); }
#success h2 { font-size:24px; line-height:1.4; margin-bottom:4px; }
#success > p { font-size:14px; color:var(--text-secondary); }
.training-complete .page-heading, .training-complete #progress { display:none; }
.training-complete .form-wrap { padding-top:24px; padding-bottom:28px; }
.badge-main { width:100%; max-width:380px; margin:0 auto; padding:24px 20px 28px; }
.badge-main .fraud-line { margin-top:16px; text-align:center; }

@media (max-width:600px) {
  .page-heading { padding:24px 16px 12px; }
  .progress-row { padding:8px 16px 0; }
  .form-wrap { padding:16px 16px 40px; }
  .step-header { padding:16px; } .step-body { padding:20px 16px; }
  .wizard-nav { flex-direction:column-reverse; }
  .btn-next, .btn-prev { margin-left:0; width:100%; }
}
@media (max-width:360px) { .m-head .site { flex-basis:100%; } .m-head .sep { display:none; } }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } }
@media print {
  .m-head, .page-heading, .m-foot, .fraud-line, .progress-row, .wizard-nav, .badge-actions, .badge-qr, #message, #retry, .cert-status, #lookup-form { display:none!important; }
  body { background:#FFFFFF; display:block; min-height:0; }
  .badge-main, .form-wrap { padding:0; }
}
