:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #2b2d3a;
  --ink-soft: #6b7085;
  --line: #e6e8f0;
  --accent: #ff7eb6;
  --accent-deep: #f45fa0;
  --accent-soft: #fff0f7;
  --ok: #2ecc71;
  --err: #e74c3c;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(43, 45, 58, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
}

/* ============ 侧边栏 ============ */
.sidebar {
  width: clamp(64px, 18vw, 240px);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 14px 14px;
}
.mascot {
  width: clamp(40px, 10vw, 56px);
  height: clamp(40px, 10vw, 56px);
  flex-shrink: 0;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}
.logo-text h1 { font-size: clamp(14px, 2.5vw, 18px); white-space: nowrap; }
.logo-text p { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: clamp(13px, 1.8vw, 15px);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-item .ico { font-size: 18px; }

.sidebar-foot {
  padding: 14px 12px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.6;
  border-top: 1px dashed var(--line);
  text-align: center;
}
.foot-cat {
  width: 100%;
  max-width: clamp(48px, 12vw, 150px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

/* ============ 主区域 ============ */
.main { flex: 1; padding: clamp(16px, 3vw, 32px); min-width: 0; }
.tab-panel { display: none; animation: fadein .25s ease; }
.tab-panel.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-size: 22px; margin-bottom: 18px; }
h3 { font-size: 15px; margin-bottom: 12px; color: var(--ink); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .logo-text, .sidebar-foot p, .nav-item span:not(.ico) { display: none; }
  .nav-item { justify-content: center; }
  .main { padding: 16px; }
}
@media (max-width: 600px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .logo { padding: 4px 8px; }
  .mascot { width: 36px; height: 36px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; padding: 4px; flex: 1; }
  .nav-item { padding: 8px 10px; font-size: 13px; }
  .sidebar-foot { display: none; }
  .float-pet { width: 64px; height: 64px; right: 12px; bottom: 12px; }
  .pet-bubble { right: 80px; bottom: 72px; }
}

/* ============ 右下角浮动宠物 ============ */
.float-pet {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 96px;
  height: 96px;
  z-index: 50;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(244, 95, 160, .25));
  transition: transform .2s;
  animation: pet-bob 3s ease-in-out infinite;
}
.float-pet:hover { transform: scale(1.08); }
.float-pet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--accent-soft);
}
@keyframes pet-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
.pet-bubble {
  position: fixed;
  right: 120px;
  bottom: 96px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink);
  box-shadow: var(--shadow);
  z-index: 51;
  animation: fadein .2s;
  white-space: nowrap;
}

hr { border: none; border-top: 1px dashed var(--line); margin: 16px 0; }

/* ============ 表单元素 ============ */
.row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.row.gap-top { margin-top: 14px; }
label { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }

input[type="text"], input[type="number"], input[type="datetime-local"], select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fafbfd;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
input[type="range"] { accent-color: var(--accent); }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-deep); color: #fff; }
.btn.ghost { background: transparent; }

.linklike { color: var(--accent-deep); cursor: pointer; text-decoration: underline; }

.result-box {
  background: #f2f4fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 20px;
  line-height: 1.6;
}
.result-box.small { margin-top: 8px; font-size: 13px; }
.result-box.ok { border-color: var(--ok); background: #f0fbf4; }
.result-box.err { border-color: var(--err); background: #fdf1f0; color: var(--err); }
.mono { font-family: Consolas, "Courier New", monospace; }

.kv { font-size: 13px; color: var(--ink-soft); line-height: 1.9; }
.vs { color: var(--ink-soft); }
.hint { font-size: 12px; color: var(--ink-soft); }

/* 时钟 */
.clock { font-size: clamp(28px, 5vw, 44px); font-weight: 700; letter-spacing: 2px; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.clock-date { font-size: clamp(12px, 1.8vw, 14px); color: var(--ink-soft); margin-top: 4px; }

/* 加密区 */
.enc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.enc-hash { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* 正则 */
.flags { display: flex; gap: 10px; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.rx-hit { background: #ffe3ef; border-bottom: 2px solid var(--accent); border-radius: 3px; padding: 0 1px; }
.rx-group { background: #e3f6ff; border-bottom: 2px solid #38bdf8; border-radius: 3px; }

/* 图片处理 */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px);
  text-align: center;
  color: var(--ink-soft);
  transition: all .2s;
  cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.img-workspace { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.img-preview-wrap { flex: 1; min-width: min(280px, 100%); }
#imgCanvas {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
}
.img-meta { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.img-controls { width: min(260px, 100%); flex-shrink: 0; }
