.tutorial-layout-front {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: start;
}

.tutorial-cats {
  background: var(--card);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line, #d9e2ec);
  position: sticky;
  top: 68px;
}

.cat-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.cat-link:hover,
.cat-link.active {
  background: #eef5fb;
  color: #2b6cb0;
  font-weight: 650;
}

.tutorial-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.t-card {
  display: block;
  background: var(--card);
  color: var(--ink);
  border-radius: 14px;
  padding: 16px 16px 14px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}

.t-card:hover {
  transform: translateY(-2px);
}

.t-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.t-card-tags span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef5fb;
  color: #2b6cb0;
}

.t-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.t-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  min-height: 2.8em;
}

.t-card time {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: #a07070;
}

.tutorial-detail {
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.tutorial-detail h1 {
  margin: 8px 0 10px;
  font-size: 28px;
  line-height: 1.3;
}

.detail-summary {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
}

.detail-time {
  display: block;
  margin-bottom: 20px;
  color: #a07070;
  font-size: 12px;
}

.article-body {
  line-height: 1.75;
  font-size: 15px;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 10px 0;
}

.article-body p {
  margin: 0 0 12px;
}

.tutorial-detail.is-article {
  max-width: 860px;
  margin: 0 auto;
}

.article-mode {
  font-size: 16px;
  line-height: 1.85;
  color: #243b53;
}

.article-mode h2,
.article-mode h3 {
  margin: 1.4em 0 0.6em;
  line-height: 1.35;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5f7fa;
  border: 1px solid #d9e2ec;
}

.preview-meta strong {
  font-size: 14px;
}

.preview-meta span {
  font-size: 12px;
  color: var(--muted);
}

.preview-frame-wrap {
  position: relative;
  width: 100%;
  height: min(78vh, 920px);
  min-height: 480px;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  overflow: hidden;
  background: #eef2f6;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.preview-media {
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  text-align: center;
}

.preview-media.audio {
  background: #f5f7fa;
  padding: 24px;
}

.preview-media video,
.preview-media img {
  display: block;
  width: 100%;
  max-height: min(78vh, 920px);
  margin: 0 auto;
  object-fit: contain;
  background: #0f172a;
}

.preview-media audio {
  width: 100%;
}

.preview-text {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  max-height: min(78vh, 920px);
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.preview-unsupported {
  padding: 28px 18px;
  border-radius: 12px;
  border: 1px dashed #b6d0ea;
  background: #fff8f7;
  text-align: center;
  color: var(--muted);
}

.preview-unsupported p {
  margin: 0;
}

.office-local-preview,
.file-viewer-host {
  min-height: min(78vh, 920px);
  height: min(78vh, 920px);
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.file-viewer-host flyfish-file-viewer,
.file-viewer-host > * {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.preview-loading {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #b6d0ea;
  border-radius: 12px;
  background: #f8fbff;
}

.xlsx-preview {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.xlsx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: #f5f7fa;
  border-bottom: 1px solid #d9e2ec;
}

.xlsx-tab {
  border: 1px solid #d9e2ec;
  background: #fff;
  color: #334e68;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

.xlsx-tab.active {
  background: #2b6cb0;
  border-color: #2b6cb0;
  color: #fff;
}

.xlsx-panels {
  max-height: min(78vh, 920px);
  overflow: auto;
}

.xlsx-panel {
  display: none;
  padding: 8px;
}

.xlsx-panel.active {
  display: block;
}

.xlsx-panel table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}

.xlsx-panel td,
.xlsx-panel th {
  border: 1px solid #d9e2ec;
  padding: 6px 10px;
  white-space: nowrap;
}

.docx-preview-box {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #eef2f6;
  max-height: min(78vh, 920px);
  overflow: auto;
  padding: 12px;
}

.docx-preview-box .docx-wrapper {
  background: #fff;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.pptx-preview {
  display: grid;
  gap: 12px;
}

.pptx-slide {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.pptx-slide header {
  padding: 8px 12px;
  background: #f5f7fa;
  border-bottom: 1px solid #d9e2ec;
  font-size: 12px;
  color: #486581;
  font-weight: 650;
}

.pptx-slide-body {
  padding: 14px 16px;
  line-height: 1.7;
  font-size: 14px;
}

.pptx-slide-body p {
  margin: 0 0 8px;
}

.pptx-slide-body .muted {
  color: var(--muted);
}

.front-foot {
  display: flex;
  gap: 16px;
  justify-content: center;
}

@media (max-width: 860px) {
  .tutorial-layout-front {
    grid-template-columns: 1fr;
  }
  .tutorial-cats {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .tutorial-cards {
    grid-template-columns: 1fr;
  }
}
