/* Worker download page (/worker). Builds on app.css tokens; mobile first like the rest of the portal. */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 30; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }

/* ---------- Hero + download cards ---------- */
.wk-hero { padding: 28px 0 36px; }
.wk-hero .hero-title { margin: 16px 0 12px; }
.wk-lead { font-size: 1.0625rem; line-height: 1.7; color: var(--muted); max-width: 40rem; margin-bottom: 24px; }
@media (min-width: 640px) {
  .wk-hero { padding: 56px 0 56px; }
  .wk-lead { font-size: 1.1875rem; margin-bottom: 32px; }
}

.dl-grid { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 880px; } }
.dl-card {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px 16px; box-shadow: var(--shadow);
}
@media (min-width: 640px) { .dl-card { padding: 24px; } }
.dl-card.is-mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.dl-head { display: flex; align-items: flex-start; gap: 12px; }
.dl-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.dl-icon svg { width: 24px; height: 24px; }
.dl-title { flex: 1; min-width: 0; }
.dl-title h2 { margin: 0; font-size: 1.1875rem; line-height: 1.4; }
.dl-title p { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.55; }
.dl-mine { flex-shrink: 0; }
.dl-card:not(.is-mine) .dl-btn { background: var(--surface); }
.dl-card:not(.is-mine) .dl-btn:hover { background: var(--surface-2); }
.dl-soon { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 52px; margin: 0; padding: 8px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.dl-meta { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; gap: 4px 20px; margin: 0; font-size: .875rem; }
.dl-meta div { min-width: 0; }
.dl-meta dt { color: var(--muted); font-size: .8125rem; }
.dl-meta dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dl-sha { font-size: .875rem; }
.dl-sha > summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.dl-sha > summary:hover { color: var(--text); }
.sha-row { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sha-row code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .75rem; line-height: 1.6; overflow-wrap: anywhere; word-break: break-all; }
@media (min-width: 480px) { .sha-row { flex-direction: row; align-items: stretch; } .sha-row code { flex: 1; } }
.dl-sha p { margin: 0; }
.dl-sha p code { overflow-wrap: anywhere; }
/* Phones: the "this computer" badge goes above the icon and name, so the spec line keeps the card's
   width instead of a sliver beside the badge; version and size share a row, the file name gets its own */
@media (max-width: 479px) {
  .dl-head { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: center; }
  .dl-mine { grid-column: 1 / -1; order: -1; justify-self: start; }
  .dl-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
  .dl-meta div:last-child { grid-column: 1 / -1; }
}
.dl-mobile { max-width: 40rem; }
.dl-advanced { max-width: 880px; }
.dl-advanced > summary { font-size: .9375rem; }
.dl-advanced .secret { margin-top: 4px; }

/* ---------- Flow (what is a worker) ---------- */
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 720px) { .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.flow li { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.flow-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.flow-icon svg { width: 24px; height: 24px; }
.flow h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.flow-num { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--muted); font-size: .8125rem; font-weight: 700; display: inline-grid; place-items: center; flex-shrink: 0; line-height: 1; }
.flow p { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.65; }

/* ---------- Cards shared by earn / privacy ---------- */
.wk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; min-width: 0; }
@media (min-width: 640px) { .wk-card { padding: 24px; } }
.wk-card h3 { margin-bottom: 8px; }
.wk-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.wk-card-head h3 { margin: 0; }
.earn-grid, .priv-grid { display: grid; gap: 12px; }
@media (min-width: 820px) {
  .earn-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .priv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
.wk-card-future { background: var(--surface-2); }
.rate-list { list-style: none; margin: 12px 0 16px; padding: 0; border-top: 1px solid var(--border); }
.rate-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); line-height: 1.55; font-size: .9375rem; }
.rate-list li > span { min-width: 0; }
.rate-list .sub { display: block; color: var(--muted); font-size: .8125rem; }
.rate-list b { color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-rules { color: var(--muted); margin-bottom: 0; }
.wk-card ul.plain li + li { margin-top: 4px; }

/* ---------- Controls ---------- */
.ctrl-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 560px) { .ctrl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .ctrl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.ctrl-grid li { display: flex; gap: 12px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
@media (min-width: 960px) { .ctrl-grid li { flex-direction: column; } }
.ctrl-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.ctrl-icon svg { width: 20px; height: 20px; }
.ctrl-grid strong { display: block; line-height: 1.5; margin-bottom: 2px; }
.ctrl-grid p { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.6; }

/* ---------- Privacy ---------- */
.priv-sub { margin-top: 20px; }
.mark-list { list-style: none; margin: 0; padding: 0; }
.mark-list li { position: relative; padding: 6px 0 6px 30px; line-height: 1.6; font-size: .9375rem; }
.mark-list li::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2) center / 12px 12px no-repeat;
}
/* Line marks drawn with CSS masks so they follow the theme colours (no inline SVG per item) */
.mark-list li::after {
  content: ""; position: absolute; left: 4px; top: 13px; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat;
}
.mark-list li.ok::before { background-color: var(--ok-soft); }
.mark-list li.ok::after { color: var(--ok); --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5'/%3E%3C/svg%3E"); }
.mark-list li.no::before { background-color: var(--surface-2); }
.mark-list li.no::after { color: var(--muted); --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M3 3l6 6M9 3 3 9'/%3E%3C/svg%3E"); }
.mark-list li.info::before { background-color: var(--accent-soft); }
.mark-list li.info::after { color: var(--accent); --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='black'%3E%3Ccircle cx='6' cy='6' r='2.2'/%3E%3C/svg%3E"); }
.mark-list li { color: var(--text); }
.agree { margin-top: 16px; max-width: 880px; }
.agree ul.plain li + li { margin-top: 4px; }

/* ---------- Requirements ---------- */
.req-table-wrap { margin: 0 0 16px; }
.req-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9375rem; line-height: 1.55; }
.req-table th, .req-table td { text-align: left; vertical-align: top; }
.req-table .cell-sub { display: block; color: var(--muted); font-size: .8125rem; }
.req-table .size { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.req-table .badge { font-size: .75rem; padding: 0 8px; vertical-align: 1px; }
/* Phones: each row is a card with labelled cells */
.req-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.req-table tr { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; }
.req-table tr.rec { border-color: var(--accent); }
.req-table th[scope="row"] { display: block; font-size: 1rem; margin-bottom: 6px; }
.req-table td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 8px; padding: 3px 0; }
.req-table td::before { content: attr(data-label); color: var(--muted); font-size: .875rem; }
@media (min-width: 820px) {
  .req-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
  .req-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: table-header-group; }
  .req-table tr { display: table-row; background: none; border: 0; padding: 0; margin: 0; }
  .req-table th, .req-table td { display: table-cell; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .req-table tbody tr:last-child > * { border-bottom: 0; }
  .req-table thead th { font-size: .8125rem; font-weight: 600; color: var(--muted); background: var(--surface-2); padding-top: 10px; padding-bottom: 10px; }
  .req-table th[scope="row"] { display: table-cell; font-size: .9375rem; margin: 0; white-space: nowrap; }
  .req-table td::before { content: none; }
  .req-table tr.rec > * { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
}
.req-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 880px; }
.req-notes li { display: flex; gap: 12px; align-items: flex-start; }
.req-notes p { margin: 0; font-size: .9375rem; line-height: 1.65; }
.req-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.req-ico svg { width: 16px; height: 16px; }

/* ---------- Install guide ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; margin-bottom: 20px; }
.tab { min-height: 40px; min-width: 104px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.guide { max-width: 760px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 24px 48px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: .9375rem; line-height: 1;
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 40px; bottom: 8px; width: 2px; background: var(--border); border-radius: 2px; }
.steps > li:last-child { padding-bottom: 0; }
.steps h3 { margin: 3px 0 4px; }
.steps p { color: var(--muted); margin: 0 0 8px; }
.steps code { overflow-wrap: anywhere; }
.step-note { margin: 8px 0 0; font-size: .875rem; }
.wizard { list-style: none; margin: 8px 0 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); counter-reset: wz; }
.wizard li { counter-increment: wz; position: relative; padding: 5px 0 5px 28px; font-size: .9375rem; line-height: 1.6; }
.wizard li::before { content: counter(wz, lower-alpha) "."; position: absolute; left: 4px; top: 5px; color: var(--muted); font-weight: 600; }

/* ---------- FAQ / troubleshooting ---------- */
.faq { display: grid; gap: 8px; max-width: 880px; }
.faq .disclosure.boxed { background: var(--bg); }
.faq .disclosure > summary { line-height: 1.5; padding: 10px 0; }
.faq p { color: var(--muted); font-size: .9375rem; line-height: 1.7; margin: 0 0 8px; }
.faq p strong { color: var(--text); }
.faq code { overflow-wrap: anywhere; }
.trouble { margin: 0; display: grid; gap: 0; max-width: 880px; border-top: 1px solid var(--border); }
.trouble > div { padding: 16px 0; border-bottom: 1px solid var(--border); }
@media (min-width: 820px) { .trouble > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 24px; } }
.trouble dt { font-weight: 600; line-height: 1.55; margin-bottom: 4px; }
.trouble dd { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.7; }
.wk-final { padding-top: 0; }
.req-table .cv { min-width: 0; }

/* "ตอนนี้เครือข่ายต้องการ" (GET /api/worker-demand) */
.demand-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; max-width: 42rem; }
.demand-list li { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-wrap: anywhere; }
.demand-list span { color: var(--muted); }
