:root {
    --ink: #17324d;
    --muted: #66798b;
    --line: #dbe4eb;
    --soft: #f4f7f9;
    --paper: #ffffff;
    --accent: #168f75;
    --accent-dark: #0f725f;
    --accent-soft: #e9f7f3;
    --warn: #b26b16;
    --warn-soft: #fff6e8;
    --danger: #b94242;
    --danger-soft: #fff0f0;
    --shadow: 0 18px 48px rgba(30, 56, 78, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(22, 143, 117, 0.09), transparent 30%),
        linear-gradient(180deg, #f8fafb 0%, #eef3f6 100%);
    font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.license-shell { min-height: 100vh; display: flex; flex-direction: column; }

.license-header {
    height: 76px;
    padding: 0 clamp(24px, 5vw, 72px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(219, 228, 235, 0.9);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
}

.license-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.license-brand strong { display: block; font-size: 18px; letter-spacing: 0.01em; }
.license-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: white;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--ink), #285879);
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(23, 50, 77, 0.2);
}

.header-security { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.security-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }

.license-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 40px; flex: 1; }

.license-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
.license-intro h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.035em; }
.license-intro p { max-width: 720px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
code { padding: 2px 6px; border-radius: 5px; color: #31536a; background: #edf2f5; font-family: Consolas, monospace; font-size: 0.9em; }

.status-badge { min-width: 178px; padding: 12px 16px; display: flex; justify-content: center; align-items: center; gap: 9px; border: 1px solid #edcf9b; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 13px; }
.status-badge.is-valid { color: var(--accent-dark); border-color: #b9dfd4; background: var(--accent-soft); }
.status-badge.is-invalid { color: var(--danger); border-color: #efc2c2; background: var(--danger-soft); }
.status-badge.is-loading { color: var(--muted); border-color: var(--line); background: var(--soft); }
.status-icon { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: currentColor; color: white; font-size: 11px; }

.message-bar { margin-bottom: 20px; padding: 13px 16px; border: 1px solid #efc2c2; border-radius: 10px; color: var(--danger); background: var(--danger-soft); font-size: 14px; }

.activation-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr); gap: 22px; align-items: stretch; }
.card { padding: 30px; border: 1px solid rgba(210, 222, 231, 0.95); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 26px; }
.card-heading h2 { margin: 0 0 5px; font-size: 21px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.step-number { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; color: white; border-radius: 10px; background: var(--ink); font-size: 13px; font-weight: 800; }

.request-meta { margin: 0 0 26px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.request-meta div { min-width: 0; padding: 14px 16px; background: #fbfcfd; }
.request-meta div:nth-child(odd) { border-right: 1px solid var(--line); }
.request-meta div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.request-meta dt { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.request-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; font-size: 13px; font-weight: 700; }

.request-actions { display: flex; gap: 10px; }
.button { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; text-decoration: none; font-weight: 750; font-size: 14px; transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .text-button:focus-visible, .license-dropzone:focus-within { outline: 3px solid rgba(22, 143, 117, 0.22); outline-offset: 2px; }
.button-primary { color: white; background: var(--accent); box-shadow: 0 8px 18px rgba(22, 143, 117, 0.18); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { color: var(--ink); border-color: var(--line); background: white; }
.button-secondary:hover:not(:disabled) { background: var(--soft); }
.button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.button-wide { width: 100%; margin-top: 14px; }

.qr-panel { margin-top: 20px; padding: 18px; display: grid; grid-template-columns: minmax(360px, 465px) 1fr; gap: 24px; align-items: center; border: 1px solid #b9dfd4; border-radius: 14px; background: var(--accent-soft); }
.qr-image-wrap { padding: 10px; border-radius: 10px; background: white; box-shadow: 0 6px 20px rgba(31, 70, 78, 0.1); }
.qr-image-wrap img { width: 100%; display: block; image-rendering: pixelated; }
.qr-copy h3 { margin: 0 0 7px; font-size: 15px; }
.qr-copy p { margin: 0 0 10px; color: #4c6f6a; font-size: 12px; line-height: 1.7; }
.license-qr-panel { margin: 0 0 24px; grid-template-columns: minmax(360px, 465px) 1fr; }
.license-qr-panel .qr-image-wrap { min-height: 360px; display: grid; place-items: center; }
.license-qr-panel .qr-image-wrap img { max-width: 465px; }
.qr-loading-text { padding: 24px; color: var(--muted); font-size: 13px; text-align: center; }
.text-button { padding: 0; border: 0; color: var(--accent-dark); background: none; cursor: pointer; font-size: 13px; font-weight: 750; }
.text-button:hover { text-decoration: underline; }

.security-note { margin-top: 20px; padding: 12px 14px; display: flex; gap: 10px; color: #5c7181; border-radius: 10px; background: var(--soft); font-size: 12px; line-height: 1.6; }
.security-note > span { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; color: white; border-radius: 50%; background: #7890a1; font-family: Georgia, serif; font-weight: 700; }
.security-note p { margin: 0; }
.regenerate-button { margin-top: 16px; color: var(--muted); }

.license-dropzone { min-height: 190px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1.5px dashed #b9c8d3; border-radius: 14px; background: #fbfcfd; cursor: pointer; text-align: center; transition: border 0.15s ease, background 0.15s ease; }
.license-dropzone:hover, .license-dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.license-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.license-dropzone strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.license-dropzone > span:not(.upload-mark) { color: var(--muted); font-size: 12px; }
.upload-mark { width: 46px; height: 46px; margin-bottom: 5px; display: grid; place-items: center; color: var(--accent-dark); border-radius: 14px; background: var(--accent-soft); font-size: 24px; }
.validation-list { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.validation-list h3 { margin: 0 0 10px; font-size: 13px; }
.validation-list ul { margin: 0; padding-left: 19px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.standalone-hint { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.standalone-hint a { margin-left: 4px; color: var(--accent-dark); font-weight: 700; }

.valid-license-card { margin-bottom: 22px; padding: 28px 30px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; border: 1px solid #b9dfd4; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.valid-license-card h2 { margin: 5px 0; font-size: 22px; }
.valid-license-card p { margin: 0; color: var(--muted); }
.valid-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: white; background: var(--accent); font-size: 24px; font-weight: 800; }

.activation-steps { margin-top: 24px; padding: 18px 24px; display: flex; align-items: center; justify-content: center; gap: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.66); }
.activation-steps div { display: flex; align-items: center; gap: 10px; }
.activation-steps div > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--ink); background: #e6edf2; font-size: 12px; font-weight: 800; }
.activation-steps p { margin: 0; color: var(--muted); font-size: 11px; }
.activation-steps strong { display: block; color: var(--ink); font-size: 12px; }
.activation-steps i { width: 54px; height: 1px; background: var(--line); }

.license-footer { min-height: 58px; padding: 0 clamp(24px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #8292a0; border-top: 1px solid var(--line); font-size: 11px; }
.license-toast { position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 48px)); padding: 13px 16px; color: white; border-radius: 10px; background: var(--ink); box-shadow: 0 14px 36px rgba(23, 50, 77, 0.25); font-size: 13px; z-index: 50; }
.license-toast.is-error { background: var(--danger); }

@media (max-width: 860px) {
    .license-main { padding-top: 42px; }
    .license-intro { align-items: flex-start; flex-direction: column; }
    .activation-layout { grid-template-columns: 1fr; }
    .status-badge { min-width: 0; }
    .activation-steps { align-items: stretch; flex-direction: column; }
    .activation-steps i { width: 1px; height: 18px; margin-left: 13px; }
}

@media (max-width: 560px) {
    .license-header { height: 68px; padding: 0 18px; }
    .header-security { display: none; }
    .license-main { width: min(100% - 24px, 1180px); padding-top: 30px; }
    .card { padding: 22px 18px; border-radius: 14px; }
    .request-meta { grid-template-columns: 1fr; }
    .request-meta div:nth-child(odd) { border-right: 0; }
    .request-meta div:not(:last-child) { border-bottom: 1px solid var(--line); }
    .request-actions { flex-direction: column; }
    .qr-panel { grid-template-columns: 1fr; }
    .qr-image-wrap { width: min(465px, 100%); margin: 0 auto; }
    .valid-license-card { grid-template-columns: auto 1fr; }
    .valid-license-card .button { grid-column: 1 / -1; }
    .license-footer { padding: 14px 18px; align-items: flex-start; flex-direction: column; }
}
