

:root {
  /* 尺寸系统 */
  --nav-height: 50px;
  --anchor-height: 40px;
  --anchor-height-plus: 5px;
  --body-padding-top: calc(30px + var(--nav-height) + var(--anchor-height));
  --border-radius: 1.6rem;
  --border-radius-button: 0.7rem;

  /* 颜色阴影系统 */
  --color-primary: 255, 255, 255;  /* 主色(白色) */
  --color-base: 102, 102, 102;     /* 基础色(深灰色) */
  --color-accent: 42, 122, 226;    /* 强调色(蓝色) */
  --color-bg: 222, 229, 241;       /* 背景色(浅蓝色) */
  --color-bg-2: 187, 199, 218;     /* 背景色(浅蓝色深一点点) */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);

  /* 字体 */
  --font-family: 'Segoe UI', 'Misans', system-ui, sans-serif;
  --font-size-s: 0.75rem;
  --font-size-m: 0.9rem;
  --font-size-normal: 1rem;
  --font-size-l: 1.2rem;
  --font-size-xl: 1.4rem;
  --font-size-xxl: 1.6rem;

  /* 颜色方案 */
  color-scheme: light dark;
}

/* ================================= 总变量·深色主题 ================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  }
}

[data-theme="dark"] {
    --color-primary: 26, 26, 26;
    --color-base: 236, 236, 236;
    --color-accent: 110, 182, 255;
    --color-bg: 45, 59, 83;
    --color-bg-2: 30, 46, 71;
  .theme-toast{
    background: rgba(255,255,255,0.15);
  }
}


/* ==================================== 基础样式 ==================================== */

@font-face {
  font-family: 'Segoe UI';
  src: local('Segoe UI'), 
       url('font_SegoeUI.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'MiSans';
  src: local('MiSans'), 
       url('font_MiSans-Normal.ttf') format('truetype');
  font-display: swap;
}

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

html {
    scroll-behavior: smooth;
    overscroll-behavior: none;
}

body {
    width: 100%;
    max-width: min(1200px, 100%);
    min-height: 100vh;
    margin: auto;
    padding-top: var(--body-padding-top);
    font-family: var(--font-family);
    color: rgba(var(--color-base),1);
    background: linear-gradient(135deg, rgba(var(--color-bg),1) 50%, rgba(var(--color-bg-2),1) 100%);

  & h1 {
    margin: 2rem auto;
    font-size: var(--font-size-xxl);
    text-align: center;				    /* 文本对齐 */
    text-wrap: balance;				    /* 智能换行 */
    color: var(--color-base);			    /* 字色 */
    letter-spacing: 0.01rem;			    /* 字间距 */
  }
}

.container {
    width: min(94%, 1200px);
    margin: 2rem auto;
    padding: clamp(1.5rem, 5vw, 3.5rem);
    border-radius: var(--border-radius);
    background: rgba(var(--color-primary),0.2);
    box-shadow: 0 8px 32px rgba(var(--color-bg-2), 1);
  center {
    text-align: center;
  }
}

.container-blog-post {
    text-align: center;
}

iframe {
    position: fixed;
    top: calc(var(--nav-height) + var(--anchor-height));
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-height)); /* 使用vh单位 */
    width: 100%;
    border: none;
    -webkit-overflow-scrolling: touch; /* 启用弹性滚动 */
}

/* ==================================== .header.footer ==================================== */

/* ###### 左上返回按钮 ###### */

.nav-back-button {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-l);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

/* ###### 顶部主容器 ###### */

.navbar, .sidebar {
    position: fixed;
    top: 0;
    inset: 0 0 auto;
    z-index: 1000;
    height: var(--nav-height);
    box-shadow: 0 2px 8px rgba(var(--color-base),0.1);
    background: rgba(var(--color-primary), 0.7);
    backdrop-filter: saturate(180%) blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
  a {				/* 链接 */
    color: rgba(var(--color-base),0.9);
    border-radius: var(--border-radius-button);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    &:hover,:active {		/* 链接悬停和激活 */
        color: rgba(var(--color-accent),1);
    }
  }
}

.sidebar-top {
    top:var(--nav-height);
    height:var(--anchor-height);
    z-index:999;
    font-size: var(--font-size-s);
}

.nav-buttons,.side-buttons {
    display: flex;
    justify-content: center;
    padding: 0.25rem;
  a{
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.2rem;
  }
  a:hover, a.active {
        color: rgba(var(--color-accent), 1);
  }
}

.nav-buttons {
    gap: 1rem;
 a{
    padding: 0.5rem 1rem;
  }
}

.side-buttons {
    gap: 0.3rem;
  a{
    padding: 0.7rem 0.5rem;
    font-size:var(--font-size-s);
  }
}

/* ###### 深浅模式按钮 ###### */

.theme-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(var(--color-base), 0.9);
    font-size: var(--font-size-l);
    padding: 0.5rem;
    border-radius: 100%;
    transition: all 0.3s;
  &:hover{
  background: rgba(var(--color-base), 0.05);
  color: rgba(var(--color-accent), 1);
  }
}

.theme-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  backdrop-filter: none;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { bottom: -50px; opacity: 0; }
  to { bottom: 20px; opacity: 1; }
}

/* ###### Blog定位栏 ###### */

/* 新增样式 */
.search-divider {
  height: 1px;
  background: rgba(var(--color-base), 0.1);
  margin: 0.5rem 0.1rem;
}



.card-blog-tags {			
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin: 0;
  min-width: 0; /* 防止溢出换行 */

    position: relative;
    overflow: auto;
    scrollbar-width: none; /* Firefox 64+ */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth; /* 新增平滑滚动 */
    overscroll-behavior-x: contain; /* 防止滚动穿透 */
  &::-webkit-scrollbar {  		/* 隐藏所有浏览器滚动条 */
    width: 0;
    height: 0;
    background: transparent;
  }
}


.card-blog-tags-button {
    flex-shrink: 0;
    cursor: pointer;
    padding: 0.1rem 1rem;
    border-radius: 6px;
    background: rgba(var(--color-accent), 0.05);
    border: 1px solid rgba(var(--color-accent), 0.1);
    transition: all 0.2s ease;
    color: rgba(var(--color-base),1);
    font-size: var(--font-size-s);
    font-family: var(--font-family);
  &.active{
    background: rgba(var(--color-accent), 0.8);
    color: white;
  }
}



/* ###### 返回顶部按钮 ###### */

.back-to-top {
    position: fixed;
    bottom: max(1.5rem, env(safe-area-inset-bottom));
    right: max(1.5rem, env(safe-area-inset-right));
    width: 3rem;
    height: 3rem;
    background: rgba(var(--color-primary), 0.01);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 50%;
    box-shadow: 0 0px 15px rgba(var(--color-bg-2),1);
    cursor: pointer;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
  &.show {
    opacity: 0.7;
    transform: translateY(0);
  }
  i {
    color: rgba(var(--color-base), 0.7);
    font-size: var(--font-size-l);
    transition: color 0.2s;
  }
  &:hover {
    background: rgba(var(--color-primary), 1);
    opacity: 0.95;
    box-shadow: 0 0px 15px rgba(var(--color-bg-2),1);
  }
  &:hover i {
    color: rgb(var(--color-accent));
  }
}

/* ###### copyright ###### */

#copyright {
    margin: 20px;
    color: rgba(var(--color-base),1);
    font-size: 12px;
    text-align: center;
  a {
    color: rgba(var(--color-base),0.9);
    border-radius: var(--border-radius-button);
    text-decoration: none;
  }
}


/* ==================================== .cards ==================================== */

.cards {
    background: rgba(var(--color-primary), 0.5);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(var(--color-bg-2), 0.1);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: var(--font-size-normal);
    text-decoration: none;
    color: rgba(var(--color-base),1);
    transition: all 0.2s ease-out;
    border: none;
    box-sizing: border-box;
    transform: translateZ(0);
    will-change: transform;
  &:hover {
    transform: translateY(-0.1rem);
    box-shadow: 0 4px 12px rgba(var(--color-bg-2),0.6);
    background: rgba(var(--color-primary), 0.8);
  }
  input {
    color: rgba(var(--color-base),1);
    border: none;
    background: transparent;
    font-size: var(--font-size-normal);
    border-radius: var(--border-radius-button);
  }
  i {
    color: rgba(var(--color-accent),1);
  }
  h2 a{
    color: rgba(var(--color-accent),1);
    text-decoration: none;
    font-size: var(--font-size-xl);
  }
}

.card-search {
    --search-height: 3.5rem;
    margin: 2rem auto;
}

.card-search-input{ 			
    display: flex;
    padding: 0.5rem 1rem 0.7rem;
  input {
    flex: 1;
    padding: 0.8rem;
    margin-right: 0.6rem;
    transition: all 0.2s ease;
    &::placeholder {
        color: rgba(var(--color-base), 0.5);
    }
  }
}

.card-search-tags {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem 0.5rem;
}

.card-search-msg{
  white-space: nowrap; /* 强制不换行 */
  position: static;
  transform: none;
  padding: 0.3rem 0.8rem;
  background: rgba(var(--color-accent), 0.3);
  border-radius: 0.5rem;
  font-size: var(--font-size-s);

}

.card-links {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  a {
    border-radius: var(--border-radius-button);
    padding: 1em;
    i {
      margin-inline-end: 0.3em;
    }
  }
}

.card-blog {        /* blog_render.js */
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  article{
    padding: 1rem;
    h2, p {
        margin-bottom: 1rem;
    }
  }
}

.card-tool {
  textarea, pre, .card-ip-zx, p, small {
    resize: none;
    border: none;
    height: 18rem;
    width: min(800px, 100%);
    padding: 15px;
    overflow: auto;
    text-align: left;
    margin: 0 auto; /* 新增：水平居中 */
  }
  p {
    height: auto;
  }
}

.card-memo {
    overflow: 0;
    word-wrap:break-word;
  textarea {
    height: 10rem;
  }
}


.card-qr-output {
    text-align: center;
  #qrcode {
    background: white;
    display: inline-block;
    padding: 1rem;
  }
}

.card-ip {
  .cards {
    height: auto;
  }
  .card-ip-zx {
    white-space: nowrap; /* 防止内容换行 */
  }
}

.card-dy {
  .cards{
    height: 10rem;
  }
}

.card-inputs {
    margin: 1.5rem auto;
    height: 3.2rem;
    border-radius: var(--border-radius-button);
  input {
    width: 100%;
    font-family : var(--font-family);
    padding: 1rem 2rem 1rem 1rem;
    padding-right: 90px;
  }
}

.card-inputs-blog input{
    padding-right: 10rem;
}


.card-results {
    position: relative;
    width: min(800px, 100%);
    margin: 1rem auto 0;
  #resultOutput, #previewAfter, #result, p {
    padding-right: 3.5rem;
  }
  .card-results-memo {
    padding: 1.5rem 1.5rem 0;
    a {
        color: rgba(var(--color-accent),1);
        text-decoration: none;
    }
  }
}

.card-btns {
    position: absolute;
    right: 1rem;
    display: flex;
    flex-direction: column;  /* 垂直排列 */
    gap: 0.3rem;
    z-index: 10;
}

.card-btns-top {
    top: 0.55rem;  /* 稍微上移一点 */
}

.card-btns-bottom {
    bottom: 0.75rem;  /* 稍微上移一点 */
}

.card-btn-copy, .card-btn-dw, .card-btn-play, .card-btn-delete {
    background: none;
    border: none;
    color: rgba(var(--color-base), 0.7);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 0.7rem;
    transition: all 0.2s;
  &:hover {
    color: rgba(var(--color-accent),1);
    background: rgba(var(--color-accent), 0.1);
  }
}

.copy-success, .shake {
    animation: pulse 0.5s ease;
}

.videoplayer {
    margin: 1.5rem auto;
  h3 {
    margin: 1rem;
  }
}

#videoPlayer {
    width: 100%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #000;
}


/* ==================================== .size ==================================== */

/* ###### INDEX·各类别 ###### */

.category {
    margin-bottom: 1rem;
    scroll-margin-top: calc(var(--nav-height) + var(--anchor-height) + var(--anchor-height-plus));
  h2 {
    color: var(--color-base);
    font-size: var(--font-size-l);
    font-weight: 100;
    border-inline-start: 4px solid rgba(var(--color-accent),1);
    padding-inline-start: 1rem;
    margin: 1rem 0;
  }
}

@supports (-ms-ime-align:auto) {.category {scroll-snap-margin-top: calc(var(--nav-height) + var(--anchor-height) + var(--anchor-height-plus));}}


.blog-post-content {
    padding-top:2rem;
    font-size: var(--font-size-normal);
    line-height: 2rem;
    margin:auto 0.5rem;
    text-align: left; /* 新增：强制左对齐 */
  p {
    text-indent: 2em;
  }

}

/* ==================================== .buttons ==================================== */

.buttons { 
  button, label {
    background: rgba(var(--color-accent),0.8);
    font-family: var(--font-family);
    border: none;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    gap: 0.5rem;                                   /* 图标和文字间距 */
    color:white;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;			   /* 改为flex布局 */
    align-items: center;			   /* 垂直居中 */
    justify-content: center;			   /* 水平居中 */
   i {
    color: white;
    font-size: var(--font-size-m);
    transform: translateY(0.06em); /* 基于字体设计的精确补偿 */
   }
   &:hover {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(var(--color-accent), 0.2));
    background: rgba(var(--color-accent),1);
   }
  }
  input[type=file] {
    display: none;
  }
}

.button-search {
    border-radius: 15px;
    width: 3rem;
    height: 3rem;
}

.blog-tags {
    display:flex;
    gap: 0.5rem;
    font-size: var(--font-size-m);
  time, .tag {
    padding: 0.4rem 0.8rem;
    background: rgba(var(--color-accent), 0.1);
    border-radius: 0.5rem;
    font-weight: bold;
  }
}

.blog-tags-memo {
    padding: 1rem;

  time, .tag {
    padding: 0.4rem 0.8rem;
    background: rgba(var(--color-base), 0.1);
    border-radius: 0.5rem;
    font-weight: bold;
  }
}

.blog-tags-post {
    justify-content: center;
}

.button-qr {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 80px;
    padding: 0;
    border-radius: 0 var(--border-radius-button) var(--border-radius-button) 0;
}

.button-url, .button-tv, .button-dy {
    display: flex;
    justify-content: center;
    margin: 1.2rem 0;
    flex-wrap: wrap; /* 允许按钮换行 */
    gap: 0.5rem; /* 按钮间距 */
  button, label {
    width: 6rem;
    height: 2.5rem;
    margin:0rem 0.1rem;
    border-radius: var(--border-radius-button);
    &:hover{
        transform: translateY(-2px);
    }
  }
  button.secondary {
        background: rgba(var(--color-base), 0.15);
        color: rgba(var(--color-base),1);
    i {
        color: rgba(var(--color-base),1);
    }
    &:hover{
        background: rgba(var(--color-base), 0.25);
    }
  }
}


.search-engine-selector {
    display: flex;
    gap: 1rem;
    padding: 0.8rem 1.6rem;
    border-bottom: 1px solid rgba(var(--color-base), 0.1);
  label {
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      i {
        font-size: 1.5rem;
        color: rgba(var(--color-base), 0.9); /* 默认使用基础色 */
        transition: all 0.2s ease;
      }
        &:active i {		/* 点击反馈 */
            transform: scale(0.95);
            transition: none;
        }
      input {
            position: absolute;
            opacity: 0;
            width: 0;
            height: 0;
      }
      & input:checked + i { 	/* 选中状态 */
            color: rgba(var(--color-accent),1);
            filter: drop-shadow(0 2px 4px rgba(var(--color-accent), 0.2));
      }
  }
}


/* ==================================== 其他 ==================================== */

.error-msg, {
}

.error-msg {
    margin-top: 1rem;
    padding: 0.5rem;
    color: #e05a5a;
    text-align: center;
    border-radius: var(--border-radius-button);
    display: none;
}

/* ######  TOOL·IP·TG状态  ###### */

.status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
    animation: blink-animation 1s steps(5, start) infinite;
}

.green-light {
    background-color: green;
}

.red-light {
    background-color: red;
}

@keyframes blink-animation {50% {opacity: 0.5;}100% {opacity: 1;}}

/* ==================================== 响应式布局 ==================================== */

@media (hover: none) {
    -webkit-overflow-scrolling: auto;
    overscroll-behavior-x: contain;
}

@media (max-width: 768px) {
    :root {
        --body-padding-top: calc(var(--nav-height) + var(--anchor-height) + env(safe-area-inset-top));
        }

        .navbar,.sidebar {
            justify-content: center; /* 改为中间对齐(原：flex-start) */
            padding-left: 0rem; /* 添加左侧留白 */
            gap: 0.8rem; /* 调整按钮间距 */
        }

        .nav-buttons,.side-buttons {
            flex-wrap: nowrap; /* 禁止换行 */
            overflow-x: auto; /* 横向滚动 */
            -webkit-overflow-scrolling: touch;
            width: auto /* 留出主题按钮空间（左侧对齐 calc(100% - 1rem)） */
          a {
              flex-shrink: 0; /* 禁止按钮缩小 */
              padding: 0.6rem 1rem;
          }
        }

        .theme-toggle {
            right: 0.5rem; /* 调整主题按钮位置 */
        }

        .tags-scroll {
            gap: 0.6rem;
        }

        iframe {
            top: calc(var(--nav-height) + var(--anchor-height));
            height: calc(100vh - var(--nav-height) - env(safe-area-inset-bottom));
        }
}

@media (max-width: 600px) {

    body {
        padding-top: 5rem;
    }

    .body-blog ,.body-blog-post {
        padding-top: 2.5rem;
    }
    .navbar,.sidebar {
        gap: 0.5rem;
        justify-content: space-around; /* 左右对齐：space-around */
    }

    .nav-buttons::-webkit-scrollbar, .side-buttons::-webkit-scrollbar {
        display: none; /* 隐藏滚动条 */
      a {
        padding: 0.5rem 0.9rem;
      }
    }
    
    .container {
        padding: 2rem 1.2rem;
        --container-blog-inline-size: min(1200px, 90%);
    }

    .card-links {
        grid-template-columns: repeat(2, 1fr);
      a {
          padding: 1em;
          font-size: max(0.8rem, 3vw);
      }
    }

    .card-blog {
        grid-template-columns: none;
}

    .card-search {
        margin-top: 0;
        --search-height: 3rem;
        font-size: var(--font-size-normal);
    }
  
  
    .button-search {
        width: 2.8rem;
        height: 2.8rem;
    }

    .cards-blog {
        display: grid;
        gap: 1.3rem;
    }

    .back-to-top {
        width: 2.8rem;
        height: 2.8rem;
        bottom: max(1rem, env(safe-area-inset-bottom));
        right: max(1rem, env(safe-area-inset-right));
    }
}