/* =========================================================
   HOONG 在线工具 —— 界面样式
   颜色、圆角、间距统一在 :root 里，改一处全站生效
   ========================================================= */

:root {
  --ink:        #0e1b2c;   /* 正文墨色 */
  --ink-2:      #3f5166;   /* 次级文字 */
  --ink-3:      #7b8ca3;   /* 辅助文字 */
  --ink-4:      #a9b6c8;   /* 最弱提示 */

  --line:       #e6ecf5;   /* 分割线 */
  --line-soft:  #eef2f8;

  --bg:         #f5f8fd;   /* 页面底色 */
  --surface:    #ffffff;   /* 卡片 / 面板 */

  --brand:      #2563eb;
  --brand-ink:  #1d4ed8;
  --brand-soft: #eef4ff;

  --radius:     12px;
  --shadow-sm:  0 1px 2px rgba(14, 27, 44, .04);
  --shadow-md:  0 10px 26px rgba(23, 60, 120, .10);
  --shadow-lg:  0 16px 40px rgba(14, 27, 44, .14);

  --header-h:   66px;
  --sidebar-w:  232px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===================== 顶栏 ===================== */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--header-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand__logo { display: block; height: 25px; width: auto; }

.brand__sub {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .06em;
  color: #243b53;
  white-space: nowrap;
}

.nav { display: flex; align-items: center; gap: 2px; min-width: 0; }

.nav__item {
  position: relative;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.nav__item:hover { background: #f3f6fb; color: var(--ink); }

.nav__item.is-active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

/* ---- 搜索框 ---- */

.search { position: relative; margin-left: auto; width: 252px; flex: 0 0 auto; }

.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 64px 0 35px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f8fd;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.search input::placeholder { color: var(--ink-4); }

.search input:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.search__kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-4);
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: .02em;
  pointer-events: none;
}

.search__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 324px;
  max-height: 342px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.search__group {
  padding: 8px 10px 4px;
  color: var(--ink-4);
  font-size: 11px;
  letter-spacing: .12em;
}

.search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.search__item:hover { background: var(--brand-soft); color: var(--brand-ink); }

.search__item svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--brand); }

.search__empty {
  padding: 22px 12px;
  color: var(--ink-4);
  font-size: 13px;
  text-align: center;
}

/* ===================== 主体布局 ===================== */

.layout { flex: 1 1 auto; display: flex; min-height: 0; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 4px 10px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar__top { display: none; }

.sidebar__head {
  padding: 18px 10px 10px;
  color: var(--ink-4);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .16em;
}

.sidebar__list { display: flex; flex-direction: column; gap: 2px; }

.sidebar__item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.8px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.sidebar__item:hover { background: #f4f7fc; color: #16283c; }

.sidebar__item.is-active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

.sidebar__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--brand);
  transform: translateY(-50%);
}

.sidebar__empty { padding: 12px; color: var(--ink-4); font-size: 13px; }

.sidebar__foot {
  margin-top: auto;
  padding: 14px 10px 0;
  color: #b6c2d3;
  font-size: 11px;
  letter-spacing: .04em;
}

.backdrop { display: none; }

.content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  background:
    radial-gradient(1100px 520px at 85% -12%, #e9f1ff 0%, rgba(233, 241, 255, 0) 62%),
    var(--bg);
}

.content__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 30px 32px 56px;
}

.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: #d7e1ef;
  background-clip: content-box;
}

/* ===================== 首页 ===================== */

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 36px 30px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0f2a5c 0%, #1d4ed8 58%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 14px 34px rgba(29, 78, 216, .22);
}

.hero > * { position: relative; z-index: 1; }

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%);
}

.hero::before {
  content: "";
  position: absolute;
  right: 90px;
  bottom: -140px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
}

.hero__eyebrow {
  margin: 0 0 12px;
  color: #bcd2ff;
  font-size: 12px;
  letter-spacing: .2em;
}

.hero__title {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.28;
}

.hero__desc {
  max-width: 540px;
  margin: 0;
  color: #d7e3ff;
  font-size: 14.5px;
  line-height: 1.75;
}

.hero__meta {
  display: inline-block;
  margin: 22px 0 0;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #c9d9ff;
  font-size: 12px;
  letter-spacing: .04em;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 32px 2px 14px;
}

.section-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.section-head span { color: var(--ink-4); font-size: 12.5px; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border: 1px solid #e8eef7;
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #c7d8f7;
  box-shadow: var(--shadow-md);
}

.tool-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-card__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}

.tool-card__icon svg { width: 21px; height: 21px; }

.tool-card__tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f5f8fd;
  color: var(--ink-4);
  font-size: 11px;
  letter-spacing: .02em;
}

.tool-card__name { margin: 2px 0 0; font-size: 14.5px; font-weight: 600; }

.tool-card__desc {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.65;
}

.page-foot {
  margin: 26px 2px 0;
  color: var(--ink-4);
  font-size: 12px;
}

/* ===================== 分类页 ===================== */

.crumb { margin: 0 0 16px; color: var(--ink-4); font-size: 12.5px; }
.crumb a { color: var(--ink-4); text-decoration: none; }
.crumb a:hover { color: var(--brand); }

.page-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.page-sub { margin: 0; color: var(--ink-3); font-size: 13px; }

/* ===================== 工具页 ===================== */

.tool-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.tool-head__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}

.tool-head__icon svg { width: 23px; height: 23px; }

.tool-head__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-head__text h1 { margin: 0; font-size: 23px; font-weight: 700; }
.tool-head__text p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }

.badge {
  padding: 4px 10px;
  border: 1px solid #fde3c0;
  border-radius: 999px;
  background: #fff7ed;
  color: #b45309;
  font-size: 11.5px;
  white-space: nowrap;
}

.placeholder {
  padding: 54px 24px;
  border: 1.5px dashed #d8e1ee;
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.placeholder__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #f4f7fc;
  color: var(--ink-4);
}

.placeholder__icon svg { width: 26px; height: 26px; }

.placeholder h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }

.placeholder p {
  max-width: 430px;
  margin: 0 auto;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.8;
}

.placeholder__link {
  display: inline-block;
  margin-top: 20px;
  color: var(--brand);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px dashed #bfd3f9;
  padding-bottom: 1px;
}

/* ===================== 工具：通用面板 ===================== */

.panel {
  margin-bottom: 14px;
  padding: 20px 22px;
  border: 1px solid #e8eef7;
  border-radius: 14px;
  background: var(--surface);
}

.panel:last-of-type { margin-bottom: 0; }

.panel--clock {
  background: linear-gradient(135deg, #f7faff 0%, #ffffff 62%);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel__title { font-size: 14.5px; font-weight: 600; color: var(--ink); }

.panel__hint { margin-top: 3px; color: var(--ink-4); font-size: 12px; }

.clock {
  color: #0f2a5c;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.clock__date { margin-top: 6px; color: var(--ink-3); font-size: 12.5px; }

.ts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.ts-box {
  padding: 12px 14px;
  border: 1px solid #e8eef7;
  border-radius: 11px;
  background: var(--surface);
}

.ts-box__label { color: var(--ink-4); font-size: 11.5px; letter-spacing: .04em; }

.ts-box__value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.ts-box__num {
  min-width: 0;
  overflow: hidden;
  color: var(--brand-ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field input {
  flex: 1 1 260px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.field input:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover { border-color: #c7d8f7; background: #f8fbff; color: var(--brand-ink); }

.btn--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  border-color: var(--brand-ink);
  background: var(--brand-ink);
  color: #fff;
}

.btn.is-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.btn--switch {
  border-color: #dbe7fb;
  background: #f5f9ff;
  color: var(--brand-ink);
  font-weight: 600;
}

.btn--switch:hover {
  border-color: #bfd3f9;
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.result {
  display: none;
  margin-top: 14px;
  padding: 4px 14px;
  border: 1px solid #e8eef7;
  border-radius: 11px;
  background: #f9fbff;
}

.result.show { display: block; }

.result__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #e9eff9;
  font-size: 13px;
}

.result__row:last-child { border-bottom: 0; }

.result__key { flex: 0 0 72px; color: var(--ink-4); font-size: 12px; }

.result__val {
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.result__row .btn { height: 30px; margin-left: auto; }

.hint-error { margin-top: 10px; color: #c2410c; font-size: 12.5px; }

.badge--done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

/* ===================== 工具：单位转换 ===================== */

.unit-layout { display: flex; align-items: flex-start; gap: 18px; }

.unit-nav {
  flex: 0 0 148px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border: 1px solid #e8eef7;
  border-radius: 14px;
  background: var(--surface);
}

.unit-nav__group {
  padding: 10px 10px 4px;
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
}

.unit-nav__group:first-child { padding-top: 4px; }

.unit-nav__item {
  position: relative;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.unit-nav__item:hover { background: #f4f7fc; color: var(--ink); }

.unit-nav__item.is-active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

.unit-nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand);
  transform: translateY(-50%);
}

.unit-body { flex: 1 1 auto; min-width: 0; }

.unit-row { display: flex; align-items: center; gap: 10px; }

.unit-input,
.unit-select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.unit-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 14px;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 18px;
  font-weight: 600;
}

.unit-input:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.unit-select {
  flex: 0 0 168px;
  padding: 0 10px;
  font-size: 13.5px;
  cursor: pointer;
}

.unit-eq { margin: 10px 0 10px 2px; color: #b6c2d3; font-size: 13px; }

.unit-output {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px dashed #c7d8f7;
  border-radius: 10px;
  background: #f5f9ff;
  color: var(--brand-ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-note { margin-top: 12px; color: var(--ink-4); font-size: 12px; }

.unit-list { display: flex; flex-direction: column; }

.unit-list__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.unit-list__row:nth-child(odd) { background: #f9fbff; }

.unit-list__row.is-target {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

.unit-list__val {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.unit-list__empty {
  padding: 18px 10px;
  color: var(--ink-4);
  font-size: 13px;
  text-align: center;
}

/* ===================== 工具：字符串转义 ===================== */

.esc-mode {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7faff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.esc-mode:focus {
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.esc-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 14px;
}

.esc-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
}

.esc-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.esc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.esc-col { display: flex; flex-direction: column; min-width: 0; }

.esc-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 6px;
}

.esc-col__title { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.esc-col__meta { color: var(--ink-4); font-size: 11.5px; }

.esc-col textarea {
  height: 240px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbff;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.esc-col textarea:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.esc-col textarea[readonly] { background: #f2f6fd; }

.esc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.esc-tip { margin-left: auto; color: var(--ink-4); font-size: 12px; }

/* ===================== 工具：字符串 / 进制 ===================== */

.rx-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

.rx-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
}

.rx-options .esc-check.is-off { opacity: .45; }

.rx-label { color: var(--ink-3); font-size: 12.5px; }

.rx-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7faff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.rx-select:focus {
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.rx-field { display: flex; flex-direction: column; }

.rx-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 6px;
}

.rx-field__title { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }

.rx-textarea {
  width: 100%;
  height: 92px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbff;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.rx-textarea:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.rx-textarea[readonly] { background: #f2f6fd; }

.rx-actions { display: flex; justify-content: center; margin: 16px 0; }

.rx-actions .btn { height: 40px; padding: 0 30px; font-size: 13.5px; }

/* ===================== 提示弹窗 ===================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal__backdrop { position: absolute; inset: 0; background: rgba(10, 22, 40, .42); }

.modal__box {
  position: relative;
  width: min(400px, 92vw);
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(10, 22, 40, .3);
  animation: modal-in .18s ease-out;
}

.modal__title { color: var(--ink); font-size: 15px; font-weight: 700; }

.modal__msg {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.75;
  word-break: break-all;
}

.modal__foot { display: flex; justify-content: flex-end; margin-top: 20px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ===================== 工具简介 ===================== */

.intro {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid #e8eef7;
  border-radius: 14px;
  background: var(--surface);
}

.intro__title {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
}

.intro__text {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.85;
}

.intro__list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-3);
  font-size: 12.8px;
  line-height: 1.9;
}

.intro__list li { margin-top: 3px; }

/* ===================== 工具：人民币大写 ===================== */

.rmb-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faff;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 22px;
  font-weight: 600;
  outline: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.rmb-input:focus {
  background: var(--surface);
  border-color: #bfd3f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.rmb-result {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid #e8eef7;
  border-radius: 12px;
  background: #f7faff;
}

.rmb-result__head { display: flex; align-items: center; gap: 10px; }

.rmb-result__label { color: var(--ink-3); font-size: 12.5px; }

.rmb-result__num {
  color: var(--ink-4);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12.5px;
}

.rmb-result__head .btn { height: 30px; margin-left: auto; }

.rmb-result__text {
  margin-top: 8px;
  color: var(--brand-ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
  word-break: break-all;
}

/* ===================== 工具：计算器 ===================== */

.calc__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.calc__angle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.calc__ang {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
}

.calc__ang.is-on {
  background: var(--surface);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(14, 27, 44, .08);
}

.calc__display {
  padding: 14px 16px;
  border: 1px solid #e8eef7;
  border-radius: 12px;
  background: #f7faff;
  text-align: right;
}

.calc__expr {
  min-height: 20px;
  color: var(--ink-4);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12.5px;
  word-break: break-all;
}

.calc__expr.is-error { color: #c2410c; }

.calc__value {
  margin-top: 2px;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-all;
}

.calc__keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.calc__key {
  height: 48px;
  border: 1px solid #e8eef7;
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .05s ease;
}

.calc__key:hover { background: #f7faff; border-color: #d6e2f5; }
.calc__key:active { transform: scale(.97); }

.calc__key--op {
  background: #f2f7ff;
  color: var(--brand-ink);
  font-weight: 600;
}

.calc__key--op:hover { background: #e9f1ff; }

.calc__key--util { background: #f8fafc; color: var(--ink-2); }

.calc__key--fn { background: #f7f9fc; color: var(--ink-2); font-size: 14px; }
.calc__key--fn:hover { background: #eef3fa; }

.calc__key--eq {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.calc__key--eq:hover { background: var(--brand-ink); border-color: var(--brand-ink); }

/* ===================== 工具：ASCII 码对照表 ===================== */

.ascii-hit {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid #dbe7fb;
  border-radius: 12px;
  background: #f5f9ff;
}

.ascii-hit__char {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid #dbe7fb;
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
}

.ascii-hit__info { flex: 1 1 auto; min-width: 0; }

.ascii-hit__name { color: var(--ink); font-size: 13.5px; font-weight: 600; }

.ascii-hit__nums { margin-top: 3px; color: var(--ink-3); font-size: 12px; }

.ascii-hit__nums b {
  color: var(--brand-ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-weight: 600;
}

.ascii-hit__nums i { margin: 0 6px; color: #c8d3e3; font-style: normal; }

.ascii-hit .btn { flex: 0 0 auto; height: 30px; margin-left: auto; }

.ascii-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid #e8eef7;
  border-radius: 12px;
  background: var(--surface);
}

.ascii-table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.ascii-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  background: #f7faff;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.ascii-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5fb;
  white-space: nowrap;
}

.ascii-table tbody tr:hover { background: #f9fbff; cursor: pointer; }
.ascii-table tbody tr.is-hit { background: var(--brand-soft); }
.ascii-table tbody tr.is-hit td { color: var(--brand-ink); }

.hide-ctrl .ascii-table tbody tr[data-ctrl] { display: none; }

.ascii-char {
  display: inline-block;
  min-width: 26px;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 15px;
  font-weight: 600;
}

.ascii-abbr {
  display: inline-block;
  min-width: 44px;
  color: var(--ink-2);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12.5px;
  font-weight: 600;
}

.ascii-cn { color: var(--ink-4); font-size: 11.5px; }

.ascii-hex,
.ascii-dec,
.ascii-bin {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  color: var(--ink-2);
}

.ascii-hex { color: var(--brand-ink); }

.ascii-bin { color: var(--ink-3); letter-spacing: .06em; }

.ascii-divider td {
  padding: 10px 14px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(14, 27, 44, .9);
  color: #fff;
  font-size: 12.5px;
  z-index: 300;
  pointer-events: none;
}

/* ===================== 中等屏幕 ===================== */

@media (max-width: 1100px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===================== 手机 / 窄屏 ===================== */

@media (max-width: 920px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px 12px;
    height: auto;
    padding: 10px 14px 8px;
  }

  .menu-toggle { display: inline-flex; order: 0; }
  .brand { order: 1; }
  .brand__logo { height: 22px; }
  .brand__sub { font-size: 14px; }

  .search {
    order: 2;
    flex: 1 1 150px;
    width: auto;
    max-width: 260px;
    min-width: 116px;
  }
  .search input { height: 36px; }

  .nav {
    order: 3;
    width: 100%;
    gap: 2px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav__item { padding: 7px 12px; font-size: 14px; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(78vw, 300px);
    padding-top: 14px;
    box-shadow: 0 20px 50px rgba(10, 22, 40, .22);
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  }
  .sidebar.open { transform: none; }

  .sidebar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    padding: 2px 6px 12px 10px;
    border-bottom: 1px solid var(--line);
  }

  .sidebar__brand {
    color: #243b53;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
  }

  .sidebar__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
  }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 22, 40, .38);
  }
  .backdrop.show { display: block; }

  .content__inner { padding: 20px 16px 44px; }
  .hero { padding: 26px 22px 24px; border-radius: 16px; }
  .hero__title { font-size: 23px; }
  .hero__desc { font-size: 13.5px; }
  .section-head { margin-top: 26px; }
  .tool-grid { gap: 12px; }
  .tool-head { flex-wrap: wrap; }
  .tool-head__text h1 { font-size: 20px; }
  .badge { margin-left: 0; }
  .placeholder { padding: 40px 18px; }

  /* 工具面板在手机上收窄 */
  .panel { padding: 16px; }
  .panel__head { margin-bottom: 12px; }
  .clock { font-size: 26px; letter-spacing: 0; }
  .clock__date { font-size: 12px; }
  .ts-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
  .ts-box { padding: 10px 12px; }
  .ts-box__num { font-size: 16px; }
  .field input { flex: 1 1 100%; }
  .result__key { flex-basis: 58px; }
  .result__val { font-size: 12.5px; }

  /* 单位转换：分类改成横向滑动的一排 */
  .unit-layout { flex-direction: column; gap: 12px; }
  .unit-nav {
    flex: none;
    width: 100%;
    flex-direction: row;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .unit-nav::-webkit-scrollbar { display: none; }
  .unit-nav__group { display: none; }
  .unit-nav__item { padding: 7px 12px; border: 1px solid var(--line); white-space: nowrap; }
  .unit-nav__item.is-active { border-color: #c7d8f7; }
  .unit-nav__item.is-active::before { display: none; }
  .unit-row { flex-wrap: wrap; }
  .unit-input, .unit-output { flex: 1 1 100%; }
  .unit-select { flex: 1 1 130px; }

  /* 字符串转义：左右改成上下 */
  .esc-grid { grid-template-columns: 1fr; }
  .esc-col textarea { height: 170px; }
  .esc-tip { margin-left: 0; }

  /* 字符串/进制：输入框矮一点，按钮占满 */
  .rx-textarea { height: 78px; }
  .rx-actions .btn { width: 100%; }

  /* 人民币 / 计算器 */
  .rmb-input { height: 46px; font-size: 19px; }
  .rmb-result__text { font-size: 18px; }
  .calc__value { font-size: 25px; }
  .calc__key { height: 44px; font-size: 16px; }
  .calc__controls { width: 100%; justify-content: flex-end; }

  /* ASCII 对照表 */
  .ascii-wrap { max-height: 420px; }
  .ascii-table td, .ascii-table thead th { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 620px) {
  .tool-grid { grid-template-columns: 1fr; }
  .search__kbd { display: none; }
  .search input { padding-right: 12px; }
  .search__panel { width: min(88vw, 324px); }
}
