/* =========================================
   1. Global Variables & Reset
   ========================================= */
:root {
    --primary-color: #0066cc;       /* 기존 #06c 유지하되 표준화 */
    --accent-color: #03a9f4;        /* 버튼 색상 */
    --accent-hover: #0288d1;
    --text-main: #333333;
    --text-muted: #666666;
    --bg-light: #f8f9fa;
    --border-color: #e1e4e8;
    --code-bg: #f6f8fa;             /* 코드 블럭 배경색 */
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.1);
}

body {
    /* 시스템 폰트 스택을 사용하여 더 깔끔하고 빠르게 렌더링 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-main);
    line-height: 1.6;
    background-color: #fff;
}

/* 스크롤바 디자인 개선 - 더 얇고 모던하게 */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #ccc;
}

*::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
    color: #004080;
}

/* =========================================
   2. UI Elements (Buttons, Banner)
   ========================================= */
button {
    padding: 10px 24px;
    /* min-width: 300px; -> 너무 커서 제거, 필요시 컨텐츠에 맞게 늘어나도록 함 */
    border: none;
    border-radius: 6px; /* 과도한 20px에서 줄임 */
    font-size: 1rem;
    font-weight: 600;
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px); /* 살짝 떠오르는 효과 */
}

.topbanner {
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbanner, .topbanner * {
    color: white;
}

.topbanner label {
    font-size: 1.25rem;
    font-weight: 600;
}

/* =========================================
   3. Navigation
   ========================================= */
.navmenu {
    padding: 0 10px 48px;
    background-color: #fff;
}

.navfolder {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: var(--bg-light); /* 연한 회색으로 변경 */
    border-radius: 6px;
    color: var(--text-main);
}

.navgroup {
    font-size: 1rem;
    padding-left: 0.5rem;
    margin: 10px 0;
    font-weight: 600;
    color: var(--text-muted);
}

.navitem {
    /* width: 180px; -> 고정 너비 제거 (반응형 대응) */
    display: inline-block;
    margin: 2px 0;
    padding: 0; /* a 태그에 패딩을 줌 */
    border-radius: 4px;
    transition: background-color 0.2s;
}

.navitem a {
    display: block;
    padding: 6px 12px;
    color: var(--text-main);
    border-radius: 4px;
}

.navitem:hover {
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.navitem.active {
    background-color: #4682b4; /* steelblue */
}

.navitem.active a {
    color: #fff;
    font-weight: 500;
}

.navcontent {
    padding: 20px 40px;
}

.navfolderitems {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 5px; /* 아이템 간 간격 추가 */
}

/* 논리적 오류 수정: 내용이 많아지면 잘릴 수 있는 고정 높이 제거 */
.navfolderdemos, .navfolderdocs {
    height: auto; 
    min-height: 200px;
}

/* =========================================
   4. Syntax Highlighter (Modernized)
   ========================================= */
/* 기존의 베이지색/점선 스타일을 현대적인 GitHub/VSCode 스타일로 변경 */

.dp-highlighter {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 100%; /* 99% -> 100% */
    box-sizing: border-box; /* 패딩 포함 계산 */
    overflow: auto;
    margin: 20px 0 !important;
    padding: 0;
    line-height: 1.5;
}

/* 상단 툴바 (Copy 버튼 등) */
.dp-highlighter .bar {
    padding-left: 0;
    background-color: transparent;
}

/* 코드 영역 리스트 */
.dp-highlighter ol {
    margin: 0 !important;
    padding: 10px 0 10px 50px !important; /* 라인 넘버 공간 확보 */
    color: var(--text-muted);
    background-color: transparent;
    border: none;
}

.dp-highlighter ol li,
.dp-highlighter .columns div {
    list-style: decimal;
    border-left: 3px solid transparent; /* 녹색 선 제거, 투명으로 유지 */
    background-color: transparent;
    color: #bbb; /* 라인 넘버 색상 연하게 */
    padding-left: 10px !important;
    margin: 0 !important;
}

/* 짝수 줄 배경색 제거 (현대적인 느낌을 위해) */
.dp-highlighter ol li.alt {
    background-color: transparent;
}

/* 코드 텍스트 본문 */
.dp-highlighter ol li span {
    color: #24292e; /* 기본 텍스트 검정 */
    font-family: inherit;
}

/* 호버 시 라인 강조 (선택 사항) */
.dp-highlighter ol li:hover {
    background-color: rgba(0,0,0,0.03);
    border-left-color: var(--accent-color);
}

/* 구문 강조 색상 (조금 더 선명하게 조정) */
.dp-highlighter .comment, .dp-highlighter .comments { color: #6a737d; font-style: italic; }
.dp-highlighter .string { color: #032f62; }
.dp-highlighter .keyword { color: #d73a49; font-weight: bold; }
.dp-highlighter .preprocessor { color: #6f42c1; }

/* Copy 버튼 위치 및 스타일 수정 (JS에서 생성되는 요소 대응) */
.dp-highlighter + div { 
    /* patch.js의 DPH_AddCopyBtn 함수가 생성하는 버튼에 대한 스타일 보정 */
    /* 필요하다면 여기에 z-index 등을 추가 */
}


/* =========================================
   5. General Content Styles (Bootstrap-like)
   ========================================= */
p {
    margin-bottom: 1rem;
}

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 90%;
    padding: 0.2rem 0.4rem;
    color: #d63384; /* 인라인 코드 강조색 */
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
}

pre {
    background: #1e1e1e; /* 어두운 배경 */
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
}

/* Callout Box 디자인 개선 */
.callout {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #eee;
    border-left-width: 5px;
    border-radius: 4px;
    background-color: #fff;
}

.callout-warning {
    border-left-color: #ffc107;
    background-color: #fffbf2;
}

.callout-danger {
    border-left-color: #dc3545;
    background-color: #fff5f5;
}

.callout-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Sidebar Styling (Bootstrap Docs style) */
.hs-sidebar-link {
    color: #495057;
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
}

.hs-sidebar-link:hover, 
.hs-sidebar-link.active {
    color: var(--accent-color);
    background-color: rgba(3, 169, 244, 0.1);
    text-decoration: none;
}

.hs-sidebar-heading {
    color: #888;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1.5rem 0 0.5rem;
    padding: 0 1rem;
}

/* --- ESP32-CAM 수업 페이지 추가 스타일 --- */

.step-list li {
    margin-bottom: 15px;
    font-size: 1.05em;
}

.step-desc {
    display: block;
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
    margin-left: 5px;
}

.file-group {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
    margin-top: 5px;
}

.file-group a {
    display: block;
    margin: 5px 0;
    text-decoration: none;
    color: #007bff;
}

.file-group a:hover {
    text-decoration: underline;
}

/* 테이블 스타일 */
.wiring-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.wiring-table th, .wiring-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center; /* 가운데 정렬 */
    vertical-align: middle;
}
.wiring-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #333;
}
.wiring-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* =========================================
   6. ESP Web Tools Button Styling
   ========================================= */

/* 설치 버튼 컨테이너 */
esp-web-install-button {
    display: inline-block;
    margin-top: 10px;
}

/* Web Component 내부의 실제 버튼 스타일링 
   (쉐도우 돔 내부 요소 접근을 위해 ::part 사용)
*/
esp-web-install-button::part(button) {
    font-size: 1.2rem;            /* 글자 크기 키움 */
    padding: 12px 24px;           /* 버튼 크기 키움 */
    background-color: var(--primary-color); /* 파란색 배경 (#0066cc) */
    color: white;                 /* 글자색 흰색 */
    border-radius: 8px;           /* 둥근 모서리 */
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
    font-weight: 600;
    font-family: inherit;
}

/* 버튼 마우스 오버 효과 */
esp-web-install-button::part(button):hover {
    background-color: #004080;    /* 더 진한 파란색 */
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);  /* 살짝 떠오르는 효과 */
}

/* 버튼 클릭(활성화) 효과 */
esp-web-install-button::part(button):active {
    transform: translateY(0);
    box-shadow: none;
}


/* =========================================
   7. Shared Responsive Polish
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

img, video, canvas, svg {
    max-width: 100%;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(3, 169, 244, 0.35);
    outline-offset: 3px;
}

.topbanner > div {
    width: min(960px, 100%) !important;
}

@media (max-width: 640px) {
    .topbanner {
        padding: 0.75rem;
    }

    .navcontent {
        padding: 16px;
    }

    .wiring-table {
        font-size: 0.82rem;
    }

    .wiring-table th,
    .wiring-table td {
        padding: 7px;
    }
}

/* =========================================
   8. Home Page
   ========================================= */
.home-page, .doc-page {

  --home-primary: #0066cc;
  --home-primary-dark: #004b9b;
  --home-accent: #03a9f4;
  --home-ink: #172033;
  --home-muted: #64748b;
  --home-line: #dfe7f0;
  --home-surface: #ffffff;
  --home-surface-soft: #f4f7fb;
  --home-shadow: 0 14px 40px rgba(32, 65, 105, .09);
}

* { box-sizing: border-box; }

.home-page { min-width: 320px; }

body.home-page {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  color: var(--home-ink);
  background:
    radial-gradient(circle at 10% 0, rgba(3, 169, 244, .11), transparent 26rem),
    #edf3f8;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.home-page a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 9px;
  color: #fff !important;
  background: #111827;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  color: #fff;
  background: linear-gradient(120deg, var(--home-primary-dark), var(--home-primary) 62%, #0789d2);
  box-shadow: 0 4px 18px rgba(0, 63, 129, .22);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1040px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff !important;
}

.brand::before {
  content: "";
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 11px;
  background: #0066cc url("../image/nukcanon-brand.png?v=20260915") center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.brand:hover, .brand:focus-visible { text-decoration: none; }

.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 1.23rem; letter-spacing: -.025em; line-height: 1.2; }
.brand-copy small { color: rgba(255, 255, 255, .72); font-size: .67rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  color: #fff !important;
  background: rgba(255, 255, 255, .1);
  font-size: .86rem;
  font-weight: 750;
}

.home-link:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }
.home-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.home-main {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(42px, 7vw, 72px) 0 54px;
}

.hero { max-width: 720px; margin-bottom: 30px; }
.hero .eyebrow { margin: 0 0 10px; color: var(--home-primary); font-size: .72rem; font-weight: 850; letter-spacing: .13em; }
.hero h1 { margin: 0; color: #101827; font-size: clamp(1.85rem, 5vw, 2.75rem); line-height: 1.22; letter-spacing: -.045em; }
.hero > p:last-child { max-width: 660px; margin: 14px 0 0; color: var(--home-muted); font-size: clamp(.93rem, 2vw, 1.04rem); line-height: 1.7; }

.menu-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.menu-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--home-line);
  border-radius: 18px;
  background: var(--home-surface);
  box-shadow: var(--home-shadow);
}

.card-heading { display: flex; align-items: center; gap: 13px; margin: 2px 0 0; }
.card-heading > div { min-width: 0; }
.card-heading p { margin: 0 0 2px; color: var(--home-muted); font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.card-heading h2 { margin: 0; color: #172033; font-size: 1.14rem; line-height: 1.25; letter-spacing: -.025em; }

.section-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid #cfe4fa;
  border-radius: 13px;
  color: var(--home-primary);
  background: #edf6ff;
}

.section-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.link-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.link-list li { min-width: 0; margin: 0; }

.menu-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid #e7edf4;
  border-radius: 12px;
  background: var(--home-surface-soft);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.menu-link > span:first-child { display: grid; gap: 3px; min-width: 0; }
.menu-link strong { color: #243047; font-size: .9rem; line-height: 1.35; }
.menu-link small { overflow: hidden; color: var(--home-muted); font-size: .74rem; line-height: 1.4; text-overflow: ellipsis; }
.menu-link .link-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #7890aa;
  background: #e8eef5;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.menu-link .link-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.menu-link:hover {
  border-color: #b9d9f7;
  background: #fafdff;
  box-shadow: 0 8px 20px rgba(0, 102, 204, .09);
  text-decoration: none;
  transform: translateY(-1px);
}

.menu-link:hover .link-icon { color: #fff; background: var(--home-primary); transform: translate(1px, -1px); }
.menu-link:focus-visible, .brand:focus-visible, .home-link:focus-visible { outline: 3px solid rgba(3, 169, 244, .35); outline-offset: 3px; }

.wide-card { grid-column: auto; }

.site-footer {
  padding: 22px 16px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid #d9e4ef;
  color: #718096;
  background: rgba(255, 255, 255, .55);
  text-align: center;
}

.site-footer p { display: flex; justify-content: center; gap: 7px; margin: 0; font-size: .76rem; }
.site-footer strong { color: #42526a; }
.site-footer p { flex-wrap: wrap; }
.site-footer p + p { margin-top: 6px; }
.site-footer .footer-links a { color: #42526a; text-decoration: underline; text-underline-offset: 3px; }
.site-footer .footer-links a:hover { color: var(--home-primary); }
.site-footer .footer-links a[aria-current="page"] { font-weight: 800; text-decoration: none; }

@media (max-width: 720px) {
  .header-inner, .home-main { width: min(100% - 22px, 1040px); }
  .header-inner { min-height: 68px; }
  .brand::before { width: 38px; height: 38px; flex-basis: 38px; border-radius: 9px; }
  .brand-copy small { display: none; }
  .home-main { padding-top: 36px; }
  .hero { margin-bottom: 24px; }
  .menu-grid { gap: 11px; }
  .menu-card { grid-template-columns: 1fr; gap: 13px; padding: 16px; border-radius: 16px; }
  .card-heading { margin: 0; }
  .link-list { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .home-link { width: 40px; padding: 0; gap: 0; justify-content: center; font-size: 0; }
  .home-link svg { width: 19px; height: 19px; }
  .hero h1 { font-size: 1.78rem; }
}

/* Shared pages */
body.doc-page {
  width: 100%;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 48px !important;
  color: #172033;
  background:
    radial-gradient(circle at 10% 0, rgba(3, 169, 244, .1), transparent 28rem),
    #edf3f8;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.doc-page .topbanner {
  min-height: 68px;
  padding: 0 16px;
  background: linear-gradient(120deg, #004b9b, #0066cc 62%, #0789d2);
  box-shadow: 0 4px 18px rgba(0, 63, 129, .2);
}

.doc-page .topbanner > div { width: min(960px, 100%) !important; align-items: center; }
.doc-page .topbanner label { font-size: 1.18rem; font-weight: 800; letter-spacing: -.02em; }
.doc-page .topbanner a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  font-size: .86rem;
  font-weight: 750;
}

.doc-page .topbanner a:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }

.doc-page .page-shell,
.doc-page .content-container {
  width: min(960px, calc(100% - 24px)) !important;
  max-width: 960px !important;
  margin: 22px auto 0 !important;
  padding: clamp(18px, 4vw, 32px) !important;
  border: 1px solid #dfe7f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(32, 65, 105, .08);
}

.doc-page .navfoldercontainer + .navfoldercontainer { margin-top: 28px; }
.doc-page .navfolder {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #d3e6f8;
  border-left: 4px solid #0066cc;
  border-radius: 12px;
  color: #172033;
  background: #f2f8fe;
  text-align: left;
}

.doc-page .navfolder h2,
.doc-page .navfolder h3 { margin: 0; color: #172033; font-size: clamp(1.2rem, 3vw, 1.55rem); line-height: 1.35; }
.doc-page .content-container > h2 { margin: 0 0 28px; color: #101827; font-size: clamp(1.55rem, 4vw, 2rem); line-height: 1.35; letter-spacing: -.035em; }
.doc-page .section-title { margin: 34px 0 16px; padding: 0 0 10px; border-bottom: 2px solid #d5e6f5; color: #005ebd; font-size: clamp(1.15rem, 3vw, 1.42rem); text-align: left; }
.doc-page h4 { color: #243047; }
.doc-page ol, .doc-page ul { padding-left: 1.5rem; }
.doc-page li { margin-bottom: .6rem; }
.doc-page p, .doc-page li { overflow-wrap: anywhere; }

.doc-page img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(24, 50, 82, .09);
}

.doc-page .wiring-table {
  width: 100% !important;
  margin: 16px 0 24px !important;
  border: 1px solid #dfe7f0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.doc-page .wiring-table th,
.doc-page .wiring-table td { padding: 10px 12px; border: 0; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.doc-page .wiring-table th:last-child,
.doc-page .wiring-table td:last-child { border-right: 0; }
.doc-page .wiring-table tr:last-child td { border-bottom: 0; }
.doc-page .wiring-table th { color: #243047; background: #edf4fb; }
.doc-page .wiring-table tr:nth-child(even) { background: #f8fafc; }

.doc-page .file-group,
.doc-page .summary-img-container,
.doc-page .url-copy-container,
.doc-page .upload-box {
  border: 1px solid #dfe7f0 !important;
  border-radius: 12px !important;
  background: #f8fafc !important;
  box-shadow: none !important;
}

.doc-page .file-group { padding: 12px; }
.doc-page .file-group a:not(.secret-link) { padding: 7px 9px; border-radius: 8px; background: #fff; }
.doc-page .upload-box { padding: 18px !important; }
.doc-page .url-copy-container { gap: 12px; padding: 12px; }

.doc-page .nano-upload-options { align-items: stretch; }
.doc-page .nano-upload-options .upload-box { display: flex; flex-direction: column; }
.doc-page .nano-upload-options button[arduino-uploader] {
  flex: 0 0 46px;
  width: 100%;
  height: 46px;
  min-height: 46px;
  margin-top: auto;
  line-height: 1.2;
}

.doc-page button,
.doc-page button[arduino-uploader],
.doc-page .copy-btn {
  min-height: 46px;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 11px !important;
  color: #fff !important;
  background: linear-gradient(135deg, #0066cc, #0288d1) !important;
  box-shadow: 0 8px 18px rgba(0, 102, 204, .18) !important;
  font: inherit;
  font-weight: 750;
}

.doc-page button:hover,
.doc-page button[arduino-uploader]:hover,
.doc-page .copy-btn:hover { background: linear-gradient(135deg, #0056ad, #0277bd) !important; transform: translateY(-1px); }

.doc-page esp-web-install-button { display: inline-block; max-width: 100%; }
.doc-page esp-web-install-button::part(button) {
  min-height: 48px;
  padding: 11px 22px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #0066cc, #0288d1);
  box-shadow: 0 8px 18px rgba(0, 102, 204, .18);
  font: inherit;
  font-weight: 750;
}

.doc-page esp-web-install-button::part(button):hover { background: linear-gradient(135deg, #0056ad, #0277bd); transform: translateY(-1px); }

.doc-page a[href]:not(.secret-link)::after {
  --link-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3ZM5 5h6v2H5v12h12v-6h2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E");
  content: "";
  display: inline-block;
  width: .92em;
  height: .92em;
  margin-left: .36em;
  background: currentColor;
  -webkit-mask: var(--link-mark) center / contain no-repeat;
  mask: var(--link-mark) center / contain no-repeat;
  vertical-align: -.08em;
  opacity: .72;
}

.doc-page a[download]:not(.secret-link)::after {
  --link-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M11 3h2v10.17l3.59-3.58L18 11l-6 6-6-6 1.41-1.41L11 13.17V3ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E");
}

.doc-page .topbanner a::after,
.doc-page .site-header a::after,
.doc-page a.secret-link::after { content: none !important; display: none !important; }
.doc-page a.secret-link { padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }

@media (max-width: 720px) {
  body.doc-page { padding-bottom: 24px !important; }
  .doc-page .topbanner { min-height: 60px; padding: 0 10px; }
  .doc-page .page-shell,
  .doc-page .content-container { width: calc(100% - 16px) !important; margin-top: 12px !important; padding: 16px !important; border-radius: 14px; }
  .doc-page .navfolder { padding: 12px 13px; border-radius: 10px; }
  .doc-page .navfolder h2,
  .doc-page .navfolder h3 { font-size: 1.2rem; }
  .doc-page .url-copy-container { flex-direction: column; align-items: stretch; }
  .doc-page .upload-box-container { gap: 12px; }
  .doc-page .upload-box { width: 100% !important; min-width: 0 !important; padding: 15px !important; }
  .doc-page .wiring-table {
    display: block;
    width: calc(100vw - 16px) !important;
    max-width: none;
    margin-left: calc(50% - 50vw + 8px) !important;
    margin-right: calc(50% - 50vw + 8px) !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .doc-page .wiring-table th,
  .doc-page .wiring-table td {
    min-width: 0;
    padding: 6px 4px;
    font-size: .76rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .doc-page pre, .doc-page .dp-highlighter { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
