* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100vh;
  background-color: var(--bg-primary);
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 2rem);
  margin: 2rem;
  padding: 2rem;
  border-radius: 8px 8px 0 0;
  color: var(--text-primary-template);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.8;
  background-color: var(--bg-secondary);
}

header {
  max-width: 800px;
  position: relative;
  margin: 0 auto;
  padding: 24px 0;
  border-bottom: 2px solid var(--color-border);
  text-align: center;
}

.article-date {
  display: block;
  margin-bottom: 12px;
  color: var(--color-tag-blue);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h1 {
  margin-bottom: 16px;
  color: var(--text-primary-template);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.4;
}

.article-summary {
  text-align: left;
  margin-top: 16px;
  padding-left: 24px;
  border-left: 2px solid var(--accent-color);
  color: var(--text-secondary-template);
  font-size: 1rem;
  font-style: italic;
}

.breadcrumb {
  display: flex;
  justify-content: left;
  gap: 8px;
  margin: 16px 16px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
}

.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 8px;
  color: var(--overlay2);
}

.breadcrumb a {
  color: var(--color-tag-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb a:hover {
  color: var(--color-tag-green);
  text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
  color: var(--text-secondary-template);
}

main {
  max-width: 1200px;
  display: flex;
  margin: 0 auto;
  padding: 32px 0;
}

.article-content {
  flex: 1;
  max-width: 800px;
  color: var(--text-primary-template);
}

h2 {
  margin-bottom: 16px;
  color: var(--text-primary-template);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.4;
}

h3 {
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--text-secondary-template);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
}

h4 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-secondary-template);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.4;
}

.article-content p {
  margin-bottom: 20px;
  font-size: 1rem;
}

.article-content a {
  color: var(--color-tag-blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.article-content a:hover {
  color: var(--color-tag-green);
  border-bottom-color: var(--color-tag-green);
}

strong {
  color: var(--text-secondary-template);
  font-weight: 700;
}

em {
  color: var(--text-secondary-template);
  font-style: italic;
}

section {
  margin-bottom: 32px;
}

.article-content ol {
  padding-left: 32px;
  list-style: none;
  counter-reset: item;
}

.article-content ol > li {
  margin-bottom: 16px;
  counter-increment: item;
  position: relative;
}

.article-content ol > li::before {
  content: counter(item) ".";
  position: absolute;
  left: -32px;
  color: var(--color-tag-blue);
  font-weight: 700;
  font-size: 1rem;
}

.article-content ul {
  margin: 16px 0;
  padding-left: 32px;
  list-style: none;
}

.article-content ul > li {
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}

.article-content ul > li::before {
  content: "•";
  position: absolute;
  left: -16px;
  color: var(--color-tag-blue);
  font-size: 1.2rem;
}

.article-content ul ul,
.article-content ol ul {
  margin: 12px 0;
  padding-left: 24px;
}

.article-content ul ul > li::before {
  content: "◦";
  font-size: 1rem;
}

dl {
  margin: 24px 0;
}

dt {
  margin-top: 16px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-tertiary-template);
}

dt strong {
  color: inherit;
}

dt:first-child {
  margin-top: 0;
}

dd {
  margin-top: 8px;
  margin-left: 0;
  padding-left: 20px;
  color: var(--text-primary-template);
  line-height: 1.6;
}

table {
  width: 100%;
  margin: 32px 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
}

caption {
  margin-bottom: 12px;
  color: var(--text-secondary-template);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
}

thead {
  background: var(--surface0);
}

thead tr {
  border-bottom: 2px solid var(--color-tag-blue);
}

th {
  padding: 16px 12px;
  color: var(--text-secondary-template);
  font-weight: 700;
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.2s ease;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface0);
}

td {
  padding: 14px 12px;
  color: var(--text-primary-template);
}

td code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface0);
  font-size: 0.9em;
}

.article-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 40px 0;
}

.article-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

.article-image img:hover {
  transform: scale(1.08);
}

.article-image figcaption {
  margin-top: 14px;
  color: var(--text-secondary-template);
  font-size: 14px;
  text-align: center;
}

.code-container {
  margin: 30px 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  color: var(--text-primary-template);
  background: var(--bg-code);
  transition: box-shadow 0.3s ease;
}

.code-container:hover {
  box-shadow: 0 4px 16px rgba(137, 180, 250, 0.1);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
  background: var(--bg-code-header);
}

.code-header span {
  color: var(--color-tag-yellow);
  font-weight: 600;
}

.copy-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  color: var();
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--color-tag-blue);
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: var(--color-tag-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(166, 227, 161, 0.3);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  color: var(--text-quaternary);
  background: var(--color-tag-green);
}

pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-size: 0.9rem;
}

pre::-webkit-scrollbar {
  height: 8px;
}

pre::-webkit-scrollbar-track {
  background: var(--bg-code);
}

pre::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: var(--color-border);
}

pre::-webkit-scrollbar-thumb:hover {
  background: var(--color-tag-blue);
}

code {
  color: var(--text-primary-template);
  font-family: var(--font-main);
  display: inline-block;
}

.keyword {
  color: var(--color-tag-red);
}

.function {
  color: var(--color-tag-blue);
}

.string {
  color: var(--color-tag-green);
}

.comment {
  color: var(--text-secondary-template);
  font-style: italic;
}

aside {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--color-tag-blue);
}

aside.note {
  border-left-color: var(--color-tag-blue);
}

aside.warning {
  border-left-color: var(--color-tag-yellow);
}

aside.danger {
  border-left-color: var(--color-tag-red);
}

aside.success {
  border-left-color: var(--color-tag-green);
}

aside h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text-secondary-template);
  font-size: 1rem;
}

aside p {
  margin-bottom: 12px;
  color: var(--text-primary-template);
  line-height: 1.6;
}

aside p:last-child {
  margin-bottom: 0;
}

aside code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--base);
  color: var(--color-tag-peach);
  font-size: 0.9em;
}

blockquote {
  color: var(--text-secondary-template);
  font-size: 1.1rem;
  line-height: 1.8;
}

footer {
  max-width: 800px;
  margin: 32px auto 0;
  text-align: center;
}

@media (max-width: 1024px) {
  main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  body {
    margin: 1rem;
    padding: 1.5rem;
  }

  header {
    padding: 20px 0;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    margin-top: 32px;
    font-size: 1.6rem;
  }

  h3 {
    font-size: 1.3rem;
  }

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

  table {
    font-size: 0.85rem;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .code-header {
    padding: 10px 15px;
  }

  pre {
    padding: 15px;
    font-size: 0.85rem;
  }

  .sidebar section {
    padding: 16px;
  }

  .home-icon a img {
    width: 24px !important;
    height: 24px !important;
  }

  aside {
    padding: 16px 20px;
  }

  blockquote {
    padding: 20px 24px;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  body {
    margin: 0.5rem;
    padding: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .article-content ol,
  .article-content ul {
    padding-left: 24px;
  }

  table {
    font-size: 0.8rem;
  }

  .code-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .copy-btn {
    width: 100%;
  }
}