/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-page-bg:        #f7f5ff;
  --color-surface:        #ffffff;
  --color-surface-subtle: #faf8ff;
  --color-surface-inset:  #f0ecfd;
  --color-border:         #e2dcf8;
  --color-border-subtle:  #eee9fc;
  --color-border-input:   #ddd6f8;
  --color-brand:          #6c4fc4;
  --color-brand-light:    #ede9fc;
  --color-brand-muted:    #c4b5f7;
  --color-text-heading:   #2d1f6e;
  --color-text-body:      #3d3060;
  --color-text-secondary: #8b82b8;
  --color-text-muted:     #a099c8;
  --color-text-faint:     #c4bde8;
  --color-rank-1:         #c4a84f;
  --color-rank-2:         #b0b8c4;
  --color-rank-3:         #c49a6c;
  --color-rank-default:   #ddd6f8;
  --color-code-bg:        #ede9fc;
  --color-code-text:      #6c4fc4;
  --color-cowork-bg:      #e8f5ee;
  --color-cowork-text:    #1a7a4a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--color-page-bg);
  color: var(--color-text-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-brand); text-decoration: none; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: 52px;
  background: var(--color-surface);
  border-bottom: 0.5px solid var(--color-border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-heading);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.1s;
}

.back-link:hover {
  color: var(--color-brand);
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 660px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Certificate Card (large) ────────────────────────────────────────────── */
.cert-card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: 14px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.cert-card-rank-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.cert-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.cert-card-emblem {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-heading);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.emblem-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* ── Share modal ── */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.share-modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.share-modal-close:hover {
  background: var(--color-surface-inset);
  color: var(--color-text);
}

.share-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-heading);
  margin: 0;
}

.share-modal-preview-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border, #e8e6f8);
  background: #f7f6ff;
}

.share-modal-img {
  display: block;
  width: 100%;
  height: auto;
}

.share-modal-hint {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.share-modal-hint i {
  font-size: 14px;
  flex-shrink: 0;
}

.share-modal-platforms {
  display: flex;
  gap: 10px;
}

.share-plat-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 8px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  font-family: inherit;
  line-height: 1;
}
.share-plat-btn i { font-size: 17px; }
.share-plat-btn:hover { transform: translateY(-1px); }

.share-plat-linkedin {
  background: #e8f1fa;
  color: #0077B5;
  border-color: #b8d4ec;
}
.share-plat-linkedin:hover {
  background: #0077B5;
  color: #fff;
  border-color: #0077B5;
}

.share-plat-whatsapp {
  background: #e8f8ef;
  color: #1a7a3c;
  border-color: #b2dfc4;
}
.share-plat-whatsapp:hover {
  background: #25D366;
  color: #fff;
  border-color: #25D366;
}

.share-plat-x {
  background: #f0f0f0;
  color: #111;
  border-color: #ccc;
}
.share-plat-x:hover {
  background: #111;
  color: #fff;
  border-color: #111;
}

.share-modal-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: 1.5px dashed var(--color-border, #ddd6f8);
  background: none;
  color: var(--color-text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.share-modal-download:hover {
  border-color: var(--color-brand, #7c3aed);
  color: var(--color-brand, #7c3aed);
  background: var(--color-surface-inset, #f4f3ff);
}

@media (max-width: 360px) {
  .share-plat-btn span { display: none; }
  .share-plat-btn { padding: 10px; }
}

.cert-card-name {
  font-size: 26px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 12px;
  line-height: 1.3;
}

.cert-card-count-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.cert-card-count {
  font-size: 40px;
  font-weight: 500;
  color: var(--color-brand);
  line-height: 1;
}

.cert-card-count-label {
  font-size: 14px;
  color: var(--color-text-muted);
}

.cert-card-since {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-bottom: 14px;
}

.cert-card-progress-track {
  background: var(--color-surface-inset);
  border-radius: 99px;
  height: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.cert-card-progress-fill {
  background: var(--color-brand-muted);
  border-radius: 99px;
  height: 100%;
  transition: width 0.5s ease;
}

.cert-card-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 5px;
}

/* ── Section Title ───────────────────────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── Task List (card style) ──────────────────────────────────────────────── */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 2rem;
}

.task-item {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}

.task-item:hover {
  box-shadow: 0 2px 12px rgba(108,79,196,0.08);
}

.task-item-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-brand-muted);
  background: var(--color-brand-light);
  border-radius: 6px;
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-item-body {
  flex: 1;
  min-width: 0;
}

.task-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 4px;
  line-height: 1.3;
}

.task-item-link {
  color: inherit;
  text-decoration: none;
}
.task-item-link:hover {
  color: var(--color-brand);
  text-decoration: underline;
}

.task-item-context {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin-bottom: 6px;
}

.task-item-description {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-bottom: 10px;
  border-left: 2px solid var(--color-border-input);
  padding-left: 10px;
}

.task-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.tag i { font-size: 12px; }

.tag-date {
  background: var(--color-surface-inset);
  color: var(--color-text-muted);
  border: 0.5px solid var(--color-border-subtle);
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.tool-badge i { font-size: 12px; }

.tool-badge-code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
}

.tool-badge-cowork {
  background: var(--color-cowork-bg);
  color: var(--color-cowork-text);
}

.tool-badge-default {
  background: var(--color-surface-inset);
  color: var(--color-text-muted);
}

/* ── Not found ───────────────────────────────────────────────────────────── */
.not-found {
  text-align: center;
  padding: 4rem 1rem;
}

.not-found h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 8px;
}

.not-found p {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-wrapper { padding: 1.25rem 1rem; }
  .topbar { padding: 0 1rem; }
  .cert-card { padding: 1.25rem; }
  .cert-card-name { font-size: 20px; }
  .cert-card-count { font-size: 32px; }
  .task-item { padding: 0.9rem 1rem; gap: 0.75rem; }
  .task-item-title { font-size: 13px; }
  .task-item-context { font-size: 11.5px; }
  .task-item-description { font-size: 11.5px; }
}
