/* =====================================================================
   ربات «خودت» (khodet-robot.js)
   حرکت‌ها همه با جاوااسکریپت (فنر) است؛ اینجا فقط رنگ، اندازه و افکت‌ها.
   اندازه روی .kdr-bot--{mode} است (نه میزبان) تا بعد از ناوبری بدون رفرش عوض نشود.
   ===================================================================== */
.kdr { position: relative; }

.kdr-bot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 160px;
    will-change: transform;
}

.kdr-bot--hero { width: 160px; cursor: pointer; }
.kdr-bot--desk { position: relative; right: auto; width: 230px; cursor: pointer; }
.kdr-bot--floor { width: 66px; }

@media (max-width: 767.98px) {
    .kdr-bot--hero { width: 108px; }
    .kdr-bot--desk { width: 180px; }
    .kdr-bot--floor { width: 52px; }
}

.kdr-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ---------- رنگ‌ها: فلز زرد زنگ‌زده، خاکستری، لنزهای تیره */
.kdw-shadow { fill: rgba(0, 0, 0, .28); }

.kdw-tread__body { fill: #4b4b4f; }
.kdw-tread__plate { fill: #6f7076; }
.kdw-tread__belt { fill: none; stroke: #232326; stroke-width: 5.5; stroke-dasharray: 3.2 2.6; stroke-linejoin: round; }
.kdw-wheel circle { fill: #8d8e94; stroke: #3a3a3e; stroke-width: 1.4; }
.kdw-wheel path { stroke: #4a4a4f; stroke-width: 1.6; }
.kdw-wheel .kdw-wheel__hub { fill: #3a3a3e; stroke: none; }
.kdw-tread--far .kdw-tread__body { fill: #333336; }
.kdw-tread--far .kdw-tread__plate { fill: #4d4e52; }
.kdw-tread--far .kdw-wheel circle { fill: #66676c; }

.kdw-box__side { fill: #c98a14; stroke: #7a4f00; stroke-width: 1.3; stroke-linejoin: round; }
.kdw-box__front { fill: #eab02a; stroke: #7a4f00; stroke-width: 1.3; stroke-linejoin: round; }
.kdw-box__top { fill: #f6cd57; stroke: #7a4f00; stroke-width: 1.3; stroke-linejoin: round; }
.kdw-box__lid { fill: none; stroke: #b98510; stroke-width: 1; }
.kdw-line { fill: none; stroke: #9a6704; stroke-width: 1; }
.kdw-rivet { fill: #8a5a05; }
.kdw-rust { fill: #9b5413; opacity: .45; }
.kdw-rust--dark { fill: #5f3108; opacity: .55; }
.kdw-rail { fill: #6b6c70; stroke: #3d3d40; stroke-width: .8; }
.kdw-gauge { fill: #2b2b2d; stroke: #111; stroke-width: .8; }
.kdw-bar { fill: #f7e44c; }
.kdw-btn { fill: #e0393e; }
.kdw-btn--g { fill: #48c774; }
.kdw-vent { stroke: #8a5a05; stroke-width: 1.2; stroke-linecap: round; }
.kdw-plate { fill: #2f2410; }
.kdw-plate__text { fill: #ffd84a; font: 800 6.4px/1 Arial, sans-serif; letter-spacing: .6px; text-anchor: middle; }

.kdw-arm__bar { fill: #8e8f95; stroke: #505055; stroke-width: 1.2; }
.kdw-arm__line { stroke: #66676c; stroke-width: 1.2; }
.kdw-arm__palm { fill: #76777c; stroke: #48484c; stroke-width: 1; }
.kdw-arm__joint { fill: #5b5c61; stroke: #333; stroke-width: 1; }
.kdw-claw { fill: #9a9ba1; stroke: #48484c; stroke-width: 1; stroke-linejoin: round; }
.kdw-arm--far .kdw-arm__bar,
.kdw-arm--far .kdw-claw { fill: #6c6d72; }

.kdw-neck__base { fill: #7b7c81; stroke: #48484c; stroke-width: 1; }
.kdw-neck__ring { stroke: #55565a; stroke-width: 1.2; }
.kdw-neck__top { fill: #95969b; stroke: #55565a; stroke-width: 1; }
.kdw-neck__cap { fill: #66676c; }

.kdw-eye__house { fill: #a7a8ad; stroke: #5d5e63; stroke-width: 1.4; stroke-linejoin: round; }
.kdw-eye--far .kdw-eye__house { fill: #8f9095; }
.kdw-eye__brow { fill: #7e7f84; }
.kdw-eye__vent { stroke: #7a7b80; stroke-width: 1.3; stroke-linecap: round; }
.kdw-eye__ring { fill: #232326; stroke: #6d6e73; stroke-width: 2.4; }
.kdw-eye__glass { fill: #10161c; }
.kdw-eye__iris { fill: #34495a; stroke: #4f6b80; stroke-width: .8; }
.kdw-eye__pupil { fill: #030405; }
.kdw-eye__shine { fill: #fff; opacity: .9; }
.kdw-lid { fill: #9a9ba0; }
.kdw-bridge { fill: #58595e; stroke: #3a3a3e; stroke-width: 1; }

/* ---------- وسایل در دست (فقط هنگام رفتار مربوط) */
.kdw-prop { opacity: 0; transition: opacity .3s; }
.kdr-bot[data-prop="bulb"] .kdw-bulb,
.kdr-bot[data-prop="boot"] .kdw-boot { opacity: 1; }
.kdw-bulb__glass { fill: #fff6b8; stroke: #c9b23c; stroke-width: 1; }
.kdw-bulb__base { fill: #8d8e94; }
.kdw-bulb__glow { fill: rgba(255, 236, 120, .45); animation: kdr-glow 1.4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.kdw-boot__shoe { fill: #6d4a2a; stroke: #3d2812; stroke-width: 1; }
.kdw-boot__stem { fill: none; stroke: #3f8f3a; stroke-width: 1.8; stroke-linecap: round; }
.kdw-boot__leaf { fill: #5cc14f; }

.kdw-cube { opacity: 0; }
.kdw-cube rect { fill: #8c6b3c; stroke: #4d3818; stroke-width: 1; }
.kdw-cube path { stroke: #4d3818; stroke-width: .9; fill: none; }
.kdr-bot[data-fx="cube"] .kdw-cube { animation: kdr-cube 3.6s ease-out forwards; }

/* شارژ خورشیدی: نوارها یکی‌یکی روشن می‌شوند */
.kdr-bot[data-act="charge"] .kdw-bar { animation: kdr-charge 2.4s steps(1) infinite; }
.kdr-bot[data-act="charge"] .kdw-bar--2 { animation-delay: .4s; }
.kdr-bot[data-act="charge"] .kdw-bar--3 { animation-delay: .8s; }
.kdr-bot[data-act="charge"] .kdw-bar--4 { animation-delay: 1.2s; }
.kdr-bot[data-act="charge"] .kdw-bar--5 { animation-delay: 1.6s; }
.kdw-btn--g { animation: kdr-blink 2.2s steps(1) infinite; }

/* ---------- افکت‌ها */
.kdr-fx { opacity: 0; transition: opacity .3s; pointer-events: none; }
.kdr-zzz text, .kdr-notes text { font: 700 16px/1 Arial, sans-serif; }
.kdr-zzz text { fill: #8fdcff; }
.kdr-notes text { fill: #e8d716; }
.kdr-heart path { fill: #ff5a7a; }
.kdr-sparkle path { fill: #ffe45c; }
.kdr-bot[data-fx="zzz"] .kdr-zzz,
.kdr-bot[data-fx="notes"] .kdr-notes,
.kdr-bot[data-fx="heart"] .kdr-heart,
.kdr-bot[data-fx="sparkle"] .kdr-sparkle { opacity: 1; }
.kdr-zzz text, .kdr-notes text, .kdr-heart path, .kdr-sparkle path { transform-box: fill-box; transform-origin: center; }
.kdr-zzz text { animation: kdr-float 2.4s ease-in-out infinite; }
.kdr-zzz text:nth-child(2) { animation-delay: .5s; }
.kdr-zzz text:nth-child(3) { animation-delay: 1s; }
.kdr-notes text { animation: kdr-float 1.6s ease-in-out infinite; }
.kdr-notes text:nth-child(2) { animation-delay: .4s; }
.kdr-notes text:nth-child(3) { animation-delay: .8s; }
.kdr-heart path { animation: kdr-heart 1.8s ease-in-out infinite; }
.kdr-sparkle path { animation: kdr-twinkle .9s ease-in-out infinite alternate; }
.kdr-sparkle path:nth-child(2) { animation-delay: .3s; }
.kdr-sparkle path:nth-child(3) { animation-delay: .6s; }

/* ---------- صحنه‌ی میز کار */
.kdr-desk__top { fill: #9a6a3c; }
.kdr-desk__panel { fill: #7b5230; }
.kdr-desk__leg { fill: #5e3e22; }
.kdr-keyboard { fill: #3a3d44; stroke: #22252b; stroke-width: 1; }
.kdr-monitor__frame { fill: #2a2d34; stroke: #15171c; stroke-width: 1.2; }
.kdr-monitor__screen { fill: #0d1726; transition: fill .6s; }
.kdr-monitor__stand, .kdr-monitor__foot { fill: #3b3f47; }
.kdr-monitor__led { fill: #48c774; }
.kdr-code { opacity: .85; transition: opacity .5s; }
.kdr-screen-ok, .kdr-screen-think, .kdr-screen-saver { opacity: 0; transition: opacity .4s; }
.kdr-screen-ok circle { fill: #18a058; }
.kdr-screen-ok path { fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.kdr-screen-think { fill: #e8d716; font: 800 18px/1 monospace; text-anchor: middle; }
.kdr-screen-saver { fill: #e8d716; font: 800 11px/1 Arial, sans-serif; text-anchor: middle; animation: kdr-saver 6s ease-in-out infinite; }
.kdr-bot[data-act="cheer"] .kdr-code,
.kdr-bot[data-act="think"] .kdr-code,
.kdr-bot[data-act="charge"] .kdr-code { opacity: 0; }
.kdr-bot[data-act="cheer"] .kdr-screen-ok,
.kdr-bot[data-act="think"] .kdr-screen-think,
.kdr-bot[data-act="charge"] .kdr-screen-saver { opacity: 1; }
.kdr-bot[data-act="charge"] .kdr-monitor__screen { fill: #05080d; }

/* نسخه‌ی کوچک پایین پنل: افکت‌ها شلوغ می‌کنند */
.kdr-bot--floor .kdr-fx { display: none; }

/* ---------- حباب گفتگو (بنر) */
.kdr-bubble {
    position: absolute;
    left: 50%;
    bottom: 100%;
    max-width: 230px;
    margin-bottom: 4px;
    padding: 8px 14px;
    border-radius: 16px;
    background: #fff;
    color: #202020;
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px) scale(.9);
    transition: opacity .25s, transform .3s cubic-bezier(.3, 1.5, .5, 1);
}

.kdr-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    border: 7px solid transparent;
    border-top-color: #fff;
    transform: translateX(-50%);
}

.kdr-bot.has-bubble .kdr-bubble { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- کف پنل: خط باریک پایین صفحه و ربات پشت میز در گوشه */
.kdr-floor {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    z-index: 1029;
    pointer-events: none;
}

.kdr-floor::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(232, 215, 22, .7) 20%, rgba(232, 215, 22, .7) 80%, transparent);
}

.kdr-floor .kdr-bot--floor { right: auto; left: 18px; }

@media print { .kdr-floor { display: none !important; } }

/* ---------- keyframes */
@keyframes kdr-glow { from { opacity: .5; transform: scale(.9); } to { opacity: 1; transform: scale(1.15); } }
@keyframes kdr-charge { 0% { opacity: .15; } 50% { opacity: 1; } }
@keyframes kdr-blink { 50% { opacity: .2; } }
@keyframes kdr-float { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-12px); } }
@keyframes kdr-heart { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.15); } }
@keyframes kdr-twinkle { from { opacity: .3; transform: scale(.7); } to { opacity: 1; transform: scale(1.1); } }
@keyframes kdr-saver { 0%, 100% { transform: translate(-14px, -8px); } 50% { transform: translate(14px, 8px); } }
@keyframes kdr-cube {
    0%, 52% { opacity: 0; transform: translate(-12px, -14px); }
    62% { opacity: 1; transform: translate(0, 0); }
    68% { transform: translate(0, -4px); }
    74%, 90% { opacity: 1; transform: translate(0, 0); }
    100% { opacity: 0; transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .kdr-bot *, .kdr-bot *::before { animation: none !important; transition: none !important; }
}
