/* =========================
   Prism code block
========================= */

.code-block {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 20px 22px 18px;
  margin: 24px 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 0 0 1px rgba(255, 255, 255, 0.02);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 14px;
}

.code-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.code-file {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 500;
}

.code-lang {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.copy-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.copy-btn:active {
  transform: scale(0.96);
}

.copy-btn svg {
  width: 22px;
  height: 22px;
}

.code-block pre[class*="language-"] {
  margin: 0;
  padding: 1.1rem 1rem !important;
  background: transparent !important;
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.code-block code[class*="language-"] {
  display: block;
  min-width: max-content;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.98rem;
  line-height: 1.7;
  text-shadow: none !important;
}

.code-block pre,
.code-block code {
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
}

/* Line numbers */
.code-block pre.line-numbers {
  position: relative;
  padding-left: 3.8em !important;
}

.code-block pre.line-numbers > code {
  position: relative;
  white-space: inherit;
}

.code-block .line-numbers .line-numbers-rows {
  position: absolute;
  pointer-events: none;
  top: 0;
  left: -3.8em;
  width: 3em;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  user-select: none;
}

.code-block .line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
}

.code-block .line-numbers-rows > span::before {
  content: counter(linenumber);
  display: block;
  padding-right: 0.8em;
  text-align: right;
  color: rgba(255, 255, 255, 0.32);
}

/* Scrollbar */
.code-block pre[class*="language-"]::-webkit-scrollbar {
  height: 8px;
}

.code-block pre[class*="language-"]::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.code-block pre[class*="language-"]::-webkit-scrollbar-track {
  background: transparent;
}

.kw-red {
  color: #ff5f56;
}

.kw-blue {
  color: #33AAFF;
}

.kw-reddishpurple {
  color: #881144;
}

.kw-togenashi-tog {
  color: #D90E2C;
}

.kw-togenashi-ena {
  color: #85C9DC;
}

.kw-togenashi-shi {
  color: #76BD53;
}

.kw-togeari-tog {
  color: #E34D8D;
}

.kw-togeari-eari {
  color: #EEDA01;
}

@media (max-width: 900px) {
  .code-block {
    padding: 16px 16px 14px;
    border-radius: 18px;
    margin: 18px 0;
  }

  .code-header {
    margin-bottom: 10px;
  }

  .code-lang {
    font-size: 0.95rem;
  }

  .copy-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .copy-btn svg {
    width: 20px;
    height: 20px;
  }

  .code-block code[class*="language-"] {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .code-block pre[class*="language-"] {
    padding: 1rem 0.9rem !important;
  }

  .code-block pre.line-numbers {
    padding-left: 3.6em !important;
  }

  .code-block .line-numbers .line-numbers-rows {
    left: -3.6em;
    width: 2.8em;
  }
}

.about-page .code-block.code-block-with-gutter pre[class*="language-"] {
  padding-left: 3.6rem !important;
}

.about-page .code-block.code-block-with-gutter .custom-line-numbers {
  left: 1.2rem;
  width: 2.15rem;
  padding-right: 0.25rem;
}

@media (min-width: 901px) {
  .about-page .code-block {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 900px) {
  .about-page .code-block.code-block-with-gutter pre[class*="language-"] {
    padding-left: 3.15rem !important;
  }

  .about-page .code-block.code-block-with-gutter .custom-line-numbers {
    left: 0.85rem;
    width: 1.7rem;
    padding-right: 0.45rem;
  }
}

@media (max-width: 430px) {
  .about-page .code-block.code-block-with-gutter pre[class*="language-"] {
    padding-left: 2.95rem !important;
  }

  .about-page .code-block.code-block-with-gutter .custom-line-numbers {
    left: 0.7rem;
    width: 1.55rem;
    padding-right: 0.4rem;
  }
}
