/* apps/tool/static/assets/css/konpeki.css */

/* === 1. 全局基础 === */
HTML {
    scroll-behavior: smooth;
}

BODY {
    background-color: #fdfbf7;
    /* Konpeki-50 */
    color: #334155;
    /* Slate-700 */
    /* 配合 CDN 版 Tailwind 使用，字体栈 */
    font-family: "Noto Serif SC", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding-bottom: 100px;
    overflow-x: hidden;
    text-align: left;
}

/* 链接样式：只针对真正的链接 */
A[href] {
    text-decoration: none;
    color: #0891b2;
    transition: color 0.2s;
}

A[href]:hover {
    color: #06b6d4;
    text-decoration: underline;
}

A:not([href]) {
    text-decoration: none;
    color: inherit;
    cursor: default;
}

/* === 2. 浮动菜单 (通用组件) === */
#fixedMenu {
    position: fixed !important;
    top: 100px;
    right: 0;
    width: 200px;
    max-height: 70vh;
    padding: 20px;

    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid #cbd5e1;
    border-right: none;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.05);

    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;

    transform: translateX(160px);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#fixedMenu:hover {
    transform: translateX(0);
}

/* 菜单文字 */
#fixedMenu A {
    display: block;
    padding: 8px 0;
    color: #64748b;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 13px;
    text-align: left;

    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s ease-in-out;
}

#fixedMenu:hover A {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
}

#fixedMenu A:hover {
    color: #0891b2;
    padding-left: 8px;
    border-bottom-color: #0891b2;
}

/* 侧边提示把手 */
#fixedMenu::before {
    content: "◀ 导航";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-lr;
    font-size: 12px;
    color: #94a3b8;
    font-weight: bold;
    letter-spacing: 4px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

#fixedMenu:hover::before {
    opacity: 0;
}

/* === 3. 布局容器修正 === */

/* 针对旧代码的大表格容器修正 */
body>TABLE,
body>CENTER>TABLE {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* 卡片式容器 (替代原来的 FORM TABLE) */
.tool-card,
FORM TABLE {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    padding: 0;
    /* 重置 */
}

TD {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
}

/* 表头列样式 */
FORM TD:first-child,
.tool-card td:first-child {
    color: #334155;
    font-weight: bold;
    background-color: #f8fafc;
    border-right: 1px solid #f1f5f9;
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 15px;
}

/* 分割线 */
HR {
    border: 0;
    height: 2px;
    background: #cbd5e1;
    margin: 50px auto;
    max-width: 960px;
    opacity: 0.5;
}

/* === 4. 输入框通用优化 === */
INPUT,
TEXTAREA,
SELECT {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 8px;
    background-color: #fff;
    color: #334155;
    outline: none;
    font-family: 'Courier New', monospace;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

INPUT:focus,
TEXTAREA:focus,
SELECT:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* === 5. 特殊控件修正 === */

/* 按钮 */
INPUT[type=button],
INPUT[type=submit],
INPUT[type=reset],
BUTTON {
    width: auto !important;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 4px;
}

INPUT[type=button]:hover,
BUTTON:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

/* 勾选框 */
INPUT[type="checkbox"],
INPUT[type="radio"] {
    width: auto !important;
    display: inline-block;
    margin-right: 4px;
    accent-color: #0891b2;
    vertical-align: middle;
}

/* 小输入框 (size=2) */
INPUT[size="2"] {
    width: 40px !important;
    text-align: center;
    display: inline-block;
    margin: 2px;
    padding: 4px 2px;
}

/* 大文本域修正 */
#vig_input,
#auto_input,
#input,
textarea[name="vig_input"],
textarea[name="auto_input"] {
    min-height: 250px !important;
    font-size: 14px;
}

/* 进制选择修正 */
SELECT[name="toBase"] {
    width: auto !important;
    min-width: 80px;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

INPUT[name="toBaseS"] {
    width: calc(100% - 110px) !important;
    display: inline-block;
    vertical-align: middle;
}

/* 一词暴力长输入框 */
#singleword_cipher,
#singleword_vKey,
#singleword_cLetters {
    width: auto !important;
    min-width: 200px;
    max-width: 400px;
    display: inline-block;
    margin-right: 10px;
}

/* === 6. 结果表格 (USW) 深度优化 === */
#usw {
    border: none;
    box-shadow: none;
    margin: 0;
    background: transparent;
}

#usw TD {
    padding: 8px 12px !important;
    font-size: 13px;
    background: transparent !important;
    border-bottom: 1px solid #e2e8f0;
    border-right: none !important;
    text-align: left !important;
    font-weight: normal !important;
    color: #334155 !important;
    width: auto !important;
}

/* 方法名列 */
#usw TD:first-child {
    width: 140px !important;
    max-width: 140px;
    white-space: normal !important;
    color: #64748b !important;
    font-size: 12px;
    text-align: left;
    /* 强制覆盖全局的 right */
    background: none !important;
    /* 去掉灰色背景 */
    font-weight: normal;
}

#usw TR:first-child TD {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: bold !important;
    text-align: center !important;
    border-radius: 4px;
}

/* 色块 */
.green {
    background-color: #10b981 !important;
    color: #fff !important;
    border-radius: 4px;
    text-align: center;
    padding: 2px 6px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.red {
    background-color: #f43f5e !important;
    color: #fff !important;
    border-radius: 4px;
    text-align: center;
    padding: 2px 6px;
}

/* === 7. 标题样式 === */
H3 {
    display: block;
    text-align: center;
    /* 配合 Tailwind 配置里的字体定义 */
    font-family: "Yuji Boku", serif;
    font-size: 2.5rem;
    color: #0f172a;
    margin: 2rem 0 1rem 0;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
}

P[align=center] {
    display: block !important;
    text-align: center !important;
    width: 100%;
    margin: 4rem 0 1.5rem 0;
    font-family: "Noto Serif SC", serif;
    color: #0891b2;
    font-size: 1.4rem;
    font-weight: bold;
    position: relative;
}

P[align=center]::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: #06b6d4;
    margin: 10px auto 0 auto;
    opacity: 0.3;
    border-radius: 2px;
}

/* === 8. 博客文章详情页排版优化 (Prose Override) === */

/* 1. 正文容器基础 */
.prose {
    color: #334155;
    /* Slate-700 */
    line-height: 1.8;
    font-size: 16px;
}

/* 2. 行内代码 (Inline Code) - 类似 `git status` */
/* 排除掉代码块里的 code，只针对行内的 */
.prose :not(pre)>code {
    background-color: #f1f5f9;
    /* Slate-100: 很淡的灰色背景 */
    color: #0891b2;
    /* Cyan-600: 你的主色调 */
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
    /* 稍微缩小一点，更精致 */
    padding: 0.2rem 0.4rem;
    /* 增加呼吸感 */
    border-radius: 0.25rem;
    /* 小圆角 */
    border: 1px solid #e2e8f0;
    /* 极细的边框增加层次感 */
    margin: 0 0.1rem;
}

/* 3. 代码块容器 (Block Code) - 无论是否指定语言 */
.prose pre {
    background-color: #1e293b;
    /* Slate-800: 深蓝灰，不是纯黑 */
    color: #e2e8f0;
    /* Slate-200: 浅白文字 */
    border-radius: 0.5rem;
    /* 大圆角 */
    padding: 1.25rem;
    /* 内部留白 */
    margin: 2rem 0;
    /* 上下间距 */
    overflow-x: auto;
    /* 代码太长可以横向滚动 */
    border: 1px solid #334155;
    /* Slate-700: 边框让它融入背景 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    /* 悬浮感阴影 */
}

/* 4. 代码块里的文字 */
.prose pre code {
    background-color: transparent !important;
    /* 继承父元素背景 */
    color: inherit !important;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0;
    border: none;
}

/* 5. 图片优化 (Image) - 完美支持 Page Bundle 相对路径 */
.prose img {
    max-width: 100%;
    /* 核心：防止大图撑破手机屏 */
    height: auto;
    /* 保持比例 */
    display: block;
    /* 独占一行 */
    margin: 2rem auto;
    /* 上下间距 & 居中 */
    border-radius: 8px;
    /* 图片圆角 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    /* 优雅的投影 */
    border: 1px solid #f1f5f9;
    /* 极细的白边框，像照片一样 */
}

/* 6. 链接优化 */
.prose a {
    color: #0891b2;
    text-decoration: none;
    border-bottom: 1px dashed #0891b2;
    padding-bottom: 1px;
    transition: all 0.2s;
}

.prose a:hover {
    background-color: #ecfeff;
    /* Cyan-50 */
    border-bottom-style: solid;
}

/* 7. 引用块 (Blockquote) */
.prose blockquote {
    border-left: 4px solid #cbd5e1;
    /* Slate-300 */
    background-color: #f8fafc;
    /* Slate-50 */
    padding: 1rem 1.5rem;
    font-style: italic;
    color: #64748b;
    margin: 2rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
}