/* ===== Tool Cards (Index) ===== */
.tool-category-title {
    font-size: 1.1rem; font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid transparent;
    display: inline-block;
    background-image: linear-gradient(var(--primary), var(--primary));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    animation: titleUnderline .5s ease-out .15s forwards;
}
@keyframes titleUnderline {
    to { background-size: 100% 2px; }
}
.tool-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px; padding: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 1rem;
    transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow .3s ease, border-color .3s ease;
    border: 1px solid var(--border-color);
    height: 100%;
    position: relative;
    z-index: 1;
}

.tool-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 13px;
    padding: 1.5px;
    background: var(--card-gradient, linear-gradient(135deg, var(--primary), var(--secondary)));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: -1;
}

.tool-card:has(.icon-backend) { --card-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%); --card-shadow: rgba(102, 126, 234, 0.25); }
.tool-card:has(.icon-frontend) { --card-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%); --card-shadow: rgba(250, 112, 154, 0.25); }
.tool-card:has(.icon-encode) { --card-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); --card-shadow: rgba(79, 172, 254, 0.25); }
.tool-card:has(.icon-crypto) { --card-gradient: linear-gradient(135deg, #09203f 0%, #537895 100%); --card-shadow: rgba(9, 32, 63, 0.25); }
.tool-card:has(.icon-text) { --card-gradient: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); --card-shadow: rgba(224, 195, 252, 0.25); }
.tool-card:has(.icon-image) { --card-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%); --card-shadow: rgba(246, 211, 101, 0.25); }
.tool-card:has(.icon-network) { --card-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); --card-shadow: rgba(67, 233, 123, 0.25); }
.tool-card:has(.icon-daily) { --card-gradient: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%); --card-shadow: rgba(255, 117, 140, 0.25); }
.tool-card:has(.icon-questionnaire) { --card-gradient: linear-gradient(135deg, #5b86e5 0%, #36d1dc 100%); --card-shadow: rgba(54, 209, 220, 0.24); }
.tool-card:has(.icon-game) { --card-gradient: linear-gradient(135deg, #b224ef 0%, #7579ff 100%); --card-shadow: rgba(178, 36, 239, 0.25); }

.tool-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 30px var(--card-shadow, var(--shadow-hover));
    border-color: transparent;
    color: var(--text-primary);
}
.tool-card:hover::after { opacity: 1; }
.tool-card:active {
    transform: translateY(-1px) scale(.98);
    transition-duration: .1s;
}
.tool-card .tool-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff; flex-shrink: 0;
    transition: transform .25s ease;
}
.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(-3deg);
}

.tool-card-wrapper {
    opacity: 0;
    animation: cardFadeIn .4s ease-out forwards;
}
.tool-card-wrapper:nth-child(1)  { animation-delay: .04s; }
.tool-card-wrapper:nth-child(2)  { animation-delay: .08s; }
.tool-card-wrapper:nth-child(3)  { animation-delay: .12s; }
.tool-card-wrapper:nth-child(4)  { animation-delay: .16s; }
.tool-card-wrapper:nth-child(5)  { animation-delay: .20s; }
.tool-card-wrapper:nth-child(6)  { animation-delay: .24s; }
.tool-card-wrapper:nth-child(7)  { animation-delay: .28s; }
.tool-card-wrapper:nth-child(8)  { animation-delay: .32s; }
.tool-card-wrapper:nth-child(n+9){ animation-delay: .35s; }
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tool-card .tool-info {
    min-width: 0;
    overflow: hidden;
}
.tool-card .tool-info h6 { margin: 0; font-weight: 600; font-size: .9rem; }
.tool-card .tool-info p {
    margin: 0; font-size: .78rem; color: var(--text-muted); line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tool-usage-badge {
    display: inline-block; font-size: .68rem; color: var(--text-muted);
    background: var(--bg-result); padding: 1px 8px; border-radius: 10px;
    margin-top: 4px; white-space: nowrap;
}

.icon-backend { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.icon-frontend { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.icon-encode { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.icon-crypto { background: linear-gradient(135deg, #09203f 0%, #537895 100%); }
.icon-text { background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); }
.icon-image { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
.icon-network { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.icon-daily { background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%); }
.icon-questionnaire { background: linear-gradient(135deg, #5b86e5 0%, #36d1dc 100%); }
.icon-game { background: linear-gradient(135deg, #b224ef 0%, #7579ff 100%); }

/* ===== Tool Page ===== */
.tool-header {
    margin-bottom: 1rem;
    position: relative;
    z-index: 120;
}
.tool-header h4 {
    font-weight: 700; color: var(--dark);
    font-size: 1.15rem;
    margin-bottom: .25rem;
    display: flex; align-items: center; gap: .5rem;
}
.tool-help-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 121;
}
.tool-help-btn {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1.5px solid #adb5bd;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: .72rem; font-weight: 700;
    font-style: italic; font-family: Georgia, serif;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: help; transition: all .2s;
    flex-shrink: 0; line-height: 1; padding: 0;
    position: relative;
    z-index: 122;
}
.tool-help-btn:hover { border-color: var(--primary); color: #fff; background: var(--primary); }
.tool-help-box {
    display: none; position: absolute;
    top: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    width: 420px; max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-size: .85rem;
    color: var(--text-primary);
    line-height: 1.7;
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
    z-index: 130;
    animation: helpFadeIn .15s ease;
}
.tool-help-box::before {
    content: ''; position: absolute;
    top: -7px; left: 50%; transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--border-color);
}
.tool-help-box::after {
    content: ''; position: absolute;
    top: -6px; left: 50%; transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--bg-card);
}
.tool-help-wrap:hover .tool-help-box { display: block; }
.tool-help-box h6 { font-weight: 700; color: var(--primary); margin-bottom: .5rem; font-size: .88rem; }
.tool-help-box ol, .tool-help-box ul { margin-bottom: .25rem; padding-left: 1.25rem; }
.tool-help-box li { margin-bottom: .2rem; }
.tool-help-box code { background: var(--bg-result); padding: 1px 5px; border-radius: 3px; font-size: .82rem; color: var(--text-primary); }
@media (max-width: 575.98px) {
    .tool-help-box { width: 280px; left: 0; transform: none; }
    .tool-help-box::before, .tool-help-box::after { left: 16px; transform: none; }
}
@keyframes helpFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.tool-header p { color: var(--text-muted); font-size: .88rem; margin: 0; }

/* ===== Standardized Text Sizing ===== */
.tool-panel h5 { font-size: 1rem; font-weight: 700; }
.tool-panel h6 { font-size: .88rem; font-weight: 700; }
.tool-panel .form-label { font-weight: 600; font-size: .85rem; color: var(--text-secondary); }
.tool-panel .form-control { font-size: .88rem; }
.tool-panel .form-select { font-size: .88rem; }
.tool-panel .btn { font-size: .85rem; }
.tool-panel .text-muted, .tool-panel .form-text { font-size: .8rem; }
.tool-panel .badge { font-size: .72rem; }

.tool-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px; padding: 1rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    transition: background .3s, border-color .3s;
    animation: panelSlideIn .35s ease-out;
}
@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tool-panel textarea.form-control {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: .85rem; resize: vertical;
    overflow-y: auto;
    transition: height .15s ease;
}
.tool-panel textarea.form-control.auto-grow {
    overflow-y: hidden;
}

/* ===== Buttons ===== */
.btn-primary { background: var(--primary); border-color: var(--primary); transition: transform .15s cubic-bezier(0.4, 0, 0.2, 1), background .15s, box-shadow .15s; position: relative; overflow: hidden; }
.btn-primary:hover { background: #3a56d4; border-color: #3a56d4; box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3); }
.btn-primary:active { transform: scale(0.96); box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.2); }
.btn-primary::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg); transition: none; z-index: 1; pointer-events: none;
}
.btn-primary:hover::after {
    animation: btnShine 0.8s ease-out forwards;
}
@keyframes btnShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

.btn-outline-secondary { border-color: rgba(0,0,0,.2); color: var(--text-secondary); transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-secondary:hover { border-color: #6c757d; background: rgba(108,117,125,0.05); color: var(--text-primary); }
.btn-outline-secondary:active { transform: scale(0.96); }

.btn-outline-primary { border-color: rgba(13,110,253,.4); color: #0d6efd; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-primary:hover { background: rgba(13,110,253,0.05); color: #0a58ca; }
.btn-outline-primary:active { transform: scale(0.96); }

.btn-outline-success { border-color: rgba(25,135,84,.4); color: #198754; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-success:hover { background: rgba(25,135,84,0.05); color: #146c43; }
.btn-outline-success:active { transform: scale(0.96); }

.btn-outline-danger { border-color: rgba(220,53,69,.4); color: #dc3545; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-danger:hover { background: rgba(220,53,69,0.05); color: #b02a37; }
.btn-outline-danger:active { transform: scale(0.96); }

.btn-outline-warning { border-color: rgba(255,193,7,.5); color: #ffc107; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-warning:hover { background: rgba(255,193,7,0.05); color: #cc9a06; }
.btn-outline-warning:active { transform: scale(0.96); }
#btnFavTool { white-space: nowrap; }

.btn-outline-info { border-color: rgba(13,202,240,.4); color: #0dcaf0; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-outline-info:hover { background: rgba(13,202,240,0.05); color: #0aacce; }
.btn-outline-info:active { transform: scale(0.96); }

.btn-light { background: #f8f9fa; border-color: #f8f9fa; color: #212529; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-light:hover { background: #e2e6ea; border-color: #dae0e5; color: #212529; }
.btn-light:active { transform: scale(0.96); }

.btn-tool {
    border-radius: 8px; font-weight: 600;
    font-size: .85rem; padding: .4rem 1rem;
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-tool:active { transform: scale(.96); }

/* ===== Result Area & Copy ===== */
.result-area {
    background: var(--bg-result);
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: .75rem;
    min-height: 60px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .85rem; white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
    transition: background .3s, border-color .3s;
}
.copy-btn {
    position: absolute; top: 8px; right: 8px;
    font-size: .75rem; line-height: 1;
    transition: transform .15s ease;
    z-index: 10;
}
.copy-btn:active { transform: scale(.85); }

/* ===== Upload Drop Zone ===== */
.upload-drop-zone { 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    border: 2px dashed rgba(67, 97, 238, 0.3);
    background: rgba(67, 97, 238, 0.02);
    position: relative;
    overflow: hidden;
}
.upload-drop-zone:not(.has-file) {
    animation: dropZoneBreath 3s ease-in-out infinite alternate;
}
@keyframes dropZoneBreath {
    0% { border-color: rgba(67, 97, 238, 0.2); background: rgba(67, 97, 238, 0.01); }
    100% { border-color: rgba(67, 97, 238, 0.5); background: rgba(67, 97, 238, 0.04); }
}
.upload-drop-zone:hover, .upload-drop-zone.dragover { 
    background: rgba(67, 97, 238, 0.08); 
    border-color: var(--primary);
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.1);
}
.upload-drop-zone.dragover {
    animation: none;
    border-style: solid;
}

/* ===== Calculator ===== */
.calculator-wrapper { font-family: "SF Mono", "Consolas", monospace; }
.calculator-display {
    font-size: 1.25rem; min-height: 2.5rem;
    background: var(--bg-result);
    color: var(--text-primary);
}
.calculator-keys .calc-btn {
    min-height: 40px; font-weight: 600; border-radius: 8px;
}

/* ===== Diff Tool ===== */
.diff-textarea { font-family: "SFMono-Regular", Consolas, monospace; font-size: .85rem; }
.diff-stats-bar { display: flex; gap: .75rem; flex-wrap: wrap; padding: .35rem 0; font-size: .85rem; }
.diff-stat { padding: .2rem .4rem; border-radius: 5px; }
.diff-added { background: rgba(6, 214, 160, .2); color: #0d6b4a; }
.diff-removed { background: rgba(239, 71, 111, .2); color: #b91c3c; }
.diff-modified { background: rgba(255, 209, 102, .3); color: #996600; }
html[data-theme="dark"] .diff-added { background: rgba(6,214,160,.15); color: #5eead4; }
html[data-theme="dark"] .diff-removed { background: rgba(239,71,111,.15); color: #fca5a5; }
html[data-theme="dark"] .diff-modified { background: rgba(255,209,102,.15); color: #fde047; }
.diff-result-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px; overflow: auto;
    max-height: 500px; background: var(--bg-card);
}
.diff-result { font-family: "SFMono-Regular", Consolas, monospace; font-size: .85rem; }
.diff-line { display: flex; min-height: 1.5em; line-height: 1.5; }
.diff-line-num {
    min-width: 3em; padding: 0 .5em;
    text-align: right; color: var(--text-muted);
    user-select: none; flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}
.diff-line-content { flex: 1; padding: 0 .5em; white-space: pre; overflow-x: auto; }
.diff-line.same .diff-line-content { background: var(--bg-card); }
.diff-line.added .diff-line-content { background: rgba(6, 214, 160, .25); }
.diff-line.removed .diff-line-content { background: rgba(239, 71, 111, .2); }
.diff-line.added .diff-line-num { background: rgba(6, 214, 160, .15); }
.diff-line.removed .diff-line-num { background: rgba(239, 71, 111, .15); }

/* ===== Code Editor (HTML Preview) ===== */
.code-editor-wrap {
    position: relative; height: 400px;
    border: 1px solid var(--code-border);
    border-radius: .375rem; overflow: hidden;
    background: var(--code-bg);
    transition: background .3s, border-color .3s;
}
.code-editor-wrap .code-highlight,
.code-editor-wrap .code-input {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: .84rem; line-height: 1.6;
    padding: 10px 10px 10px 42px;
    margin: 0; border: none; outline: none; resize: none;
    white-space: pre; overflow: auto;
    tab-size: 2; -moz-tab-size: 2;
    word-wrap: normal;
}
.code-editor-wrap .code-highlight {
    pointer-events: none; z-index: 1;
    color: var(--code-text); background: transparent;
}
.code-editor-wrap .code-input {
    z-index: 2; color: transparent; background: transparent;
    caret-color: var(--code-caret);
    -webkit-text-fill-color: transparent;
}
.code-editor-wrap .code-input::selection { background: var(--code-selection); }
.code-editor-wrap .code-input::-moz-selection { background: var(--code-selection); }
.code-editor-wrap .code-input::placeholder { -webkit-text-fill-color: var(--text-muted); }
.code-editor-wrap .line-numbers {
    position: absolute; top: 0; left: 0; width: 36px; bottom: 0;
    background: var(--code-linenr-bg);
    border-right: 1px solid var(--code-linenr-border);
    z-index: 3; overflow: hidden;
    padding: 10px 6px 10px 0;
    text-align: right;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: .84rem; line-height: 1.6;
    color: var(--code-linenr-text); user-select: none;
    transition: background .3s, border-color .3s;
}

.hl-tag { color: var(--code-tag); }
.hl-attr { color: var(--code-attr); }
.hl-val { color: var(--code-val); }
.hl-text { color: var(--code-text); }
.hl-comment { color: var(--code-comment); font-style: italic; }
.hl-entity { color: var(--code-entity); }
.hl-doctype { color: var(--code-tag); }
.hl-eq { color: var(--code-text); }
.hl-bracket { color: var(--code-bracket); }

.html-toolbar {
    display: flex; flex-wrap: wrap;
    border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-result); overflow: hidden; margin-bottom: 10px;
}
.toolbar-row {
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
    padding: 5px 10px; flex: 1 0 46%;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
}
.toolbar-row .btn { font-size: .78rem; padding: 2px 8px; position: relative; }
.toolbar-group-label {
    font-size: .7rem; color: var(--text-muted); font-weight: 600;
    white-space: nowrap; padding: 0 4px 0 0; min-width: 32px;
}

/* ===== Modern Tooltip ===== */
.tooltip {
    --bs-tooltip-bg: rgba(30, 41, 59, 0.9);
    --bs-tooltip-color: #fff;
    --bs-tooltip-padding-x: 0.75rem;
    --bs-tooltip-padding-y: 0.4rem;
    --bs-tooltip-border-radius: 8px;
    --bs-tooltip-opacity: 1;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
/* 勿在 .tooltip 上动画 transform：Bootstrap/Popper 用 transform 做 translate3d 定位，动画会覆盖导致气泡贴到视口左上角 */
.tooltip.show {
    animation: tooltipFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.tooltip.show .tooltip-inner {
    animation: tooltipInnerFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes tooltipFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes tooltipInnerFadeIn {
    from { opacity: 0.85; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* ===== Tag Tooltip (shared) ===== */
.tag-tooltip {
    position: fixed; z-index: 9999; width: 280px;
    background: var(--bg-card, #fff); border: 1px solid var(--border-color, #dee2e6);
    border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
    padding: 14px 16px; pointer-events: auto;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s, visibility .18s, transform .18s;
}
.tag-tooltip.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.tag-tooltip-header { font-size: .92rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.4; }
.tt-tag-code {
    display: inline-block; background: #e8f0fe; color: #1a56db;
    font-family: "SFMono-Regular", Consolas, monospace; font-size: .78rem; font-weight: 600;
    padding: 1px 7px; border-radius: 4px; vertical-align: middle; margin-right: 2px;
}
.tag-tooltip-desc { font-size: .8rem; color: var(--text-muted, #6c757d); line-height: 1.55; margin-bottom: 0; }
.tag-tooltip-divider { height: 1px; background: var(--border-color, #e9ecef); margin: 10px 0; }
.tag-tooltip-preview-label { font-size: .7rem; font-weight: 600; color: var(--text-muted, #999); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.tag-tooltip-preview {
    background: var(--bg-result, #f8f9fa); border: 1px solid var(--border-color, #e9ecef);
    border-radius: 6px; padding: 10px 12px; font-size: .84rem; line-height: 1.5;
    overflow: hidden; max-height: 120px; color: var(--text-primary);
}

.html-preview-frame {
    border: 1px solid var(--border-color);
    border-radius: .375rem; padding: 12px;
    min-height: 400px; max-height: 400px;
    overflow-y: auto; background: var(--bg-card);
    color: var(--text-primary);
    transition: background .3s, border-color .3s;
}
.html-preview-frame.plain-mode {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: .85rem; white-space: pre-wrap;
}

/* ===== Generic Drop Zone ===== */
.drop-zone {
    border: 2px dashed rgba(67, 97, 238, 0.3);
    border-radius: 12px;
    text-align: center;
    padding: 1.5rem .75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(67, 97, 238, 0.02);
    position: relative;
    overflow: hidden;
}
.drop-zone:not(.has-file) {
    animation: dropZoneBreath 3s ease-in-out infinite alternate;
}
.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.08);
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.1);
}
.drop-zone-active, .drop-zone.drop-zone-active {
    border-color: var(--primary) !important;
    background: rgba(67, 97, 238, 0.12) !important;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
    transform: scale(1.02);
    animation: none !important;
    border-style: solid;
}
.drop-zone-icon {
    font-size: 2rem;
    color: #adb5bd;
    display: block;
    margin-bottom: .5rem;
    transition: color .2s, transform .2s;
}
.drop-zone:hover .drop-zone-icon,
.drop-zone-active .drop-zone-icon {
    color: var(--primary);
    transform: translateY(-4px) scale(1.1);
}
.drop-zone-text {
    font-size: .9rem;
    color: #6c757d;
    font-weight: 500;
}
.drop-zone-hint {
    font-size: .78rem;
    color: #adb5bd;
    margin-top: .25rem;
}
.drop-zone-preview {
    margin-top: .75rem;
    font-size: .82rem;
    color: var(--bs-success, #198754);
    font-weight: 500;
}

/* ===== Game Score Box ===== */
.game-score-box {
    background: var(--bg-result);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 18px;
    text-align: center;
    min-width: 80px;
}
.game-score-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.game-score-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Password field masking */
.wj-pw-field { -webkit-text-security: disc; text-security: disc; }
.wj-pw-field.pw-visible { -webkit-text-security: none; text-security: none; }

/* ===== Responsive (Components) ===== */
@media (max-width: 991.98px) {
    .tool-panel { padding: 1rem; border-radius: 10px; }
    .tool-header h4 { font-size: 1.1rem; }
    .tool-header p { font-size: .82rem; }
    .tool-card { padding: 1rem; gap: .75rem; }
    .tool-card .tool-icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 10px; }
    .tool-card .tool-info h6 { font-size: .85rem; }
    .tool-card .tool-info p { font-size: .72rem; }
    .result-area { padding: .75rem; }
    .diff-stats-bar { gap: .5rem; font-size: .82rem; }
    .tool-panel textarea.form-control { font-size: .8rem; }
}

@media (max-width: 575.98px) {
    .tool-panel { padding: .75rem; }
    .tool-category-title { font-size: .95rem; }
    #btnFavTool {
        padding: 4px 8px !important;
        min-width: 36px;
        justify-content: center;
        gap: 0 !important;
    }
    #btnFavTool .fav-btn-label {
        display: none;
    }
    .tool-card { gap: .6rem; }
    .tool-card .tool-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
    .tool-help-box { width: 280px; left: 0; transform: none; }
    .tool-help-box::before, .tool-help-box::after { left: 16px; transform: none; }
}
