/* ============================================================
   LoongTools 在线工具箱样式（前台公开站）
   ============================================================ */
:root {
    --primary: #2f6fed;
    --primary-dark: #1e56c8;
    --bg: #f4f6fa;
    --card: #ffffff;
    --border: #e4e8f0;
    --text: #2b2f36;
    --muted: #7a828e;
    --green: #29a56c;
    --red: #e5533c;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.7 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}
.t-container { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* 头部 */
.t-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.t-header-in { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.t-brand { font-size: 19px; font-weight: 700; color: var(--text); text-decoration: none; }
.t-brand span { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.t-nav a { margin-left: 22px; color: var(--muted); text-decoration: none; font-size: 15px; }
.t-nav a:hover { color: var(--primary); }

.t-main { padding: 26px 18px 46px; min-height: calc(100vh - 130px); }
.t-page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.t-page-head h1 { font-size: 24px; margin: 0; }
.t-back { font-size: 13px; color: var(--muted); text-decoration: none; }
.t-back:hover { color: var(--primary); }

/* 首页 */
.t-hero { background: linear-gradient(135deg, #2f6fed 0%, #6f42f5 100%); color: #fff; border-radius: 14px; padding: 40px 34px; margin-bottom: 30px; }
.t-hero h2 { margin: 0 0 8px; font-size: 26px; }
.t-hero p { margin: 0; opacity: .88; font-size: 15px; }
.t-section-title { font-size: 18px; font-weight: 700; margin: 26px 0 14px; display: flex; align-items: center; gap: 8px; }
.t-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.t-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.t-card {
    display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 16px; text-decoration: none; color: var(--text); transition: all .18s;
}
.t-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(47,111,237,.10); }
.t-card .c-icon { font-size: 26px; line-height: 1; }
.t-card .c-title { font-weight: 700; margin: 10px 0 4px; font-size: 16px; }
.t-card .c-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* 表单与上传 */
.t-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.t-upload {
    border: 2px dashed #c4cddb; border-radius: var(--radius); background: #fafbfd;
    padding: 36px 18px; text-align: center; cursor: pointer; transition: all .18s;
}
.t-upload:hover, .t-upload.dragover { border-color: var(--primary); background: #f2f7ff; }
.t-upload .u-icon { font-size: 34px; }
.t-upload p { margin: 8px 0 0; color: var(--muted); }
.t-upload p b { color: var(--primary); }
.t-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 14px 0; }
.t-label { min-width: 88px; color: var(--muted); font-size: 14px; }
input[type=text], input[type=number], input[type=datetime-local], select, textarea {
    border: 1px solid #d3d9e3; border-radius: 7px; padding: 8px 11px; font-size: 14.5px; color: var(--text);
    background: #fff; outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { width: 100%; min-height: 130px; resize: vertical; }
input[type=range] { accent-color: var(--primary); }
input[type=color] { width: 46px; height: 34px; border: 1px solid #d3d9e3; border-radius: 6px; padding: 2px; background: #fff; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.t-btn {
    display: inline-block; border: 0; cursor: pointer; border-radius: 7px; padding: 9px 20px;
    font-size: 15px; background: var(--primary); color: #fff; text-decoration: none; transition: background .15s;
}
.t-btn:hover { background: var(--primary-dark); }
.t-btn.plain { background: #eef2f8; color: var(--text); }
.t-btn.plain:hover { background: #e2e9f3; }
.t-btn.green { background: var(--green); }
.t-btn:disabled { opacity: .55; cursor: not-allowed; }
.t-tip { color: var(--muted); font-size: 12.5px; }
.t-hidden { display: none !important; }

/* 结果 */
.t-result { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 16px; }
.t-result h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-checker {
    background-image: linear-gradient(45deg, #ececec 25%, transparent 25%),
                      linear-gradient(-45deg, #ececec 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #ececec 75%),
                      linear-gradient(-45deg, transparent 75%, #ececec 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    display: inline-block; padding: 6px; border-radius: 6px; max-width: 100%;
}
.t-checker img { max-width: 100%; }
.t-info { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; max-width: 560px; }
.t-info td { border: 1px solid var(--border); padding: 7px 12px; }
.t-info td:first-child { width: 120px; color: var(--muted); background: #fafbfd; }
.badge { display: inline-block; padding: 2px 12px; border-radius: 20px; font-size: 13.5px; color: #fff; background: var(--green); }
.badge.up { background: var(--red); }
.t-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.t-compare { display: flex; gap: 16px; flex-wrap: wrap; }
.t-compare > div { flex: 1 1 260px; min-width: 240px; }
.t-compare .cp-t { font-weight: 700; margin-bottom: 8px; font-size: 14.5px; }

/* 裁剪 */
.crop-stage { position: relative; display: inline-block; max-width: 100%; user-select: none; }
.crop-stage img { max-width: 100%; display: block; }
.crop-selection { position: absolute; border: 1px dashed var(--primary); background: rgba(47,111,237,.15); display: none; cursor: move; }
.crop-selection .crop-handle { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; cursor: nwse-resize; }
.crop-shade { position: absolute; background: rgba(0,0,0,.45); pointer-events: none; }

/* 九宫格 */
.pos-grid { display: inline-grid; grid-template-columns: repeat(3, 48px); grid-auto-rows: 32px; gap: 3px; }
.pos-grid label { border: 1px solid #d3d9e3; border-radius: 5px; text-align: center; line-height: 30px; cursor: pointer; font-size: 12px; color: var(--muted); }
.pos-grid label.on, .pos-grid label:hover { border-color: var(--primary); color: var(--primary); }
.pos-grid input { display: none; }

/* favicon 网格 */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.fav-grid .fav { border: 1px solid var(--border); border-radius: 8px; padding: 12px 6px; text-align: center; background: #fff; }
.fav-grid .fav img { max-width: 56px; max-height: 56px; }
.fav-grid .fav .f-size { font-size: 12px; color: var(--muted); margin: 6px 0; }

/* 颜色提取 */
.swatches { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.swatch { width: 112px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; }
.swatch .s-c { height: 58px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.swatch .s-m { padding: 6px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
#pick-canvas { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; cursor: crosshair; }

/* base64/hash 输出 */
.t-out { width: 100%; min-height: 96px; font-size: 12.5px; word-break: break-all; background: #fafbfd; }
.hash-line { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.hash-line .h-name { min-width: 70px; color: var(--muted); font-size: 13px; }
.hash-line code { background: #f2f4f8; border-radius: 5px; padding: 5px 9px; font-size: 12.5px; word-break: break-all; flex: 1; }

/* 密码/UUID 列表 */
.gen-list { list-style: none; padding: 0; margin: 10px 0 0; }
.gen-list li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.gen-list code { flex: 1; font-size: 14.5px; word-break: break-all; }
.meter { height: 8px; border-radius: 6px; background: #e8ecf3; overflow: hidden; margin: 8px 0; }
.meter i { display: block; height: 100%; width: 0; background: var(--red); transition: all .2s; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fafbfd; border: 1px solid var(--border); border-radius: 8px; padding: 14px; text-align: center; }
.stat .s-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat .s-name { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* toast */
#t-toast {
    position: fixed; left: 50%; top: 70px; transform: translateX(-50%) translateY(-16px);
    background: rgba(30,34,40,.9); color: #fff; padding: 9px 20px; border-radius: 20px;
    font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}
#t-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.t-footer { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); font-size: 13px; text-align: center; background: #fff; }

@media (max-width: 640px) {
    .t-hero { padding: 26px 20px; }
    .t-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
