/* ============================================================
   GO爱踏网 AI 搜索 —— 搜索框流光 / 卡通小助手 / 结果浮层
   品牌色取自官网 LOGO：#EE1820
   ============================================================ */

/* ---------- 流光角度变量（用于旋转 conic-gradient） ---------- */
@property --gasAng {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ---------- 搜索框容器 ----------
   注意：不要改 .header-search 的 position，主题用 absolute 居中定位。 */
.header-search .search-input {
    position: relative;
    z-index: 1;
}

/* 一圈流光：用 mask 挖空中间，只留边框 */
.gas-glow {
    position: absolute;
    inset: -3px;
    border-radius: 7px;
    padding: 2px;
    pointer-events: none;
    z-index: 4;
    background: conic-gradient(from var(--gasAng),
        rgba(238, 24, 32, 0) 0deg,
        rgba(238, 24, 32, .55) 30deg,
        rgba(255, 92, 82, 1) 58deg,
        rgba(255, 255, 255, 1) 76deg,
        rgba(255, 92, 82, 1) 94deg,
        rgba(238, 24, 32, .5) 124deg,
        rgba(238, 24, 32, 0) 168deg,
        rgba(238, 24, 32, 0) 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: gasFlow 3.1s linear infinite;
    opacity: .9;
    transition: opacity .25s ease;
    filter: drop-shadow(0 0 5px rgba(238, 24, 32, .35));
}
@keyframes gasFlow {
    to { --gasAng: 360deg; }
}

/* 光标进入输入框：流光停住，改为常亮描边
   同时用 :focus-within（纯 CSS，任何方式聚焦都生效）和 .gas-focus（JS 兜底） */
.header-search.gas-host:focus-within .gas-glow,
.header-search.gas-focus .gas-glow,
.header-search.gas-host:focus-within .gas-glow:hover,
.header-search.gas-focus .gas-glow:hover {
    animation-play-state: paused !important;
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(238, 24, 32, .55));
}

/* 不支持 @property 时的兜底：柔和呼吸光 */
@supports not (background: conic-gradient(from var(--gasAng), red, blue)) {
    .gas-glow {
        background: rgba(238, 24, 32, .28);
        filter: blur(4px);
        animation: gasBreath 2.4s ease-in-out infinite;
        -webkit-mask: none;
        mask: none;
        padding: 0;
    }
    @keyframes gasBreath {
        0%, 100% { opacity: .22; }
        50%      { opacity: .5; }
    }
}

/* ---------- 「AI」徽章：放在输入框右端（搜索按钮之前） ---------- */
/* ============================================================
   搜索按钮：「AI 徽章 + 搜索」合成同一个框
   ============================================================ */

/* 输入框必须让位给右侧按钮，且不能盖住按钮 */
.header-search.gas-host .search-input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 0 96px 0 30px !important;
    position: relative;
    z-index: 1;                     /* 低于按钮(6)，点击才落到按钮上 */
}

.header-search.gas-host .search-submit {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    z-index: 6 !important;          /* 关键：永远在最上层，保证可点 */
    width: 86px !important;
    min-width: 0 !important;
    height: 40px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 9px !important;
    background: linear-gradient(135deg, #FF5A52 0%, #EE1820 100%) !important;
    border: 0 !important;
    border-left: 0 !important;
    border-radius: 0 3px 3px 0 !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: .5px;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    transition: filter .15s ease;
}
.header-search.gas-host .search-submit:hover {
    background: linear-gradient(135deg, #FF6A62 0%, #D41318 100%) !important;
    box-shadow: none !important;
}
.header-search.gas-host .search-submit:active {
    filter: brightness(.94);
}

/* 徽章现在是按钮里的一个元素 */
.header-search.gas-host .gas-badge {
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .26);
    box-shadow: none;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .3px;
    line-height: 1.6;
    pointer-events: none;
    flex: 0 0 auto;
}
.gas-badge i {
    width: 2.5px;
    height: 2.5px;
    border-radius: 50%;
    background: #fff;
    opacity: .85;
    animation: gasBadgeDot 1.4s ease-in-out infinite;
}
.gas-badge i:nth-child(2) { animation-delay: .2s; }
.gas-badge i:nth-child(3) { animation-delay: .4s; }
@keyframes gasBadgeDot {
    0%, 100% { opacity: .3; transform: scale(.8); }
    50%      { opacity: 1;  transform: scale(1.15); }
}

/* 空输入时抖动提示 */
.header-search.gas-nudge {
    animation: gasNudge .42s cubic-bezier(.36, .07, .19, .97);
}
@keyframes gasNudge {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}

/* 关闭后从搜索框「吐出」的脉冲光环 */
.gas-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 7px;
    border: 2px solid rgba(238, 24, 32, .7);
    pointer-events: none;
    z-index: 3;
    animation: gasPulse .7s cubic-bezier(.22, 1, .36, 1) forwards;
}
@keyframes gasPulse {
    0%   { opacity: .9; transform: scale(.96); }
    100% { opacity: 0;  transform: scale(1.16); }
}

/* ============================================================
   卡通小助手（由 LOGO 的红色圆形 + GO 字牌演化）
   ============================================================ */
.gas-bot {
    position: fixed;
    left: 0;
    top: 0;
    width: 96px;
    height: 96px;
    margin: -48px 0 0 -48px;
    pointer-events: none;
    z-index: 999995;
    display: none;
    will-change: transform;
}
.gas-bot.on { display: block; }

.gas-bot-in {
    width: 100%;
    height: 100%;
    transform-origin: 50% 62%;
    animation: botFloat 2.1s ease-in-out infinite;
}
@keyframes botFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-6px) rotate(2deg); }
}

/* 出现：弹性放大 */
.gas-bot.pop .gas-bot-in {
    animation: botPop .52s cubic-bezier(.34, 1.56, .64, 1) both,
               botFloat 2.1s ease-in-out .52s infinite;
}
@keyframes botPop {
    0%   { transform: scale(.1) rotate(-16deg); opacity: 0; }
    55%  { transform: scale(1.16) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 思考：放大摇摆 */
.gas-bot.think .gas-bot-in {
    animation: botThink 1.1s ease-in-out infinite;
}
@keyframes botThink {
    0%, 100% { transform: translateY(0) rotate(-5deg) scale(1); }
    25%      { transform: translateY(-8px) rotate(0deg) scale(1.04); }
    50%      { transform: translateY(0) rotate(5deg) scale(1); }
    75%      { transform: translateY(-8px) rotate(0deg) scale(1.04); }
}

/* 缩小飞向文字：交给 JS transition */
.gas-bot.leave .gas-bot-in {
    animation: none;
    transition: transform .5s cubic-bezier(.55, 0, .68, .19), opacity .45s ease .1s;
    transform: scale(.18);
    opacity: 0;
}

.gas-bot svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 8px 18px rgba(238, 24, 32, .3));
}

/* 天线小灯脉冲 */
.bot-orb {
    animation: botOrb 1s ease-in-out infinite;
    transform-origin: 50px 13px;
    transform-box: fill-box;
}
@keyframes botOrb {
    0%, 100% { opacity: .55; }
    50%      { opacity: 1; }
}

/* 眨眼 */
.bot-eye {
    transform-origin: center;
    transform-box: fill-box;
    animation: botBlink 4.2s ease-in-out infinite;
}
@keyframes botBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    95%           { transform: scaleY(.08); }
}

/* 瞳孔左右看 */
.bot-pupil {
    animation: botLook 3.4s ease-in-out infinite;
}
@keyframes botLook {
    0%, 100% { transform: translate(0, 0); }
    25%      { transform: translate(2px, 0); }
    55%      { transform: translate(-2px, 1px); }
    80%      { transform: translate(0, 0); }
}

/* 笑眼（出结果时） */
.bot-smile { opacity: 0; }
.gas-bot.happy .bot-smile { opacity: 1; animation: botSmileIn .35s ease; }
.gas-bot.happy .bot-eye,
.gas-bot.happy .bot-pupil { opacity: 0; }
@keyframes botSmileIn {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 思考时头顶冒泡泡 */
.gas-bot-bubbles {
    position: absolute;
    left: 50%;
    top: -4px;
    transform: translateX(-50%);
    display: none;
}
.gas-bot.think .gas-bot-bubbles { display: block; }
.gas-bot-bubbles span {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(238, 24, 32, .28);
    animation: botBubble 1.5s ease-out infinite;
}
.gas-bot-bubbles span:nth-child(1) { width: 7px;  height: 7px;  left: -4px; top: 4px;  animation-delay: 0s; }
.gas-bot-bubbles span:nth-child(2) { width: 10px; height: 10px; left: 6px;  top: -4px; animation-delay: .3s; }
.gas-bot-bubbles span:nth-child(3) { width: 6px;  height: 6px;  left: -12px; top: -8px; animation-delay: .6s; }
@keyframes botBubble {
    0%   { opacity: 0; transform: translateY(4px) scale(.4); }
    35%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-16px) scale(1); }
}

/* ============================================================
   结果浮层
   ============================================================ */
.gas-root {
    position: fixed;
    inset: 0;
    z-index: 999990;
    display: none;
}
.gas-root.gas-open { display: block; }

.gas-veil {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 20, .42);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .26s ease;
}
.gas-root.gas-shown .gas-veil { opacity: 1; }

.gas-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.gas-panel {
    position: relative;
    width: min(760px, 100%);
    height: min(76vh, 680px);
    max-height: calc(100vh - 32px);
    margin: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28), 0 3px 12px rgba(0, 0, 0, .08);
    overflow: hidden;
    pointer-events: auto;
    will-change: transform, opacity;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #2b2b2b;
    box-sizing: border-box;
}
.gas-panel * { box-sizing: border-box; }

.gas-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}
.gas-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF5A52, #EE1820);
    box-shadow: 0 0 0 3px rgba(238, 24, 32, .14);
    flex: 0 0 auto;
}
.gas-brand {
    flex: 1;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1f1f1f;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gas-x {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: #f5f5f5;
    color: #888;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s, color .15s;
}
.gas-x:hover { background: #ececec; color: #333; }

.gas-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 22px 6px;
    font-size: 14.5px;
    line-height: 1.85;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.gas-body::-webkit-scrollbar { width: 8px; }
.gas-body::-webkit-scrollbar-thumb { background: #dcdcdc; border-radius: 4px; }
.gas-body::-webkit-scrollbar-track { background: transparent; }

.gas-q {
    font-size: 13px;
    color: #999;
    margin: 0 0 12px;
    padding-left: 10px;
    border-left: 3px solid #EE1820;
    line-height: 1.7;
    word-break: break-word;
}

/* 富文本 */
.gas-md p { margin: 0 0 12px; }
.gas-md h2, .gas-md h3, .gas-md h4 {
    margin: 20px 0 10px;
    font-size: 16px;
    font-weight: 650;
    color: #1a1a1a;
    line-height: 1.5;
}
.gas-md h2 { font-size: 17px; }
.gas-md ul, .gas-md ol { margin: 0 0 13px; padding-left: 22px; }
.gas-md li { margin: 5px 0; }
.gas-md strong { color: #111; font-weight: 650; }
.gas-md code {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 13px;
    color: #c7254e;
}
.gas-md pre {
    background: #f7f7f8;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0 0 13px;
}
.gas-md pre code { background: none; padding: 0; color: #333; }
.gas-md blockquote {
    margin: 0 0 13px;
    padding: 8px 14px;
    border-left: 3px solid #ffd0cb;
    background: #fffaf9;
    color: #666;
}
.gas-md a { color: #EE1820; text-decoration: none; }
.gas-md a:hover { text-decoration: underline; }
.gas-md hr { border: 0; border-top: 1px solid #eee; margin: 16px 0; }

/* 光标 */
.gas-caret {
    display: inline-block;
    width: 7px;
    height: 15px;
    margin-left: 2px;
    vertical-align: -2px;
    background: #EE1820;
    border-radius: 2px;
    animation: gasBlink .9s steps(2, start) infinite;
}
@keyframes gasBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

/* 加载态（小人接管后基本不出现，留作兜底） */
.gas-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #999;
    font-size: 13.5px;
    padding: 6px 0 16px;
}
.gas-loading i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #EE1820;
    opacity: .35;
    animation: gasDot 1.15s infinite ease-in-out;
}
.gas-loading i:nth-child(2) { animation-delay: .16s; }
.gas-loading i:nth-child(3) { animation-delay: .32s; }
.gas-loading span { margin-left: 6px; }
@keyframes gasDot {
    0%, 80%, 100% { opacity: .28; transform: scale(.85); }
    40%           { opacity: 1;   transform: scale(1.15); }
}

/* 参考来源 */
.gas-src {
    margin: 16px 0 8px;
    padding-top: 14px;
    border-top: 1px dashed #eee;
}
.gas-src-t {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 8px;
    letter-spacing: .3px;
}
.gas-src ul { margin: 0; padding: 0; list-style: none; }
.gas-src li {
    margin: 0 0 6px;
    font-size: 13.5px;
    line-height: 1.55;
}
.gas-src li a {
    color: #444;
    text-decoration: none;
    display: inline-block;
    padding-left: 13px;
    position: relative;
    transition: color .15s;
}
.gas-src li a::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #EE1820;
}
.gas-src li a:hover { color: #EE1820; }

/* 底部 */
.gas-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #f0f0f0;
    background: #fcfcfc;
}
.gas-status {
    flex: 1;
    font-size: 12.5px;
    color: #9a9a9a;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gas-status .gas-spin {
    width: 11px;
    height: 11px;
    border: 2px solid #eee;
    border-top-color: #EE1820;
    border-radius: 50%;
    animation: gasSpin .7s linear infinite;
    flex: 0 0 auto;
}
@keyframes gasSpin {
    to { transform: rotate(360deg); }
}

.gas-art {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #EE1820;
    text-decoration: none;
    font-size: 12.5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    animation: gasFadeIn .3s ease;
}
@keyframes gasFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: none; }
}
.gas-art:hover { text-decoration: underline; }
.gas-art .gas-new {
    flex: 0 0 auto;
    font-size: 10px;
    background: rgba(238, 24, 32, .12);
    color: #EE1820;
    border-radius: 3px;
    padding: 0 4px;
    font-weight: 700;
    animation: gasPop .4s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes gasPop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.gas-btn {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 13px;
    border-radius: 7px;
    border: 1px solid #e6e6e6;
    background: #fff;
    color: #555;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.gas-btn:hover { background: #f7f7f7; border-color: #dcdcdc; color: #333; }
.gas-btn-pri {
    background: #EE1820;
    border-color: #EE1820;
    color: #fff;
    font-weight: 600;
}
.gas-btn-pri:hover { background: #D41318; border-color: #D41318; color: #fff; }
.gas-btn:disabled { opacity: .5; cursor: default; }

/* 提示气泡 */
.gas-toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    transform: translate(-50%, 14px);
    background: rgba(30, 30, 32, .93);
    color: #fff;
    font-size: 13px;
    padding: 9px 17px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s, transform .22s;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.gas-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 平板/窄屏：主题默认把搜索框藏起来、靠图标展开。
   这里直接让它常显，作为 logo 行的下一行铺满宽度。 */
@media (max-width: 959px) {
    /* header 与 logo 行改为自适应高度，容纳常显的搜索框 */
    header.site-header,
    .site-start {
        height: auto !important;
    }
    .site-start {
        padding-bottom: 10px;
    }

    .header-search.gas-host {
        display: block !important;
        position: relative !important;   /* 保持为按钮的定位祖先 */
        float: none !important;
        clear: both !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 8px !important;
        padding: 0 !important;
        box-sizing: border-box;
    }
    .header-search.gas-host form {
        width: 100% !important;
    }

    /* 搜索框已常显，右上角放大镜图标不再需要 */
    .search-icon {
        display: none !important;
    }

    /* 常显时不需要额外内边距补偿 */
    .header-search.gas-host .search-input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
}

/* 手机 */
@media (max-width: 640px) {
    .gas-center {
        align-items: flex-end;
        padding: 0;
    }
    .gas-panel {
        width: 100%;
        height: 80vh;
        max-height: 88vh;
        border-radius: 16px 16px 0 0;
    }
    .gas-body { padding: 16px 16px 4px; font-size: 14px; }
    .gas-head { padding: 13px 14px; }
    .gas-foot { padding: 11px 14px; }
    .gas-btn { padding: 0 11px; }
    .gas-bot { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
}

@media (prefers-reduced-motion: reduce) {
    .gas-veil, .gas-panel { transition-duration: .01ms !important; }
    .gas-glow, .gas-bot-in, .bot-eye, .bot-pupil, .bot-orb { animation: none !important; }
}
