/* ---------- Article detail ---------- */
.article-wrap {
  max-width: 820px;
  padding-top: 32px;
  padding-bottom: 64px;
}

/* Download page: X1 release card */
.dl-x1 {
  margin: 0 0 2.5rem;
  padding: 1.75rem;
  border: 1px solid #e3e6ea;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}
.dl-x1-head {
  margin-bottom: 1.25rem;
}
.dl-x1-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  line-height: 1.25;
}
.dl-x1-desc {
  margin: 0;
  color: #4b5563;
  font-size: 1rem;
  line-height: 1.6;
}
.dl-x1-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.dl-x1-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
}
.dl-x1-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.dl-x1-row dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.dl-x1-row dd {
  margin: 0;
  font-size: 0.95rem;
  color: #111827;
  word-break: break-word;
}
.dl-x1-hash {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #374151;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.dl-x1-sig {
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.5rem 0.75rem;
}
.dl-x1-sig summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}
.dl-x1-sig-body {
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.dl-x1-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.dl-x1-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.dl-x1-btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
}
.dl-x1-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.dl-x1-btn-secondary {
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #2563eb;
}
.dl-x1-btn-secondary:hover {
  background: #eff6ff;
}
@media (max-width: 640px) {
  .dl-x1 {
    padding: 1.25rem;
  }
  .dl-x1-title {
    font-size: 1.4rem;
  }
  .dl-x1-meta {
    grid-template-columns: minmax(0, 1fr);
  }
  .dl-x1-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .dl-x1-btn {
    text-align: center;
  }
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb .sep {
  margin: 0 6px;
  color: var(--border);
}

.article-head {
  margin-bottom: 28px;
}

.article-head h1 {
  font-size: 2.1rem;
  margin-bottom: 0.4em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.article-cover {
  margin: 0 0 28px;
}

.article-cover img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article-body {
  max-width: 760px;
  font-size: 1.02rem;
  line-height: 1.75;
}

.article-body h2 {
  margin-top: 1.6em;
}

.article-body h3 {
  margin-top: 1.3em;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
}

.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.article-body th {
  background: var(--bg-alt);
}

.article-body blockquote {
  margin: 1.2em 0;
  padding: 8px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  color: #374151;
}

.article-body pre {
  overflow-x: auto;
}

.article-body code {
  background: var(--bg-alt);
  padding: 1px 5px;
  border-radius: 4px;
}

.article-body pre code {
  background: none;
  padding: 0;
}

.article-tags {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tags-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.article-foot {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.badge-fallback {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #fde68a;
}

.preview-bar {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fde68a;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Article list ---------- */
.list-head {
  margin-bottom: 28px;
}

.list-head h1 {
  margin-bottom: 0.3em;
}

.list-intro {
  color: var(--muted);
  max-width: 720px;
}

.list-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: 4px;
}

.filter-chip {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  background: var(--bg);
}

.filter-chip:hover {
  color: var(--text);
  border-color: #cbd5e1;
  text-decoration: none;
}

.article-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.article-card:last-child {
  border-bottom: none;
}

.card-title {
  font-size: 1.2rem;
  margin: 0 0 6px;
}

.card-title a {
  color: var(--text);
}

.card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-summary {
  margin: 0;
  color: #374151;
  font-size: 0.95rem;
}

.empty-state {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.pagination .btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.page-info {
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- Editor ---------- */
.ed-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.ed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 100%;
  overflow-x: auto;
}

.ed-sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--border);
  flex: 0 0 auto;
}

.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #374151;
  cursor: pointer;
}

.ed-btn:hover {
  background: #eef4ff;
  border-color: var(--border);
}

.ed-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ed-btn.is-active {
  background: #dbe7ff;
  color: #1d4ed8;
  border-color: #bfd3ff;
}

.ed-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.ed-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.ed-glyph {
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
}

.ed-glyph i,
.ed-glyph u {
  font-style: normal;
  text-decoration: none;
}

.ed-btn-inline .ed-glyph i {
  font-style: italic;
}

.ed-btn-inline .ed-glyph u {
  text-decoration: underline;
}

.ed-area {
  min-height: 360px;
  padding: 14px 16px;
  outline: none;
  font-size: 0.98rem;
  line-height: 1.7;
  overflow-x: auto;
}

.ed-area:focus {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ed-area img {
  max-width: 100%;
  height: auto;
}

.ed-area table {
  border-collapse: collapse;
  margin: 0.8em 0;
}

.ed-area th,
.ed-area td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  min-width: 60px;
}

.ed-area blockquote {
  margin: 0.8em 0;
  padding: 6px 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
}

.ed-source {
  width: 100%;
  min-height: 360px;
  padding: 14px 16px;
  border: none;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
}

.upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-row input {
  flex: 1;
}

.lang-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  background: var(--bg-alt);
}

.lang-section summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.lang-section[open] summary {
  margin-bottom: 16px;
}

.lang-section .field {
  margin-bottom: 14px;
}

/* ---------- Admin table tweaks ---------- */
.admin-main .table td.actions {
  white-space: nowrap;
}

.admin-main .table td.actions .btn {
  margin-right: 4px;
}

.admin-main .toolbar {
  align-items: flex-end;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .article-head h1 {
    font-size: 1.6rem;
  }

  .article-body {
    font-size: 1rem;
  }

  .article-wrap {
    padding-top: 20px;
  }

  .ed-area,
  .ed-source {
    min-height: 280px;
  }

  .upload-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 390px) {
  .article-body pre,
  .article-body table {
    max-width: 100%;
    overflow-x: auto;
  }

  .ed-toolbar {
    gap: 3px;
  }

  .ed-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 0.78rem;
  }

  .ed-icon {
    width: 16px;
    height: 16px;
  }

  .ed-sep {
    margin: 2px 2px;
  }
}

/* ---------- Legacy downloads ---------- */
.table-scroll {
  overflow-x: auto;
  margin: 16px 0 32px;
}

.table-scroll .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table-scroll .table th,
.table-scroll .table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

.table-scroll .table th {
  background: var(--bg-alt);
}

.table-scroll .table td.sha {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  white-space: normal;
  word-break: break-all;
  max-width: 320px;
}

/* ---------- Buy / pay flow ---------- */
.price-list {
  text-decoration: line-through;
  color: #888;
  margin-right: 8px;
}

.price-promo {
  color: #d92d20;
  font-size: 1.4em;
  font-weight: 700;
}

.price-tag {
  margin-left: 8px;
  font-size: 0.82rem;
  color: #d92d20;
  border: 1px solid #fca5a5;
  border-radius: 999px;
  padding: 1px 8px;
}

.coupon-row {
  display: flex;
  gap: .5rem;
}

.inline-form {
  display: inline;
}

/* ---------- Payment method options ---------- */
.pay-methods {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0;
}

.pay-methods legend {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 6px;
}

.pay-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.pay-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.pay-option input {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

@media (max-width: 390px) {
  .pay-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .coupon-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- AJAX toasts ---------- */
.kc-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.kc-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  animation: kc-toast-in 0.18s ease-out;
}

.kc-toast-success {
  background: #15803d;
}

.kc-toast-error {
  background: #b91c1c;
}

.kc-toast-text {
  flex: 1;
  word-break: break-word;
}

.kc-toast-close {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.85;
}

.kc-toast-close:hover {
  opacity: 1;
}

@keyframes kc-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- AJAX loading state ---------- */
.is-loading {
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.is-loading button[type="submit"],
.is-loading input[type="submit"] {
  cursor: progress;
}

@media (max-width: 600px) {
  .kc-toasts {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
    align-items: stretch;
  }
}
