:root {
    --primary-green: #6b6b6b;
    --primary-light: #838383;
    --primary-hover: #4f4f4f;
    --bg-start: #5a5a5a;
    --bg-end: #6b6b6b;
    --badge-bg: #f2f2f2;``
    --badge-border: #d9d9d9;
    --bg-color: #585b5d;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
}

body { 
    font-family: 'PingFang TC', 'Heiti TC', 'Noto Sans TC', sans-serif; 
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%); 
    color: var(--text-dark); 
    margin: 0; 
    padding: 0; 
    min-height: 100vh; 
    overflow-x: hidden; 
}

/* 進度提示膠囊：固定在大圖底部正中央 */
#stageStatusBar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    z-index: 25;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    pointer-events: none;
}

/* 綠色選取框
.sam-target-box {
    position: absolute;
    border: 3px solid #10b981;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    z-index: 15;
    pointer-events: none;
    transition: all 0.2s ease;
}
 */

#objectsOverlay {
    pointer-events: none !important;
}

/* ===================================================
   導覽列 (Header)
   =================================================== */
.header { 
    background-color: var(--card-bg); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    padding: 12px 20px; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    display: flex;
    justify-content: center;
}

.header-inner {
    width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 15px; }

.logo { 
    display: flex; 
    align-items: center; 
    text-decoration: none;
    position: relative;
    z-index: 120;
    margin-top: -8px;
    margin-bottom: -32px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo:hover { transform: translateY(-3px) scale(1.05); }
.logo-img {
    height: 80px;
    width: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22));
}

.icon-mushroom {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  vertical-align: middle; 
  background-color: currentColor; 
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M15 15v4a3 3 0 0 1 -5.995 .176l-.005 -.176v-4h6zm-10.1 -2a1.9 1.9 0 0 1 -1.894 -1.752l-.006 -.148c0 -5.023 4.027 -9.1 9 -9.1s9 4.077 9 9.1a1.9 1.9 0 0 1 -1.752 1.894l-.148 .006h-14.2z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M15 15v4a3 3 0 0 1 -5.995 .176l-.005 -.176v-4h6zm-10.1 -2a1.9 1.9 0 0 1 -1.894 -1.752l-.006 -.148c0 -5.023 4.027 -9.1 9 -9.1s9 4.077 9 9.1a1.9 1.9 0 0 1 -1.752 1.894l-.148 .006h-14.2z'/></svg>");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { 
    text-decoration: none; 
    color: var(--text-dark); 
    font-weight: 600; 
    padding: 6px 10px; 
    border-radius: 20px; 
    cursor: pointer; 
    transition: 0.2s; 
    font-size: 13.5px; 
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
    white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { 
    color: #ffffff; 
    background-color: var(--primary-green); 
}

.social-icon-btn i.fa-circle-exclamation {
    font-size: 17px;
    color: #64748b;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-icon-btn:hover i.fa-circle-exclamation {
    color: var(--primary-green);
    transform: scale(1.15);
}

.nav-social-divider {
    width: 1px;
    height: 18px;
    background: rgba(0, 0, 0, 0.15);
    margin: 0 4px 0 2px;
}
.nav-social-links { display: flex; align-items: center; gap: 4px; }
.social-icon-btn {
    color: #4a5568 !important;
    font-size: 16px !important;
    width: 28px;
    height: 28px;
    padding: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease !important;
    text-decoration: none;
}
.social-icon-btn:hover {
    color: var(--primary-green) !important;
    transform: translateY(-1px);
}

.btn-login-header {
    background-color: var(--primary-green);
    color: #ffffff;
    border: 2px solid var(--primary-green);
    padding: 8px 22px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}
.btn-login-header:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-profile { display: flex; align-items: center; gap: 12px; background: var(--primary-green); padding: 5px 15px 5px 5px; border-radius: 30px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid #ffffff; }
.user-points { font-weight: bold; color: #ffffff; font-size: 14px; display: flex; align-items: center; gap: 5px;}
.logout-btn { background: none; border: none; color: #ffffff; cursor: pointer; font-size: 15px; margin-left: 5px; transition: 0.2s; opacity: 0.9; }
.logout-btn:hover { opacity: 1; transform: scale(1.1); }

.container { max-width: 1100px; margin: 30px auto; padding: 0 20px; }

.engine-tag { font-size: 12px; padding: 4px 8px; border-radius: 4px; background: #e3f2fd; color: #1565c0; font-weight: bold; display: inline-block; white-space: nowrap;}
.engine-tag.quarryman  { background: #e8f5e9; color: #2e7d32; }
.engine-tag.searchapi  { background: #fff3e0; color: #e65100; }
.engine-tag.aboutbirds { background: #e7dbcf; color: #ac733f; }
.engine-tag.meta, .engine-tag[class*="muse"] { background: #ede7f6; color: #5e35b1; }

.btn-outline { border: 1px solid var(--border-color); background: #fff; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; color: var(--text-dark); transition: 0.2s; white-space: nowrap;}
.btn-outline:hover { background: #f8f9fa; transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }



.category-tag { font-size: 12px; padding: 4px 8px; border-radius: 4px; background: #6546C4; color: #FFFFFF; font-weight: bold; display: inline-block; white-space: nowrap;}
.category-tag.insect { background: #398A5A; color: #FFFFFF; }
.category-tag.fungi  { background: #A2614D; color: #FFFFFF; }
.category-tag.bird   { background: #367FA3; color: #FFFFFF; }

/* ===================================================
   分類標題列
   =================================================== */
.category-header-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 8px 18px 8px 20px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.category-header-title h2 {
    margin: 0;
    font-size: 20px;
    color: #ffffff;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.category-header-title h2 i { color: var(--badge-bg); }
.category-header-title span.sub-en {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    letter-spacing: 0.8px;
}

.btn-set-default {
    background-color: var(--primary-green);
    color: #ffffff;
    border: 2px solid var(--primary-green);
    border-radius: 18px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    backdrop-filter: blur(4px);
}
.btn-set-default:hover { background: var(--primary-light); transform: scale(1.04); }
.btn-set-default.is-active {
    background: #ffffff;
    color: var(--primary-green);
    border-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}

.badge-pill-taxon {
    font-size: 12px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--badge-bg);
    color: var(--primary-green);
    border: 1px solid var(--badge-border);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* ===================================================
   操作卡片與上傳佈局
   =================================================== */
.control-card { 
    background: var(--card-bg); 
    padding: 30px; 
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
    display: flex; 
    gap: 30px; 
    align-items: flex-start; 
    margin-bottom: 30px; 
}

.upload-left-wrapper {
    flex: 1.2;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-left-wrapper .upload-section { 
    flex: none !important;
    width: 100% !important;
    height: 320px;
    min-height: 320px;
    border: 2px dashed var(--primary-light); 
    border-radius: 14px; 
    background: #ffffff; 
    text-align: center; 
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer; 
    transition: 0.3s; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden;
    box-sizing: border-box;
}
.upload-left-wrapper .upload-section:hover { background: var(--badge-bg); border-color: var(--primary-green); }

.upload-left-wrapper.is-busy .btn-clear-preview,
.upload-left-wrapper.is-busy .thumb-item {
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.upload-left-wrapper.is-busy .btn-clear-preview { opacity: 0.35 !important; }
.upload-left-wrapper.is-busy .thumb-item { opacity: 0.4 !important; }

#upload-prompt {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
}
#upload-prompt i { font-size: 40px; color: var(--primary-light); margin-bottom: 15px; }
#upload-prompt h3 { margin: 0 0 5px 0; color: var(--primary-green); font-size: 18px; }
#upload-prompt p { font-size: 13px; color: var(--text-muted); margin: 0; }

.preview-overlay { 
    display: none; 
    position: absolute; 
    inset: 0; 
    width: 100%; 
    height: 100%; 
    background: #0f172a; 
    border-radius: 12px; 
    overflow: hidden; 
    z-index: 5;
    align-items: center;
    justify-content: center;
}

.preview-bg-blur {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.65);
    transform: scale(1.1);
    z-index: 1;
    pointer-events: none;
}

.upload-left-wrapper .preview-overlay img#main-preview-img {
    position: relative;
    max-height: 100%;
    max-width: 100%;
    height: 100% !important;
    width: auto !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.btn-clear-preview {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    z-index: 10;
}
.btn-clear-preview:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1);
}

.main-preview-stage {
    position: relative;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    z-index: 2;
}

#main-preview-img {
    display: block !important;
    height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.thumbnails-track {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    box-sizing: border-box;
}

.thumb-item {
    position: relative;
    flex: 1;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    background: #1e293b;
    transition: all 0.2s ease;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-item.active {
    opacity: 1;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.thumb-item:hover { opacity: 0.85; }

.thumb-item .badge-main {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.engine-section { 
    flex: 1; 
    min-width: 0;
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    gap: 12px; 
}
.engine-select { 
    width: 100%; 
    padding: 15px; 
    border-radius: 10px; 
    border: 1px solid var(--border-color); 
    font-size: 16px; 
    font-weight: bold; 
    color: var(--text-dark); 
    background-color: #fff; 
    cursor: pointer; 
}
.engine-fixed-badge {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(94, 53, 177, 0.08) 0%, rgba(126, 87, 194, 0.12) 100%);
    border: 1.5px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dark);
}
.engine-fixed-badge .badge-icon { display: flex; align-items: center; justify-content: center; color: var(--primary-green); }
.engine-fixed-badge .badge-text { font-size: 15px; font-weight: 600; flex: 1; }
.engine-fixed-badge .badge-point-tag { background: var(--primary-green); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: bold; white-space: nowrap; }

.start-btn { 
    background: var(--primary-green); 
    color: white; 
    border: none; 
    padding: 18px; 
    border-radius: 10px; 
    font-size: 18px; 
    font-weight: bold; 
    cursor: pointer; 
    width: 100%; 
    transition: 0.2s; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.15); 
}
.start-btn:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-2px); }
.start-btn:disabled { background: #9e9e9e; cursor: not-allowed; box-shadow: none; transform: none; opacity: 0.9; }
.hint-text { text-align: center; font-size: 13px; color: var(--text-muted); margin: 0; }

.scope-capsules-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}
.scope-pill {
    font-size: 11.5px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
    user-select: none;
    white-space: nowrap !important;
}
.scope-pill.allow { background-color: #f1f8e9; color: #33691e; border: 1px solid #c5e1a5; }
.scope-pill.deny { background-color: #fbe9e7; color: #c62828; border: 1px solid #ffccbc; }

/* ===================================================
   全能提示卡片 (style_2.css 原版)
   =================================================== */
.omni-notice-card {
    position: relative;
    display: none;
    align-items: center;
    background: #eeeaea;
    border: 1.5px solid #aeaeae;
    border-radius: 18px;
    padding: 12px 18px;
    margin: 18px 0 12px 0;
    overflow: visible;
    box-sizing: border-box;
}
.omni-big-bulb { font-size: 24px; color: #9a9a9a; margin-right: 14px; flex-shrink: 0; }
.omni-notice-content { flex: 1; padding-right: 90px; }
.omni-notice-desc { font-size: 12px; color: #4c1d95; line-height: 1.55; margin: 0; opacity: 0.95; }
.omni-notice-desc strong { color: #3730a3; font-weight: 700; }
.omni-notice-mascot { position: absolute; right: -15px; top: -16px; width: 115px; pointer-events: none; z-index: 10; }
.omni-notice-mascot img { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 14px rgba(91, 33, 182, 0.25)); transition: transform 0.25s ease; }
.omni-notice-card:hover .omni-notice-mascot img { transform: translateY(-4px) rotate(2.5deg); }

/* ===================================================
   整合型全新辨識結果卡片 (style_2.css 原版)
   =================================================== */
.integrated-result-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 24px 30px 32px 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    margin-bottom: 35px;
    position: relative;
    box-sizing: border-box;
}

/* 1. 頂部延伸比對與工具列 (維持電腦版單行) */
.result-toolbar-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fbfaf8;
    border: 1px solid #ede8e3;
    border-radius: 18px;
    padding: 10px 18px;
    margin-bottom: 24px;
    flex-wrap: nowrap;
    gap: 16px;
    box-sizing: border-box;
}

.toolbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.toolbar-icon-box {
    width: 38px;
    height: 38px;
    background: #fff7ed;
    color: #ea580c;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid #fed7aa;
}

.toolbar-text-group {
    display: flex;
    flex-direction: column;
}

.toolbar-title {
    font-size: 15px;
    font-weight: 800;
    color: #9a3412;
    line-height: 1.2;
}

.toolbar-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
}

.toolbar-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

a.btn-clean-pill,
button.btn-clean-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 12px 3px 4px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

a.btn-clean-pill:hover,
button.btn-clean-pill:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06);
}

.btn-clean-pill .btn-label { line-height: 1; display: inline-block; }
.btn-clean-pill .btn-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
}

.btn-clean-pill .btn-icon-circle svg {
    display: block;
    width: 15px;
    height: 15px;
}

.btn-clean-pill .icon-lens   { background: #eff6ff; color: #1a73e8; }
.btn-clean-pill .icon-google { background: #f8fafc; color: #0284c7; }
.btn-clean-pill .icon-taicol { background: #f8fafc; color: #0284c7; }
.btn-clean-pill .icon-gaga   { background: #fffbeb; color: #d97706; }
.btn-clean-pill .icon-inat   { background: #f0fdf4; color: #16a34a; }
.btn-clean-pill .icon-copy   { background: #fefce8; color: #ca8a04; }

.engine-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    background: #f8fafc;
    color: #64748b;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.reidentify-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-reidentify {
    background: #6347d1;
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 10px rgba(99, 71, 209, 0.28);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-reidentify:hover {
    background: #5134A5;
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(99, 71, 209, 0.38);
}

.reidentify-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    z-index: 100;

    /* 💡 核心：預設常態就是隱藏的 */
    display: none;
    opacity: 0;
}

/* 💡 當觸發淡出動畫時的 Class */
.reidentify-tooltip.show-and-fade {
    display: block;
    animation: tooltipFadeOut 3.5s ease forwards;
}

.reidentify-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #1e293b transparent;
}

/* 2. 中間左右兩欄 Grid */
.result-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 32px;
    align-items: start;
}

.main-image-stage {
    position: relative;
    width: 100%;
    height: 310px;
    border-radius: 18px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.result-bg-blur {
    position: absolute;
    inset: -15px;
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.65);
    transform: scale(1.1);
    z-index: 1;
    pointer-events: none;
}

.main-image-stage img#result-img {
    position: relative;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.scanning-overlay {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 235, 59, 0) 0%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 235, 59, 0) 100%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 16px rgba(255, 215, 0, 0.85);
    animation: scanAnim 1.6s ease-in-out infinite alternate;
}

.btn-expand-img {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(15, 23, 42, 0.6);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    z-index: 10;
}

/* 💡 階元降級提示膠囊（如科級、屬級鑑定收斂提醒） */
.degraded-alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}
.degraded-alert-banner i {
    color: #f59e0b;
    font-size: 16px;
    flex-shrink: 0;
}

/* 💡 前 2.5 秒完整顯示，第 2.5～3.5 秒平滑淡出並徹底隱藏 */
@keyframes tooltipFadeOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    10% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    75% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
        visibility: hidden;
    }
}

@keyframes scanAnim {
    0%   { top: 2%; opacity: 0.2; }
    50%  { opacity: 1; }
    100% { top: calc(98% - 3px); opacity: 0.2; }
}

.btn-expand-img:hover { background: rgba(15, 23, 42, 0.9); transform: scale(1.1); }

/* 問問小8 與 問題集容器 */
.agent-questions-container {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    align-items: stretch;
}

.agent-vertical-banner {
    flex-shrink: 0;
    width: 68px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-vertical-banner img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.agent-vertical-banner:hover img { transform: scale(1.05); }

.agent-pills-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.main-ask-capsule {
    background: #ffffff;
    border: 1.5px solid #e8eef3;
    border-radius: 25px;
    padding: 7px 14px 7px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    outline: none;
}
.main-ask-capsule:hover {
    background: #fbfdfc;
    border-color: var(--primary-green);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.capsule-icon-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}
.capsule-icon-circle.bg-green  { background: #e8f5e9; color: #2e7d32; }
.capsule-icon-circle.bg-red    { background: #ffebee; color: #e53935; }
.capsule-icon-circle.bg-amber  { background: #fff8e1; color: #f59e0b; }
.capsule-icon-circle.bg-blue   { background: #e3f2fd; color: #1e88e5; }
.capsule-icon-circle.bg-purple { background: #ede7f6; color: #7e57c2; }
.capsule-text { flex: 1; font-size: 12.5px; font-weight: 600; color: #334155; line-height: 1.4; }
.capsule-arrow { font-size: 13px; color: #94a3b8; flex-shrink: 0; }

/* 右側物種資訊欄 */
.gemini-candidates-box { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.gemini-candidate-pill { background: #f1f5f9; border: 1px solid var(--border-color); padding: 5px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; color: var(--text-dark); }
.gemini-candidate-pill:hover { background: #e2e8f0; border-color: #cbd5e1; }
.gemini-candidate-pill.active { background: var(--badge-bg); border-color: var(--primary-green); color: var(--primary-green); font-weight: bold; font-size: 14px;}
.gemini-candidate-pill .pill-score { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 10px; font-size: 11px; }
.gemini-candidate-pill.active .pill-score { background: rgba(0,0,0,0.12); color: var(--primary-green); }

.badge-taxon-order {
    display: inline-block;
    background: var(--badge-bg); 
    color: var(--primary-green);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.species-title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px 0; }
.species-chinese-name { font-size: 30px; font-weight: 900; color: #1e293b; margin: 0; line-height: 1.15; }
.species-scientific-name { font-size: 18px; font-style: italic; font-family: 'Georgia', serif; color: #64748b; font-weight: 500; }

.species-synonym-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.badge-synonym-tag { font-size: 11px; font-weight: 700; color: #7f7f7f; background: #e6e6e6; border: 1px solid #c6c4c4; padding: 2px 8px; border-radius: 12px; }
.species-synonym-val { font-size: 13px; color: #7f7f7f; font-weight: 600; }

.species-observation-text {
    margin-top: 14px;
    padding: 18px 20px;
    background: #f8fafc;
    border-left: 4px solid var(--primary-green);
    border-radius: 0 12px 12px 0;
    line-height: 1.8;
    color: #334155;
    font-size: 14.5px;
}

/* 3. 中間細緻葉子分隔線 */
.leaf-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px 0 20px 0;
    position: relative;
}
.leaf-divider::before,
.leaf-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.leaf-divider i {
    padding: 0 16px;
    color: #cbd5e1;
    font-size: 17px;
}

/* 4. 底欄圖庫區塊 */
.gallery-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}
.gallery-header-left { display: flex; align-items: center; gap: 10px; }
.gallery-header-left i { font-size: 18px; color: #1e293b; }
.gallery-main-title { font-size: 17px; font-weight: 800; color: #1e293b; }
.gallery-sub-title { font-size: 12px; color: #94a3b8; }

.btn-more-photos {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}
.btn-more-photos:hover { background: #dcfce7; transform: translateY(-1px); }

.gallery-carousel-stage { position: relative; width: 100%; }
.gallery-scroll-container {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 2px 10px 2px;
    scrollbar-width: none;
}
.gallery-scroll-container::-webkit-scrollbar { display: none; }
.gallery-img {
    width: 200px;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.gallery-img:hover { transform: translateY(-3px); }

.gallery-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}
.gallery-nav-arrow.left { left: -14px; }
.gallery-nav-arrow.right { right: -14px; }
.gallery-nav-arrow:hover { background: #f8fafc; color: #0f172a; transform: translateY(-50%) scale(1.08); }

/* 燈箱 Lightbox */
#lightbox-modal { display: none; position: fixed; z-index: 20000; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.92); flex-direction: column; }
.lb-close { position: absolute; top: 20px; right: 30px; color: rgba(255,255,255,0.7); font-size: 40px; cursor: pointer; z-index: 20001; }
.lb-main-area { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 20px; }
#lightbox-img { max-width: 95%; max-height: 95%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.lb-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: white; border: 2px solid rgba(255,255,255,0.3); width: 60px; height: 60px; border-radius: 50%; font-size: 24px; cursor: pointer; z-index: 20000; display: flex; align-items: center; justify-content: center; }
.lb-nav-btn.left { left: 30px; }
.lb-nav-btn.right { right: 30px; }
.lb-thumb-area { height: 100px; background: rgba(15, 15, 15, 0.95); display: flex; gap: 12px; padding: 15px 20px; overflow-x: auto; align-items: center; border-top: 1px solid #333; z-index: 20000; }
.lb-thumb { height: 70px; width: 70px; object-fit: cover; cursor: pointer; border: 3px solid transparent; opacity: 0.5; border-radius: 6px; flex-shrink: 0; }
.lb-thumb.active { border-color: var(--primary-light); opacity: 1; transform: scale(1.05); }

#progress-overlay { display: none; text-align: center; padding: 20px; background: var(--badge-bg); border-radius: 12px; margin-bottom: 20px; color: var(--primary-green); font-weight: bold; border: 1px solid var(--badge-border);}
#error-card { display: none; margin-bottom: 20px; background: #fff5f5; border: 1px solid #feb2b2; padding: 20px; border-radius: 12px; text-align: center; color: #c53030; line-height: 1.5; }

/* 彈窗模態框 (登入、歷史紀錄、JSON檢視) */
#login-modal, #history-modal, #json-modal {
    display: none; position: fixed; z-index: 10000; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; backdrop-filter: blur(3px); 
}
.login-card { background: var(--card-bg); padding: 40px 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); text-align: center; max-width: 400px; width: 90%; position: relative; }
.login-card-close { position: absolute; top: 15px; right: 15px; font-size: 24px; color: var(--text-muted); cursor: pointer; background: none; border: none; }
.login-card i.main-icon { font-size: 50px; color: var(--primary-green); margin-bottom: 20px; }
.login-card h2 { margin: 0 0 10px 0; color: var(--text-dark); }
.login-card p { color: var(--text-muted); margin-bottom: 30px; line-height: 1.6; font-size: 15px;}

.history-card { background: var(--card-bg); padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-width: 850px; width: 90%; max-height: 85vh; display: flex; flex-direction: column; position: relative; }
.history-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #eee; padding-bottom: 15px; margin-bottom: 15px; }
.history-header h2 { margin: 0; color: var(--primary-green); font-size: 20px; }
.history-body { overflow-y: auto; flex: 1; }
.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th { position: sticky; top: 0; background: #ffffff; padding: 12px; text-align: left; border-bottom: 2px solid var(--primary-green); color: var(--text-dark); z-index: 1;}
.history-table td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.history-table tr:hover td { background: var(--badge-bg); }
.history-shrink-col { width: 1%; white-space: nowrap; }
.history-thumb-wrapper { position: relative; display: inline-block; cursor: pointer; }
.history-thumb { width: 45px; height: 45px; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; display: block; }
.multi-img-badge { position: absolute; top: -5px; right: -5px; background: var(--primary-green); color: white; font-size: 11px; padding: 2px 6px; border-radius: 12px; font-weight: bold; border: 1.5px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

#json-modal { z-index: 15000; }
.json-modal-content { background: #fff; width: 85%; max-width: 950px; max-height: 85vh; border-radius: 12px; display: flex; flex-direction: column; }
.json-modal-header { padding: 15px 25px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: #f8f9fa; border-radius: 12px 12px 0 0; }
.json-modal-header h3 { margin: 0; color: var(--primary-green); font-size: 18px; }
.json-close-btn { background: none; border: none; font-size: 24px; color: #999; cursor: pointer; }
.json-modal-body { padding: 10px; overflow-y: auto; flex: 1; max-height: 75vh; }
pre { margin: 0; color: #d4d4d4; font-family: Consolas, monospace; font-size: 14px; white-space: pre-wrap; }

/* 頁尾 Ecosystem 標籤 (style_2.css 原版) */
.footer-banner-wrapper { margin-top: 35px; margin-bottom: 25px; display: flex; align-items: center; justify-content: center; gap: 30px; width: 100%; }
.footer-gomap-card { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.footer-gomap-card img { width: 250px; max-width: 100%; height: auto; border-radius: 30px; display: block; }
.footer-3d-divider { width: 1px; height: 52px; background: rgba(0, 0, 0, 0.28); box-shadow: 1px 0 0 rgba(255, 255, 255, 0.22); flex-shrink: 0; }
.engine-ecosystem-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; color: #ffffff; flex: 0 0 auto; }
.ecosystem-top-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ecosystem-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: #ffffff; }
.ecosystem-sub-divider { width: 1px; height: 14px; background: rgba(255, 255, 255, 0.4); }
.ecosystem-subtitle { font-size: 13px; color: rgba(255, 255, 255, 0.8); }
.ecosystem-pills-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.engine-pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 30px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.25); text-decoration: none; color: #ffffff; font-size: 14px; font-weight: bold; }
.pill-bird { width: 18px; height: 18px; border-radius: 50%; background: #0277bd; color: #ffffff; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }

/* 側邊欄 */
.mobile-sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0; transition: opacity 0.3s; }
.mobile-sidebar { 
    position: fixed; 
    top: 0; 
    right: -280px;                    /* 💡 預設隱藏在螢幕右側外 */
    left: auto !important;            /* 💡 確保清除原本的 left 定位 */
    width: 280px; 
    height: 100%; 
    background: var(--card-bg); 
    z-index: 1001; 
    transition: right 0.3s ease;       /* 💡 動畫轉向監聽 right */
    box-shadow: -2px 0 15px rgba(0,0,0,0.1); /* 💡 陰影改向左側投射 */
    display: flex; 
    flex-direction: column; 
}
.sidebar-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.sidebar-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }
.sidebar-links { display: flex; flex-direction: column; padding: 15px 0; flex: 1; }
.sidebar-links a { padding: 15px 25px; color: var(--text-dark); text-decoration: none; font-weight: bold; font-size: 16px; border-left: 4px solid transparent; display: flex; align-items: center; gap: 12px; }
.sidebar-links a.active { color: var(--primary-green); background: var(--badge-bg); border-left-color: var(--primary-green); }

/* 💡 Google Vision 預選參考框（淡色、不加標題） */
.vision-preset-box {
    position: absolute;
    border: 1.5px dashed rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    pointer-events: none; /* 讓點擊事件直接穿透給底層圖片 */
    transition: all 0.2s ease;
    z-index: 12;
}

/* 滑鼠移入時高亮發光 (由 JS 動態增減 class) */
.vision-preset-box.is-hover {
    border: 2px solid #38bdf8;
    background: rgba(56, 189, 248, 0.22);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}

/* 鎖定高亮框 (選中時) */
.sam-target-box {
    position: absolute;
    border: 2.5px solid #10b981;
    background: rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
    z-index: 20;
    pointer-events: none;
    transition: all 0.25s ease;
}

/* 多目標標定專用炸出視窗 (style_2.css 原版) */
.target-modal-overlay {
    position: fixed; inset: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(12px); z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.target-modal-overlay.is-active { opacity: 1; pointer-events: auto; }
.target-modal-container { position: relative; width: 100%; max-width: 1300px; height: 92vh; max-height: 900px; display: flex; flex-direction: column; }
.target-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 14px 10px; color: #ffffff; user-select: none; }
.target-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.target-bird-icon { font-size: 24px; color: #7dd3fc; }
.target-title-main { font-size: 19px; font-weight: 700; }
.target-title-main .highlight-cyan { color: #38bdf8; margin-left: 2px; }
.target-title-divider { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.25); margin: 0 4px; }
.target-title-sub { font-size: 13.5px; color: #cbd5e1; }
.target-modal-close { background: rgba(255, 255, 255, 0.1); border: 1.5px solid rgba(255, 255, 255, 0.6); color: #ffffff; width: 38px; height: 38px; border-radius: 50%; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.target-modal-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: rgba(0, 0, 0, 0.4); border-radius: 16px; border: 2px solid rgba(255, 255, 255, 0.85); }
.target-img-wrap { position: relative; display: inline-flex; max-width: 100%; max-height: 100%; }
.target-img-wrap img#target-modal-img { max-width: 100%; max-height: calc(92vh - 80px); object-fit: contain; cursor: url('/images/crosshair_gray.png') 16 16, crosshair !important; }
.target-modal-overlay-box { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

/* ===================================================
   Header 右側與小 8 頂部按鈕
   =================================================== */
.header-right-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-agent-trigger {
    display: none; /* 電腦版隱藏，手機版才顯示 */
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.mobile-menu-btn {
    display: none;
}

.header-agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1.5px solid #22c55e;
    border-radius: 20px;
    padding: 2px 10px 2px 4px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.18);
    transition: all 0.2s ease;
}

.header-agent-badge:active {
    transform: scale(0.95);
}

.agent-badge-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 50%;
}

.agent-badge-text {
    font-size: 11.5px;
    font-weight: 800;
    color: #15803d;
    white-space: nowrap;
}

.mobile-category-bar {
    display: none; /* 電腦版預設不顯示 */
}

/* 側邊欄使用者區塊 */
.sidebar-user-section {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-user-box {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
}
.sidebar-user-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
}
.sidebar-user-points {
    font-size: 12px;
    color: var(--primary-green);
    font-weight: 600;
    margin-top: 2px;
}
.btn-sidebar-login {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.sidebar-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 0;
}

.mobile-upload-box {
    display: none;
}

.pwa-install-bars-wrap {
    display: none; /* 電腦版隱藏 */
}

/* 預設先隱藏，等 JS 偵測完 OS 後再精確 display: flex 打開對應的項目 */
.pwa-bar-android,
.pwa-bar-ios {
    display: none;
}

/* ===================================================
   鳥類專屬屬性 Tag 列
   =================================================== */
.bird-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px 0;
}

.bird-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 14px;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

/* 標籤色調配置 */
.bird-tag-pill.conserve-1 { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; } /* I級瀕臨絕種 */
.bird-tag-pill.conserve-2 { background: #ffedd5; color: #ea580c; border: 1px solid #fdba74; } /* II級珍貴稀有 */
.bird-tag-pill.conserve-3 { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; } /* III級應予保育 */
.bird-tag-pill.vagrant    { background: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; } /* 迷鳥 */
.bird-tag-pill.migrant    { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; } /* 過境/冬候 */
.bird-tag-pill.resident   { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; } /* 留鳥 */
.bird-tag-pill.endemic    { background: #fdf2f8; color: #db2777; border: 1px solid #fbcfe8; } /* 臺灣特有種 */
.bird-tag-pill.habitat    { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; } /* 水鳥/林鳥/猛禽 */

/* ===================================================
   2025 大數據觀測速報卡片
   =================================================== */
.bird-dashboard-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px 20px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dash-title {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-title i { color: #0284c7; }

.dash-badge {
    font-size: 11.5px;
    font-weight: 700;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 12px;
}

/* 關鍵數值指標 */
.dash-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #edf2f7;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.metric-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.metric-value {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.metric-value.highlight {
    color: #d97706; /* 高峰期凸顯琥珀金 */
}

/* 12 月份長條圖 */
.chart-subtitle {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
}

.monthly-bars-container {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 70px;
    background: #ffffff;
    border-radius: 12px;
    padding: 8px 10px 4px 10px;
    border: 1px solid #edf2f7;
    margin-bottom: 14px;
}

.month-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.month-bar-fill {
    width: 100%;
    max-width: 14px;
    background: #93c5fd;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.4s ease, background-color 0.2s ease;
}
.month-bar-fill.peak {
    background: #0284c7; /* 高峰月份深藍 */
}
.month-bar-fill:hover {
    background: #2563eb;
}

.month-bar-label {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 600;
}

/* TOP 5 鄉鎮標籤 */
.location-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.location-chip {
    font-size: 11px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 3px 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.location-chip b {
    color: #0284c7;
}

/* 看板容器：與左側欄位寬度貼齊，外距適中 */
.bird-dashboard-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 14px 16px;
    margin: 12px 0 14px 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.dash-title {
    font-size: 14.5px;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-title i { color: #0284c7; }

bird-baike-layout

/* 💡 生態標籤樣式 (水鳥、冬候鳥、不普遍等) */
.bird-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bird-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 12px;
    line-height: 1.2;
}

/* 棲地 (水鳥/林鳥/猛禽/海鳥) */
.bird-tag-pill.habitat-water { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
.bird-tag-pill.habitat-forest{ background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.bird-tag-pill.habitat-raptor{ background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* 居留型態 (留鳥/冬候鳥/過境鳥/迷鳥/引進種) */
.bird-tag-pill.residence-winter  { background: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }
.bird-tag-pill.residence-resident{ background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.bird-tag-pill.residence-transit { background: #fefce8; color: #ca8a04; border: 1px solid #fef08a; }
.bird-tag-pill.residence-vagrant { background: #fee2e2; color: #e11d48; border: 1px solid #fecdd3; }

/* 普遍度 (普遍/不普遍/稀有) */
.bird-tag-pill.rarity-common   { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.bird-tag-pill.rarity-uncommon { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.bird-tag-pill.rarity-rare     { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }

/* 保育類別 */
.bird-tag-pill.conserve { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; font-weight: 800; }

/* 6. 物種介紹與基本資料雙欄 */
.bird-top-grid {
    display: grid;
    grid-template-columns: 1fr 180px; 
    gap: 14px;
    margin-bottom: 14px;
}
.bird-card {
    border: 0px solid #e2e8f0;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.bird-card-head {
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bird-card-head.title-green { color: #16a34a; }
.bird-card-head.title-blue  { color: #2563eb; }

.bird-card-body {
    font-size: 13.5px;
    line-height: 1.7;
    padding-left: 0px;
}

.bird-traits-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.trait-row {
    display: flex;
    /* 1. 關鍵：設定置頂對齊，這樣右邊變多行時，左邊依然會固定在第一行頂部 */
    align-items: flex-start; 
    font-size: 13px;
    border-bottom: 1px dashed #f1f5f9;
    padding-bottom: 4px;
}
.trait-k { 
    color: #64748b; 
    font-weight: 500; 
    /* 2. 關鍵：固定左邊兩個字的寬度（13px * 2 = 26px，加上適當間距），防止被右邊擠壓變形 */
    width: 40px; 
    flex-shrink: 0; /* 確保寬度不會被壓縮 */
}
.trait-v { 
    font-weight: 600; 
    color: #1e293b; 
    text-align: left; 
    /* 3. 關鍵：讓右邊資訊自動填滿剩餘的所有寬度，這樣 text-align: left 就會完美靠左 */
    flex-grow: 1; 
    /* 4. 安全牌：允許瀏覽器在需要時自動換行 */
    word-break: break-word; 
}

/* 7. 整塊其他資訊 (外型、習性、區別) */
.bird-more-info-card {
    background: #f8f9fb;
    padding: 16px 20px;
    margin-top: 14px;

    /* 1. 設定頂、右、底三邊的細框線，左側設為 none 避開原本的粗線 */
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    border-left: 5px solid #5f667c;
    
    /* 2. 單獨設定右側的右上角與右下角為圓角（例如 8px），左側維持直角（0） */
    border-radius: 0 15px 15px 0; 
}
.bird-info-sec .sec-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bird-info-sec .sec-content {
    font-size: 13.5px;
    line-height: 1.68;
    color: #475569;
    margin: 0;
}
.sec-divider {
    height: 1px;
    border-top: 1px dashed #e2e8f0;
    margin: 14px 0;
}




/* ===================================================
   💡 手機版 RWD (已修復註解錯誤與大括號巢狀結構)
   =================================================== */
@media (max-width: 768px) {
    .logo {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        height: auto !important;
    }

    body {
        background: #f1f7f1 !important;
    }

    .container {
        background: #f1f7f1;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .category-header-title {
        display: none !important;
    }

	.header {
			display: flex !important;
			flex-direction: column !important;
			padding: 10px 14px 6px 14px !important;
			box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
			background: #e3f7fb url('/images/header_bg_003.png') no-repeat top center !important;
			background-size: 100% auto !important;
	}

    .header-inner {
        height: auto !important;
        min-height: 70px !important;
        padding-bottom: 4px !important;
    }

    .header-left {
        display: flex !important;
        align-items: center !important;
    }

    .logo-img {
        height: 48px !important;
        display: block !important;
    }

    .nav-links,
    .desktop-only {
        display: none !important;
    }

    .header-right-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .dash-metrics-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        
        /* 💡 1. 稍微放大圖示，視覺更平衡好點 (22px -> 24px) */
        font-size: 24px !important;
        color: #334155 !important;
        
        /* 💡 2. 往下平移 6px～7px，精準對齊「我是小8」膠囊水平中線 */
        margin-top: 6px !important;
        margin-left: 0px !important;
        padding: 4px !important;
        order: 2 !important;
        
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        line-height: 1 !important;
    }
    
    .bird-top-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* 隱藏電腦版拖曳文字 */
    .desktop-upload-prompt {
        display: none !important;
    }

    /* 💡 保留並微調外層虛線框，給予充足的上下呼吸空間 */
    .upload-left-wrapper .upload-section {
        height: auto !important;
        min-height: 240px !important;
        border: 2px dashed var(--primary-green) !important;     /* 柔和紫色虛線 */
        border-radius: 24px !important;
        background: var(--badge-bg) !important;           /* 淡淡紫白漸層感底色 */
        padding: 30px 16px 24px 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* 手機內容垂直置中容器 */
    .mobile-upload-box {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 18px !important;
    }

    /* 兩顆按鈕橫向並排 */
    .mobile-buttons-row {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 20px !important;
        width: 100% !important;
    }

    /* 💡 圖片上的立體方形卡片按鈕 */
    .mobile-action-card {
        width: 110px !important;
        height: 110px !important;
        background: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.9) !important;
        border-radius: 24px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        cursor: pointer !important;
        /* 柔和漫射陰影 + 頂部微反光 */
        box-shadow: 0 10px 25px rgba(101, 70, 196, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03) !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .mobile-action-card:active {
        transform: scale(0.94) !important;
        box-shadow: 0 4px 12px rgba(101, 70, 196, 0.05) !important;
    }

    /* 圖示尺寸與深灰配色 */
    .mobile-action-card i {
        font-size: 34px !important;
        color: #2c3e50 !important;
    }

    /* 按鈕文字 */
    .mobile-action-card span {
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #2c3e50 !important;
        letter-spacing: 0.5px !important;
    }

    /* 💡 下方提示文字 */
    .mobile-hint-text {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #64748b !important;
        letter-spacing: 0.5px !important;
        user-select: none !important;
    }

    .mobile-category-bar {
        display: flex !important;
        /* 💡 核心技巧：用左右負 margin 抵消 header 的 padding (14px)，瞬間撐滿兩側邊界 */
        margin-left: -14px !important;
        margin-right: -14px !important;
        margin-bottom: -6px !important; /* 貼齊 header 底部邊緣 */
        margin-top: 6px !important;
        
        /* 💡 尺寸自適應撐滿 */
        width: calc(100% + 28px) !important;
        box-sizing: border-box !important;
        
        /* 💡 獨立純白底色 */
        background: #ffffff !important;
        
        /* 💡 內距：左右補回 14px 讓第一顆與最後一顆膠囊保持舒適邊距 */
        padding: 8px 14px !important;
        gap: 6px !important;
        
        /* 💡 上下精緻雙向陰影（上浮出光影、下投射陰影） */
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03), 0 4px 10px rgba(0, 0, 0, 0.08) !important;
        
        /* 稍微提升層級，確保陰影壓在上方背景圖與下方卡片之上 */
        position: relative !important;
        z-index: 5 !important;
        
        /* 移除原本的頂部細線 */
        border-top: none !important;
        
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none !important;
    }

    .mobile-category-bar::-webkit-scrollbar {
        display: none !important;
    }
    .mobile-category-bar::-webkit-scrollbar {
        display: none !important;
    }

    .mobile-cat-pill {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 3px !important;
        height: 36px !important;
        padding: 0 4px !important;
        font-size: 11px;
        font-weight: 700 !important;
        border-radius: 20px !important;
        color: #475569 !important;
        border: 0px solid;
        white-space: nowrap !important;
        text-decoration: none !important;
        box-sizing: border-box !important;
    }

    .mobile-cat-pill i,
    .mobile-cat-pill .icon-mushroom {
        font-size: 11px !important;
        flex-shrink: 0 !important;
    }

    .mobile-cat-pill.active {
        font-size: 13.5px;
        background: var(--primary-green) !important;
        color: #ffffff !important;
        border: 1px solid;
        border-color: var(--primary-green) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
    }

    .integrated-result-card {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 12px 14px 40px 14px !important;
        box-sizing: border-box !important;
    }

    .main-image-stage {
        width: 100% !important;
        height: 280px !important;
        border-radius: 12px !important;
        margin: 0 auto !important;
    }

    .control-card { 
        background: #f1f7f1;
        width: 100% !important;
        border-radius: 0 !important; 
        box-shadow: none !important; 
        margin: 0 !important; 
        padding: 16px 14px !important; 
        flex-direction: column !important; 
        gap: 20px !important; 
        box-sizing: border-box !important;
    }

    .upload-left-wrapper, .engine-section {
        width: 100% !important;
        flex: none !important;
    }

    .upload-left-wrapper .upload-section {
        height: 240px !important;
        min-height: 240px !important;
    }

    .agent-fab-btn,
    #agentFabBtn,
    #agentSpeechBubble {
        display: none !important;
    }

    .toolbar-brand {
        display: none !important;
    }

    .result-toolbar-bar {
        display: flex !important;
        justify-content: center !important;
        padding: 8px 12px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        border-radius: 12px !important;
    }

    .toolbar-actions-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
        width: auto !important;
        gap: 10px !important;
    }

    .toolbar-actions-group .btn-label,
    .reidentify-tooltip,
    #res-engine,
    .engine-badge-pill {
        display: none !important;
    }

    .btn-clean-pill[style*="display: none"],
    #btn-gaga[style*="display: none"] {
        display: none !important;
    }

    .reidentify-wrapper {
        display: inline-flex !important;
    }

    .btn-clean-pill,
    .btn-reidentify {
        flex: 0 0 34px !important;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        box-shadow: none !important;
        font-size: 15px !important;
    }

    .btn-clean-pill .btn-icon-circle {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        font-size: 15px !important;
    }

    .result-main-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    .result-left-column {
        display: contents !important;
    }

    .main-image-stage {
        order: 1 !important;
    }

    .result-right-column {
        order: 2 !important;
        width: 100% !important;
    }

    #mainSuggestedQuestionsBox,
    .agent-questions-container {
        order: 3 !important;
        width: 100% !important;
        margin-top: 10px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
	.engine-fixed-badge {
		background: #d8e2d9;
		border: 2.5px solid #FFFFFF;
	}


    .agent-vertical-banner {
        width: 52px !important;
        flex-shrink: 0 !important;
    }

    .agent-pills-wrap {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .main-ask-capsule {
        padding: 6px 10px !important;
    }

    .capsule-text {
        font-size: 12px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .footer-banner-wrapper { 
        position: relative !important;
        width: 100% !important;
        /* 使用剛剛切好的背景圖：置中、貼齊底部、寬度滿版、不重複 */
        background: url('/images/footer_grass_bg_001.png') no-repeat bottom center !important;
        background-size: 100% auto !important;
        
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        
        /* 留出上下高度：讓卡片自然落在波浪弧線的正上方 */
        padding-top: 0px !important;
        padding-bottom: 28px !important;
        margin-top: 30px !important;
        margin-bottom: 0 !important;
        box-sizing: border-box !important;
    }

    /* 確保 GoMap 卡片立體浮在波浪草地中央 */
    .footer-gomap-card { 
        position: relative !important;
        z-index: 2 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        order: 2 !important;
        margin-top: -30px !important; /* 依照視覺稍微往下微調高度 */
    }

    .footer-gomap-card img { 
        width: 220px !important; 
        max-width: 85% !important;
        height: auto !important;
        filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.08)) !important;
    }

    .footer-3d-divider { 
        width: 80% !important; 
        max-width: 320px !important; 
        height: 0px !important; 
        order: 1 !important; 
    }
    /* 上方的引擎生態說明區塊 */
    .engine-ecosystem-bar { 
        position: relative !important;
        z-index: 2 !important;
        align-items: center !important; 
        width: 100% !important; 
        order: 0 !important; 
        margin-bottom: 14px !important;
    }

    .ecosystem-top-row {
        justify-content: center !important;
        text-align: center !important;
        gap: 6px !important;
    }

    .ecosystem-pills-row {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .ecosystem-title {
        color: #1e293b !important;
    }

    .ecosystem-subtitle {
        color: #64748b !important;
    }

    .ecosystem-sub-divider {
        background: #cbd5e1 !important;
    }

.engine-pill-btn {
        background: #ffffff !important;
        border: none !important;                 /* 💡 移除灰色邊框 */
        color: #2d3748 !important;               /* 文字深灰 */
        padding: 5px 12px !important;            /* 💡 縮小膠囊上下與左右內距 */
        font-size: 12px !important;              /* 💡 文字微調精巧 */
        font-weight: 600 !important;
        border-radius: 20px !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important; /* 柔和自然浮雕感 */
        gap: 6px !important;
        height: auto !important;
    }

    .engine-pill-btn svg {
        width: 14px !important;
        height: 14px !important;
        display: inline-block !important;
        vertical-align: middle !important;
    }

    /* 🌿 1. 采石工：綠色葉子 */
    .engine-pill-btn i.fa-leaf,
    .engine-pill-btn svg path[fill*="green"],
    a[href*="quarryman"] svg path {
        color: #2e7d32 !important;
        fill: #2e7d32 !important;
    }

    /* 🐦 2. 懂鳥：維持原藍底白鳥 */
    .pill-bird {
        width: 16px !important;
        height: 16px !important;
        background: #0277bd !important;
        color: #ffffff !important;
    }
    .pill-bird i {
        color: #ffffff !important;
        font-size: 9px !important;
    }

    /* ♾️ 3. Meta AI：經典品牌亮藍色 */
    a[href*="meta"] svg,
    a[href*="meta"] svg path,
    a[href*="meta"] svg circle {
        fill: #0081fb !important;
        color: #0081fb !important;
    }

    /* ✨ 4. Gemini：經典星芒科技藍 */
    a[href*="gemini"] svg,
    a[href*="gemini"] svg path,
    a[href*="google"] svg path,
    .engine-pill-btn i.fa-sparkles,
    .engine-pill-btn .fa-star {
        fill: #1a73e8 !important;
        color: #1a73e8 !important;
    }

    /* 🌀 5. ChatGPT：精緻炭灰黑色 */
    a[href*="chatgpt"] svg,
    a[href*="chatgpt"] svg path,
    a[href*="openai"] svg,
    a[href*="openai"] svg path {
        fill: #2d3748 !important;
        color: #2d3748 !important;
    }

    .header-agent-trigger {
        display: inline-flex !important;
        order: 1;
    }

	.header-agent-trigger {
		display: none; /* 電腦版隱藏，手機版顯示 */
		background: transparent !important;
		border: none !important;
		padding: 0 !important;
		margin: 0 !important;
		cursor: pointer;
		outline: none;
		align-items: center;
		justify-content: center;
		transition: transform 0.15s ease;
	}
	
	.header-agent-trigger:active {
		transform: scale(0.92);
	}
	
	.header-agent-sprite {
		width: 100px;
		height: 50px;
		background: url('/images/chat_btn_007.png') no-repeat 0 0;
		background-size: 600px 50px !important;
		display: block;
		
		/* 待機動態：週期 9 秒，前 2.5 秒輪播生動表情，後 6.5 秒靜止待機 */
		animation: agentSpriteLoop007 9s steps(5) infinite;
	}
	.pwa-install-bars-wrap {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 10px 0 6px 0;
        width: 100%;
        box-sizing: border-box;
    }

    .pwa-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 9px 14px;
        border-radius: 16px;
        cursor: pointer;
        user-select: none;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
        transition: transform 0.15s ease;
    }
    .pwa-bar:active { transform: scale(0.98); }

    /* Android 條：淡青綠底 */
    .pwa-bar-android {
        background: #f0fdf4;
        border: 1px solid #bbf7d0;
    }
    /* iOS 條：淡紫灰底 */
    .pwa-bar-ios {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
    }

    .pwa-bar-left {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13.5px;
        color: #1e293b;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pwa-bar-icon-android { font-size: 20px; color: #16a34a; flex-shrink: 0; }
    .pwa-bar-icon-ios { font-size: 20px; color: #581c87; flex-shrink: 0; }
    .omni-green { color: #16a34a; font-weight: 800; }
    .omni-orange { color: #f59e0b; font-weight: 800; }

    .pwa-bar-title { font-weight: 700; flex-shrink: 0; }
    .pwa-bar-divider { color: #cbd5e1; margin: 0 2px; flex-shrink: 0; }
    .pwa-bar-desc { font-size: 11.5px; color: #64748b; overflow: hidden; text-overflow: ellipsis; }
    .pwa-bar-arrow { color: #475569; font-size: 13px; margin-left: 8px; flex-shrink: 0; }
}

/* ========================================================
   PWA 彈窗共用與細節
   ======================================================== */
.pwa-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.pwa-modal-card {
    background: #ffffff;
    border-radius: 26px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    animation: pwaModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaModalPop {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Android 彈窗樣式 */
.pwa-card-android {
    padding: 24px;
    background: #fbfdfc;
    border: 1.5px solid #dcfce7;
}

.pwa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pwa-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pwa-header-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
}
.pwa-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}
.pwa-modal-subhint {
    font-size: 13px;
    color: #64748b;
    margin: 8px 0 16px 0;
}

.pwa-app-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.pwa-app-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.pwa-app-name { font-size: 17px; font-weight: 800; color: #0f172a; }
.pwa-app-slogan { font-size: 12px; color: #475569; margin: 2px 0; }
.pwa-app-domain { font-size: 11.5px; color: #94a3b8; }

.pwa-action-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.btn-pwa-cancel {
    flex: 1;
    padding: 12px;
    border-radius: 25px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    font-weight: 700;
    color: #475569;
    font-size: 15px;
    cursor: pointer;
}
.btn-pwa-install {
    flex: 1.6;
    padding: 12px;
    border-radius: 25px;
    background: #15803d;
    border: none;
    font-weight: 700;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
}

.pwa-bottom-badge {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #15803d;
    font-weight: 600;
}

/* iOS 彈窗細節樣式 */
.pwa-card-ios {
    padding: 16px 20px 24px 20px;
    max-height: 85vh !important;       /* 限制彈窗最高不超過視窗 85% */
    display: flex !important;
    flex-direction: column !important;
}

.ios-modal-drag-bar {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 10px;
    margin: 0 auto 10px auto;
}
.ios-content-scroll {
    flex: 1 !important;
    overflow-y: auto !important;       /* 允許垂直捲動 */
    -webkit-overflow-scrolling: touch !important; /* iOS 絲滑滾動 */
    padding-right: 4px;
    margin-top: 8px;
}
.ios-guide-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 16px;
}
.ios-guide-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.icon-safari { font-size: 26px; color: #0284c7; }
.icon-chrome { font-size: 26px; color: #ea4335; }
.guide-title { font-size: 15px; font-weight: 800; color: #0f172a; }
.guide-sub { font-size: 11px; color: #64748b; }

.ios-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.ios-step-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.step-num-pill {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-num-pill.bg-dark { background: #15803d; }
.step-text {
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    margin: 6px 0 8px 0;
    line-height: 1.25;
}
.step-pic-box {
    width: 100%;
    height: 54px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.point-bubble {
    position: absolute;
    top: -12px;
    background: #6366f1;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 8px;
}
.highlight-share { font-size: 16px; color: #2563eb; }
.mock-item { font-size: 10px; font-weight: bold; color: #0f172a; display: flex; align-items: center; gap: 4px; }
.mock-btn-add { background: #2563eb; color: #fff; font-size: 10px; font-weight: bold; padding: 4px 8px; border-radius: 6px; }
.mock-url-bar { font-size: 10px; color: #64748b; display: flex; align-items: center; gap: 6px; }

}

/* @keyframes 放在最外層全域，不放入 @media 內 */
@keyframes agentSpriteLoop007 {
    0% {
        background-position: 0 0;
    }
    28% {
        background-position: -500px 0;
    }
    33% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 0;
    }
}