/* =========================================================
   烙饼工具箱 — Base64
   A small, dependency-free interface for everyday encoding.
   ========================================================= */

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

:root {
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Code", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f1ea;
  --bg-soft: #eeebe3;
  --surface: #fffdfa;
  --surface-2: #f8f5ef;
  --surface-3: #efebe2;
  --ink: #17231f;
  --ink-soft: #3d4a44;
  --muted: #5f6b63;
  --faint: #717d76;
  --line: #e4dfd4;
  --line-strong: #d3ccbe;
  --accent: #c8481d;
  --accent-strong: #a93a14;
  --on-accent: #fffdfa;
  --accent-soft: #fbe9e1;
  --accent-faint: #fdf5f0;
  --green: #237a5d;
  --green-soft: #e7f2ec;
  --blue: #3d6f9f;
  --blue-soft: #eaf0f6;
  --danger: #ae3d2c;
  --danger-soft: #fbeae6;
  --danger-line: #f0cdc4;
  --focus-halo: rgba(200, 72, 29, 0.12);

  --sidebar-bg: #14231e;
  --sidebar-bg-deep: #0f1b17;
  --sidebar-text: #f3f1e9;
  --sidebar-muted: #96a49c;
  --sidebar-faint: #7f8f87;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --topbar-bg: rgba(244, 241, 234, 0.82);

  --shadow-card: 0 1px 2px rgba(23, 35, 31, 0.03), 0 26px 70px -42px rgba(23, 35, 31, 0.3);
  --shadow-float: 0 2px 7px rgba(23, 35, 31, 0.09);
  --sidebar-width: 280px;
  --content-max: 1240px;
  --page-edge: clamp(20px, 3.2vw, 42px);
  --radius-card: 22px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1412;
  --bg-soft: #111a17;
  --surface: #141d19;
  --surface-2: #18231e;
  --surface-3: #202c27;
  --ink: #eef2ed;
  --ink-soft: #c8d1cb;
  --muted: #96a39b;
  --faint: #829088;
  --line: #27342e;
  --line-strong: #37463f;
  --accent: #ff8a5f;
  --accent-strong: #ffa17f;
  --on-accent: #24120b;
  --accent-soft: rgba(255, 138, 95, 0.12);
  --accent-faint: rgba(255, 138, 95, 0.055);
  --green: #6bcda6;
  --green-soft: rgba(92, 196, 154, 0.12);
  --blue: #88b9e7;
  --blue-soft: rgba(120, 170, 220, 0.12);
  --danger: #ff9b87;
  --danger-soft: rgba(255, 123, 99, 0.1);
  --danger-line: rgba(255, 139, 118, 0.26);
  --focus-halo: rgba(255, 138, 95, 0.16);

  --sidebar-bg: #09110e;
  --sidebar-bg-deep: #070d0a;
  --sidebar-text: #f3f1e9;
  --sidebar-muted: #9aa79f;
  --sidebar-faint: #7f8f87;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.055);
  --topbar-bg: rgba(13, 20, 18, 0.82);

  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.25), 0 30px 80px -46px rgba(0, 0, 0, 0.9);
  --shadow-float: 0 3px 10px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 560px at 102% -8%, rgba(200, 72, 29, 0.09), transparent 62%),
    radial-gradient(900px 520px at 18% 4%, rgba(35, 122, 93, 0.055), transparent 62%);
  background-attachment: fixed;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 560px at 102% -8%, rgba(255, 138, 95, 0.085), transparent 62%),
    radial-gradient(900px 520px at 18% 4%, rgba(92, 196, 154, 0.04), transparent 62%);
}

body.nav-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

::selection {
  color: var(--ink);
  background: var(--accent-soft);
}

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

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 9px;
  color: var(--bg);
  background: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript-banner {
  position: relative;
  z-index: 300;
  padding: 11px 20px;
  color: #4d250f;
  background: #ffe8c7;
  border-bottom: 1px solid #e9c58d;
  font-size: 13px;
  text-align: center;
}

/* ------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 24px 18px 18px;
  overflow: hidden;
  color: var(--sidebar-text);
  background:
    radial-gradient(440px 300px at -10% -8%, rgba(232, 93, 47, 0.19), transparent 68%),
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.055);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.07) 24%, rgba(255, 255, 255, 0.03) 80%, transparent);
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 10px;
}

.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 39px;
  height: 39px;
  color: #fffaf6;
  background: linear-gradient(145deg, #f68154 0%, #e65426 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 8px 24px -10px rgba(232, 93, 47, 0.8);
}

.brand-mark .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-name {
  overflow: hidden;
  color: var(--sidebar-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  color: var(--sidebar-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.145em;
  line-height: 1.2;
}

.sidebar-close {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid var(--sidebar-line);
  border-radius: 9px;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.sidebar-close:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.sidebar-close .icon {
  width: 16px;
  height: 16px;
}

.search-field {
  position: relative;
  height: 40px;
  flex: none;
  margin-top: 16px;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.048);
  border: 1px solid var(--sidebar-line);
  border-radius: 10px;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.search-field:focus-within {
  background: rgba(255, 255, 255, 0.068);
  border-color: rgba(255, 138, 96, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 138, 96, 0.12);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--sidebar-faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 100%;
  padding: 0 64px 0 36px;
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  border-radius: inherit;
  outline: none;
  font-size: 12.5px;
}

.search-field input::placeholder {
  color: var(--sidebar-faint);
}

.search-field input::-webkit-search-cancel-button,
.search-field input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-kbd {
  position: absolute;
  top: 50%;
  right: 9px;
  padding: 3px 5px;
  color: var(--sidebar-faint);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  color: var(--sidebar-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  transform: translateY(-50%);
}

.search-clear:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.search-clear .icon {
  width: 14px;
  height: 14px;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  margin-right: -9px;
  padding-right: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.13) transparent;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
}

.nav-group {
  margin-bottom: 22px;
}

.nav-group-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 18px);
  margin: 0 9px 8px;
  padding: 5px 0;
  color: var(--sidebar-faint);
  background: none;
  border: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-align: left;
  border-radius: 6px;
  transition: color 0.16s ease;
}

.nav-group-heading:hover {
  color: var(--sidebar-muted);
}

.nav-group-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-group-chevron {
  width: 13px;
  height: 13px;
  flex: none;
  opacity: 0.65;
  transition: transform 0.18s ease;
}

.nav-group.is-collapsed {
  margin-bottom: 10px;
}

.nav-group.is-collapsed .nav-group-heading {
  margin-bottom: 0;
}

.nav-group.is-collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group.is-collapsed .nav-list {
  display: none;
}

.nav-group-count {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

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

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  gap: 10px;
  padding: 8px 10px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.nav-item-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--sidebar-faint);
  transition: color 0.16s ease;
}

.nav-item-icon .icon {
  width: 17px;
  height: 17px;
}

.nav-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: 0.002em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  color: #e4ebe5;
  background: var(--sidebar-hover);
}

.nav-item:hover .nav-item-icon {
  color: var(--sidebar-muted);
}

.nav-item.is-active {
  color: #fffdf8;
  background: linear-gradient(90deg, rgba(232, 93, 47, 0.2), rgba(255, 255, 255, 0.045));
  border-color: rgba(255, 255, 255, 0.055);
}

.nav-item.is-active .nav-item-icon {
  color: #ff976f;
}

.nav-empty {
  margin: 12px 8px;
  padding: 20px 12px;
  color: var(--sidebar-muted);
  border: 1px dashed var(--sidebar-line);
  border-radius: 10px;
  text-align: center;
}

.nav-empty p {
  margin: 0 0 9px;
  font-size: 11.5px;
}

.nav-empty button {
  padding: 5px 10px;
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-line);
  border-radius: 6px;
  font-size: 10.5px;
}

.nav-empty button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-backdrop {
  display: none;
}

/* ------------------------------------------------------------------
   Layout & top bar
   ------------------------------------------------------------------ */

.content-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  gap: 18px;
  padding-inline: max(var(--page-edge), calc((100% - var(--content-max)) / 2 + var(--page-edge)));
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
  gap: 12px;
}

.topbar-actions {
  flex: none;
  gap: 9px;
}

.menu-button {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.menu-button:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.menu-button .icon {
  width: 17px;
  height: 17px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.breadcrumb-chevron {
  width: 11px;
  height: 11px;
  color: var(--faint);
  stroke-width: 2;
}

.crumb-muted {
  color: var(--muted);
}

.crumb-current {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
}

.mobile-page-title {
  display: none;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button .icon {
  width: 16px;
  height: 16px;
}

.theme-icon {
  grid-area: 1 / 1;
}

:root[data-theme="light"] .theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.main-content {
  width: 100%;
  max-width: var(--content-max);
  flex: 1;
  margin: 0 auto;
  padding: 0 var(--page-edge) 34px;
}

/* ------------------------------------------------------------------
   Page hero
   ------------------------------------------------------------------ */

.page-hero {
  position: relative;
  padding: 36px 0 24px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 800px;
  animation: rise-in 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.145em;
  line-height: 1;
}

.eyebrow-line {
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.eyebrow-index {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 4px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.page-hero h1 {
  margin: 13px 0 12px;
  color: var(--ink);
  font-size: clamp(34px, 4.25vw, 52px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.hero-title-main {
  position: relative;
  z-index: 0;
  white-space: nowrap;
}

.hero-title-main::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -0.005em;
  bottom: 0.08em;
  left: 0.01em;
  height: 0.16em;
  background: var(--accent);
  border-radius: 999px;
  opacity: 0.26;
}

.hero-title-sub {
  color: var(--ink-soft);
  font-size: 0.64em;
  font-weight: 500;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.hero-title-sub:empty {
  display: none;
}

.hero-description {
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
  white-space: nowrap;
}

.hero-mark {
  position: absolute;
  top: 16px;
  right: -5px;
  z-index: 0;
  color: transparent;
  font-family: var(--font-mono);
  font-size: clamp(136px, 16vw, 205px);
  font-weight: 700;
  letter-spacing: -0.12em;
  line-height: 0.85;
  opacity: 0.64;
  pointer-events: none;
  user-select: none;
  -webkit-text-stroke: 1px var(--line-strong);
  transform: rotate(-5deg);
}

/* ------------------------------------------------------------------
   Tool card
   ------------------------------------------------------------------ */

.tool-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 84px;
  animation: rise-in 0.55s 0.06s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.tool-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  left: 24px;
  width: 48px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}

.tool-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.mode-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mode-button:hover {
  color: var(--ink);
}

.mode-button.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 3px rgba(23, 35, 31, 0.08);
}

.tool-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.select-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrap select {
  height: 32px;
  min-width: 116px;
  padding: 0 29px 0 10px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  appearance: none;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.select-wrap select:hover {
  border-color: var(--line-strong);
}

.select-wrap select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.select-chevron {
  position: absolute;
  right: 8px;
  width: 12px;
  height: 12px;
  color: var(--faint);
  pointer-events: none;
}

.option-divider {
  width: 1px;
  height: 17px;
  background: var(--line);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.switch-track {
  position: relative;
  width: 31px;
  height: 18px;
  flex: none;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(23, 35, 31, 0.18);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.switch-input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-input:checked + .switch-track .switch-knob {
  background: #fffdfa;
  transform: translateX(13px);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-control:hover .switch-track {
  border-color: var(--muted);
}

.switch-input:checked + .switch-track,
.switch-control:hover .switch-input:checked + .switch-track {
  border-color: var(--accent);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
  align-items: stretch;
  padding: 20px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: clamp(342px, calc(40vh + 88px), 648px);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.editor-panel:focus-within {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.output-panel {
  background:
    linear-gradient(180deg, var(--accent-faint) 0, transparent 92px),
    var(--surface-2);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 49px;
  flex: none;
  gap: 8px;
  padding: 0 11px 0 15px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.panel-kicker {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
}

.output-kicker {
  color: var(--accent-strong);
}

.panel-title h3 {
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: 2px;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  gap: 5px;
  padding: 0 7px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 10.5px;
  line-height: 1;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.mini-button .icon {
  width: 13px;
  height: 13px;
}

.mini-button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-3);
  border-color: var(--line);
}

.mini-button.is-copied {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

.icon-button-small {
  width: 27px;
  height: 27px;
  background: transparent;
  border-color: transparent;
  border-radius: 6px;
}

.icon-button-small .icon {
  width: 14px;
  height: 14px;
}

.mini-button:disabled,
.icon-button-small:disabled {
  color: var(--faint);
  background: transparent;
  border-color: transparent;
  opacity: 0.45;
  cursor: not-allowed;
}

.text-button {
  padding: 3px 4px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 10px;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.text-button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-3);
}

.text-button:disabled {
  color: var(--faint);
  opacity: 0.55;
  cursor: not-allowed;
}

.textarea-shell {
  display: flex;
  flex: 1;
  /* 输入区随浏览器可视高度缩放：小屏保持紧凑，大屏自动变高。 */
  min-height: clamp(254px, 40vh, 560px);
}

.textarea-shell textarea {
  display: block;
  width: 100%;
  min-height: 100%;
  flex: 1;
  margin: 0;
  padding: 15px 16px 17px;
  overflow: auto;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.002em;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
  tab-size: 2;
}

.textarea-shell textarea::placeholder {
  color: var(--faint);
  opacity: 0.85;
}

.textarea-shell textarea::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.textarea-shell textarea::-webkit-scrollbar-track {
  background: transparent;
}

.textarea-shell textarea::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 2px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}

#outputText {
  color: var(--ink-soft);
}

.output-panel.is-stale #outputText {
  opacity: 0.54;
}

.output-panel.is-fresh {
  animation: result-flash 0.55s ease-out;
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 37px;
  flex: none;
  gap: 8px;
  padding: 0 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: -0.01em;
}

.panel-stat {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
  letter-spacing: 0;
  white-space: nowrap;
}

.status-dot {
  width: 4px;
  height: 4px;
  flex: none;
  background: currentColor;
  border-radius: 50%;
}

.output-status.is-success {
  color: var(--green);
}

.output-status.is-stale {
  color: var(--accent-strong);
}

.output-status.is-error {
  color: var(--danger);
}

.swap-column {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-line {
  position: absolute;
  top: 19px;
  bottom: 19px;
  left: 50%;
  border-left: 1px dashed var(--line-strong);
  transform: translateX(-50%);
}

.swap-button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow-float);
  transition: color 0.22s ease, border-color 0.22s ease, transform 0.32s ease, background-color 0.22s ease;
}

.swap-button .icon {
  width: 14px;
  height: 14px;
}

.swap-button:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-faint);
  border-color: rgba(200, 72, 29, 0.4);
  transform: rotate(180deg);
}

.swap-button:disabled {
  color: var(--faint);
  background: var(--surface-2);
  box-shadow: none;
  opacity: 0.5;
  cursor: not-allowed;
}

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: -5px 20px 15px;
  padding: 11px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  animation: slide-in 0.22s ease-out both;
}

.error-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  color: var(--danger);
  background: var(--surface);
  border-radius: 50%;
}

.error-icon .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.error-copy {
  min-width: 0;
  flex: 1;
}

.error-copy strong {
  display: block;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.55;
}

.error-copy p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.error-dismiss {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -2px -2px 0 2px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.error-dismiss:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
}

.error-dismiss .icon {
  width: 13px;
  height: 13px;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 39px;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.button-secondary {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--line);
}

.button-secondary:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.button-primary {
  min-width: 123px;
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 22px -12px rgba(200, 72, 29, 0.65);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 13px 25px -12px rgba(200, 72, 29, 0.72);
}

.button-primary:active:not(:disabled) {
  transform: translateY(0);
}

.button-primary .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.button-primary:hover:not(:disabled) .icon {
  transform: translateX(2px);
}

.button:disabled {
  color: var(--faint);
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: none;
  opacity: 0.62;
  cursor: not-allowed;
}

.button:focus-visible {
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------ */

.clipboard-helper {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.toast-region {
  position: fixed;
  z-index: 180;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: min(330px, calc(100vw - 32px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  max-width: 100%;
  gap: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 34px -15px rgba(23, 35, 31, 0.35);
  font-size: 11.5px;
  line-height: 1.55;
  animation: toast-in 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease-in both;
}

.toast-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 19px;
  height: 19px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 50%;
}

.toast.is-error .toast-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast.is-info .toast-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.toast-icon .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

/* ------------------------------------------------------------------
   Home view
   ------------------------------------------------------------------ */

.nav-home {
  width: 100%;
  margin-bottom: 8px;
}

.home-trust {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.trust-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.trust-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 10px;
}

.trust-badge .icon {
  width: 17px;
  height: 17px;
}

.trust-head h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 650;
}

.trust-head p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.85;
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.trust-list li {
  position: relative;
  padding-left: 17px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.6;
}

.trust-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--green-soft);
}

.home-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.directory-group {
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.directory-group h2 {
  margin: 0 0 10px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.directory-links {
  display: grid;
  gap: 4px;
}

.tool-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.tool-link:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.tool-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool-link-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 8px;
}

.tool-link-icon .icon {
  width: 14px;
  height: 14px;
}

.tool-link-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tool-link-copy strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.tool-link-copy small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.tool-link-arrow {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--faint);
  transition: color 0.18s ease, transform 0.18s ease;
}

.tool-link:hover .tool-link-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

/* ------------------------------------------------------------------
   Extended tool views
   ------------------------------------------------------------------ */

.editor-grid.is-flat {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tool-card > .editor-panel {
  margin: 20px;
}

#view-radix .editor-panel,
#view-password .editor-panel {
  min-height: 0;
}

.textarea-shell-compact {
  min-height: 96px;
}

.textarea-shell textarea.password-text {
  padding-top: 18px;
  padding-bottom: 18px;
  font-size: 15px;
  letter-spacing: 0.05em;
}

.tool-tip {
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.text-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.text-field input {
  width: 168px;
  height: 32px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.text-field.is-wide input {
  width: clamp(180px, 34vw, 340px);
}

.date-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.date-field input {
  height: 32px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.date-field input:hover {
  border-color: var(--line-strong);
}

.date-field input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.unit-value-field input {
  width: 96px;
}

.unit-result {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding: 22px 26px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.unit-result-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.unit-result-unit {
  color: var(--ink-soft);
  font-size: 13px;
}

.text-field input:hover {
  border-color: var(--line-strong);
}

.text-field input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.number-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.number-field input {
  width: 64px;
  height: 32px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.number-field input:hover {
  border-color: var(--line-strong);
}

.number-field input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.result-grid {
  display: grid;
  gap: 8px;
  padding: 0 20px 20px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.result-label {
  flex: none;
  width: 62px;
  color: var(--muted);
  font-size: 10.5px;
}

.result-value {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre;
  scrollbar-width: thin;
}

.result-row .mini-button {
  flex: none;
}

.diff-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
}

.diff-chip {
  padding: 4px 9px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.diff-chip.is-added {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-soft);
}

.diff-chip.is-removed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.diff-summary .mini-button {
  margin-left: auto;
}

.diff-view {
  max-height: 420px;
  margin: 0 20px 16px;
  padding: 10px 0;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  scrollbar-width: thin;
}

.diff-line {
  display: flex;
  gap: 10px;
  padding: 1px 14px;
  white-space: pre;
}

.diff-line.is-added {
  background: var(--green-soft);
}

.diff-line.is-removed {
  background: var(--danger-soft);
}

.diff-sign {
  flex: none;
  width: 12px;
  color: var(--faint);
  text-align: center;
}

.diff-line.is-added .diff-sign {
  color: var(--green);
}

.diff-line.is-removed .diff-sign {
  color: var(--danger);
}

.diff-text {
  color: var(--ink-soft);
}

.empty-state {
  margin: 0;
  padding: 22px 18px;
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: center;
}

.diff-note {
  margin: 10px 14px 2px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.strength {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 16px;
}

.strength-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.strength-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--danger);
  border-radius: 999px;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-fill.is-fair {
  background: var(--accent);
}

.strength-fill.is-strong,
.strength-fill.is-best {
  background: var(--green);
}

.strength-text {
  flex: none;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.strength-text.is-weak {
  color: var(--danger);
}

.strength-text.is-fair {
  color: var(--accent-strong);
}

.strength-text.is-strong,
.strength-text.is-best {
  color: var(--green);
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .hero-mark {
    display: none;
  }
}

@media (max-width: 1040px) {
  .hero-description {
    white-space: normal;
  }

  .tool-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .tool-options {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: min(298px, 88vw);
    visibility: hidden;
    transform: translateX(-104%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0.28s;
    box-shadow: 22px 0 60px -30px rgba(0, 0, 0, 0.65);
  }

  .sidebar.is-open {
    visibility: visible;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s;
  }

  .sidebar-close {
    display: grid;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    visibility: hidden;
    background: rgba(5, 11, 8, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0s;
  }

  .content-shell {
    margin-left: 0;
  }

  .menu-button {
    display: grid;
  }

  .main-content {
    padding-bottom: 28px;
  }

  .page-hero {
    padding-top: 30px;
  }
}

@media (max-width: 820px) {
  .editor-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 16px;
  }

  .editor-panel {
    min-height: 0;
  }

  .textarea-shell {
    min-height: 220px;
  }

  .swap-column {
    height: 46px;
    flex: none;
  }

  .swap-line {
    top: 50%;
    bottom: auto;
    right: 18px;
    left: 18px;
    border-top: 1px dashed var(--line-strong);
    border-left: 0;
    transform: translateY(-50%);
  }

  .swap-button {
    width: 31px;
    height: 31px;
  }

  .swap-button .icon {
    transform: rotate(90deg);
  }

  .swap-button:hover:not(:disabled) {
    transform: rotate(180deg);
  }

  .action-bar {
    align-items: stretch;
    flex-direction: column;
    padding: 13px 16px;
  }

  .action-buttons {
    justify-content: flex-end;
  }

  .error-banner {
    margin-right: 16px;
    margin-left: 16px;
  }
}

@media (max-width: 700px) {
  .topbar {
    height: 60px;
    gap: 12px;
  }

  .breadcrumb {
    display: none;
  }

  .mobile-page-title {
    display: block;
  }

  .main-content {
    padding-bottom: 24px;
  }

  .page-hero {
    padding: 26px 0 21px;
  }

  .page-hero h1 {
    margin-top: 11px;
    font-size: clamp(31px, 8.7vw, 39px);
    line-height: 1.12;
  }

  .hero-title-sub {
    font-size: 0.62em;
  }

  .hero-description {
    font-size: 12.5px;
    line-height: 1.8;
  }

  .tool-card {
    border-radius: 18px;
  }

  .tool-toolbar {
    padding: 13px;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .tool-options {
    align-items: center;
    gap: 10px 12px;
  }

  .option-divider {
    display: none;
  }

  .editor-grid {
    padding: 13px;
  }

  .panel-head {
    padding: 0 9px 0 13px;
  }

  .textarea-shell {
    min-height: 204px;
  }

  .textarea-shell textarea {
    padding: 13px 14px 15px;
    font-size: 12px;
  }

  .action-bar {
    gap: 10px;
    padding: 12px 13px;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .button {
    flex: 1;
  }

  .button-primary {
    min-width: 0;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 430px) {
  .select-control {
    width: 100%;
    justify-content: space-between;
  }

  .select-wrap {
    flex: 1;
    max-width: 165px;
  }

  .select-wrap select {
    width: 100%;
    min-width: 0;
  }

  .tool-options {
    justify-content: space-between;
  }

  .switch-control {
    font-size: 10px;
  }

  .eyebrow {
    font-size: 8.5px;
  }
}

@media (max-width: 360px) {
  .topbar-actions {
    gap: 6px;
  }
}

/* ------------------------------------------------------------------
   Motion & accessibility preferences
   ------------------------------------------------------------------ */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes result-flash {
  0% {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-halo);
  }
  100% {
    border-color: var(--line);
    box-shadow: none;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .action-bar,
  .swap-column,
  .page-hero,
  .toast-region {
    display: none !important;
  }

  .content-shell {
    margin: 0;
  }

  .main-content {
    max-width: none;
    padding: 0;
  }

  .tool-card {
    border: 0;
    box-shadow: none;
  }

  .editor-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .editor-panel {
    min-height: 300px;
  }
}

@media (max-width: 900px) {
  .editor-grid.is-flat {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .tool-card > .editor-panel {
    margin: 16px;
  }

  .result-grid,
  .stat-grid {
    padding: 0 16px 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diff-summary {
    padding: 0 16px 10px;
  }

  .diff-view {
    max-height: 320px;
    margin: 0 16px 14px;
  }
}

@media (max-width: 700px) {
  .result-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 10px 8px 14px;
  }

  .result-label {
    width: auto;
  }

  .result-value {
    flex-basis: 100%;
    width: 100%;
  }

  .result-row .mini-button {
    margin-left: auto;
  }

  .strength {
    flex-wrap: wrap;
  }

  .strength-text {
    white-space: normal;
  }
}

@media (max-width: 430px) {
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .number-field input {
    width: 56px;
  }

  .diff-line {
    white-space: pre-wrap;
    word-break: break-word;
  }
}

@media (max-width: 1180px) {
  .home-directory {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .home-trust {
    padding: 18px;
  }

  .trust-list {
    gap: 6px 14px;
  }

  .tool-link {
    padding: 8px;
  }
}

/* 颜色与图片工具 */

.color-preview {
  height: 150px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.palette-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.palette-chip {
  display: block;
  width: 100%;
  aspect-ratio: 1.5 / 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.palette-swatch:hover .palette-chip,
.palette-swatch:focus-visible .palette-chip {
  transform: scale(1.04);
  box-shadow: 0 8px 18px rgba(23, 35, 31, 0.12);
}

.palette-label {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-align: center;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  padding: 26px 20px;
  text-align: center;
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.file-drop:hover,
.file-drop:focus-within {
  background: var(--accent-faint);
  border-color: var(--accent);
}

.file-drop .icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.file-drop strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.file-drop small {
  color: var(--ink-soft);
  font-size: 11px;
}

.image-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.image-compare figure {
  margin: 0;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.image-compare img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: var(--surface-3);
  border-radius: 8px;
}

.image-compare figcaption {
  margin-top: 8px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-align: center;
}

.image-preview-wrap {
  display: grid;
  place-items: center;
  min-height: 160px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.converted-image {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
}

.pick-canvas {
  display: block;
  max-width: 100%;
  margin: 0 auto 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: crosshair;
}

.pick-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pick-swatch {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pick-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pick-hex {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
}

.pick-rgb {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}

.pick-info {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.text-image-canvas {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin: 0 auto 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.option-color-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.option-color {
  width: 38px;
  height: 30px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .image-compare {
    grid-template-columns: minmax(0, 1fr);
  }

  .color-preview {
    height: 110px;
  }
}

/* ------------------------------------------------------------------
   秒表
   ------------------------------------------------------------------ */

.stopwatch-wrap {
  padding: 30px 20px 10px;
  text-align: center;
}

.stopwatch-display {
  font-family: var(--font-mono);
  font-size: clamp(38px, 9vw, 76px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stopwatch-wrap .tool-tip {
  margin-top: 14px;
}

.stopwatch-laps {
  max-height: 280px;
  margin-top: 18px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.lap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lap-row:first-child {
  color: var(--accent-strong);
}

.lap-index {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  text-align: left;
}

.lap-total {
  min-width: 92px;
  text-align: right;
}

/* ------------------------------------------------------------------
   世界时间
   ------------------------------------------------------------------ */

.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 10px;
  padding: 0 20px 16px;
}

.world-card {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.world-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.world-card-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.world-card-head span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.world-card-time {
  margin-top: 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 24px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.world-card-date {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.world-note,
.ppi-note,
.keycode-note {
  margin: 0 20px 18px;
}

/* ------------------------------------------------------------------
   数据表格（HTTP 状态码 / MIME）
   ------------------------------------------------------------------ */

.data-table-wrap {
  padding: 0 20px 20px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: top;
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table .data-code {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

.data-table .data-mime {
  color: var(--ink);
  font-family: var(--font-mono);
  word-break: break-all;
}

.data-table .data-empty {
  padding: 24px;
  color: var(--faint);
  text-align: center;
}

/* ------------------------------------------------------------------
   键盘按键查询
   ------------------------------------------------------------------ */

.keycode-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 210px;
  margin: 20px;
  padding: 34px 20px;
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.keycode-stage:hover,
.keycode-stage:focus-visible {
  background: var(--accent-faint);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.keycode-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.keycode-key {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  word-break: break-all;
}

/* ------------------------------------------------------------------
   计算器
   ------------------------------------------------------------------ */

.calc-screen {
  margin: 20px 20px 12px;
  padding: 18px 20px;
  text-align: right;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.calc-expression {
  min-height: 22px;
  overflow-x: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
  scrollbar-width: thin;
}

.calc-result {
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  scrollbar-width: thin;
}

.calc-result.is-error {
  color: var(--danger);
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}

.calc-key {
  min-height: 54px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.calc-key:hover {
  background: var(--surface-3);
}

.calc-key:active {
  transform: scale(0.97);
}

.calc-key.is-utility {
  color: var(--muted);
  background: var(--surface-2);
}

.calc-key.is-operator {
  color: var(--accent-strong);
  background: var(--accent-faint);
  border-color: var(--accent-soft);
}

.calc-key.is-equals {
  grid-column: span 3;
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.calc-key.is-equals:hover {
  background: var(--accent-strong);
}

.calc-note {
  margin: 0 20px 18px;
}

/* ------------------------------------------------------------------
   万年历
   ------------------------------------------------------------------ */

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 20px 12px;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-title {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 0 20px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.calendar-grid {
  margin-bottom: 16px;
}

.calendar-day {
  min-height: 44px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.calendar-day:hover {
  background: var(--surface-3);
}

.calendar-day.is-outside {
  color: var(--faint);
  opacity: 0.45;
}

.calendar-day.is-today {
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.calendar-day.is-selected {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

.calendar-info .result-label {
  width: 84px;
}

/* ------------------------------------------------------------------
   浏览器指纹
   ------------------------------------------------------------------ */

.fp-grid .result-row {
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 8px;
}

.fp-grid .result-label {
  width: 96px;
  padding-top: 3px;
}

.fp-grid .fp-value {
  overflow-x: visible;
  white-space: normal;
  word-break: break-word;
}

/* ------------------------------------------------------------------
   图片转 ICO
   ------------------------------------------------------------------ */

.ico-sizes {
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------
   屏幕测试
   ------------------------------------------------------------------ */

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

.screen-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease;
}

.screen-swatch:hover {
  transform: scale(1.1);
}

.swatch-red { background: #ff0000; }
.swatch-green { background: #00ff00; }
.swatch-blue { background: #0000ff; }
.swatch-white { background: #ffffff; }
.swatch-black { background: #000000; }
.swatch-cyan { background: #00ffff; }
.swatch-magenta { background: #ff00ff; }
.swatch-yellow { background: #ffff00; }
.swatch-gray { background: #808080; }

.screen-stage {
  display: grid;
  place-items: center;
  min-height: 320px;
  margin: 0 20px 14px;
  background: #ff0000;
  border-radius: 16px;
  outline: none;
  cursor: pointer;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.screen-stage:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.screen-stage:fullscreen {
  margin: 0;
  min-height: 100vh;
  border-radius: 0;
}

.screen-stage-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.screen-stage-label strong {
  font-size: 15px;
}

.screen-note {
  margin: 0 20px 18px;
}

/* ------------------------------------------------------------------
   鼠标测试
   ------------------------------------------------------------------ */

.mouse-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 260px;
  margin: 0 20px 16px;
  padding: 24px;
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  outline: none;
  cursor: crosshair;
  user-select: none;
}

.mouse-stage.is-pressed {
  background: var(--accent-faint);
  border-color: var(--accent);
}

.mouse-hint {
  color: var(--muted);
  font-size: 12px;
}

.mouse-readout {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 600;
  line-height: 1.2;
}

/* ------------------------------------------------------------------
   随机骰子
   ------------------------------------------------------------------ */

.dice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 122px;
  padding: 28px 20px 8px;
}

.die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: 74px;
  height: 74px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
}

.dice-row.is-rolling .die {
  animation: die-shake 0.3s linear infinite;
}

@keyframes die-shake {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-4px) rotate(-4deg);
  }
  75% {
    transform: translateY(3px) rotate(4deg);
  }
}

.die-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.die[data-face="1"] .die-dot[data-cell="4"],
.die[data-face="2"] .die-dot[data-cell="0"],
.die[data-face="2"] .die-dot[data-cell="8"],
.die[data-face="3"] .die-dot[data-cell="0"],
.die[data-face="3"] .die-dot[data-cell="4"],
.die[data-face="3"] .die-dot[data-cell="8"],
.die[data-face="4"] .die-dot[data-cell="0"],
.die[data-face="4"] .die-dot[data-cell="2"],
.die[data-face="4"] .die-dot[data-cell="6"],
.die[data-face="4"] .die-dot[data-cell="8"],
.die[data-face="5"] .die-dot[data-cell="0"],
.die[data-face="5"] .die-dot[data-cell="2"],
.die[data-face="5"] .die-dot[data-cell="4"],
.die[data-face="5"] .die-dot[data-cell="6"],
.die[data-face="5"] .die-dot[data-cell="8"],
.die[data-face="6"] .die-dot[data-cell="0"],
.die[data-face="6"] .die-dot[data-cell="2"],
.die[data-face="6"] .die-dot[data-cell="3"],
.die[data-face="6"] .die-dot[data-cell="5"],
.die[data-face="6"] .die-dot[data-cell="6"],
.die[data-face="6"] .die-dot[data-cell="8"] {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .dice-row.is-rolling .die {
    animation: none;
  }
}

@media (max-width: 700px) {
  .calc-keys {
    gap: 8px;
  }

  .calc-key {
    min-height: 48px;
  }

  .calendar-day {
    min-height: 38px;
  }

  .screen-stage {
    min-height: 240px;
  }

  .die {
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 430px) {
  .calendar-toolbar {
    justify-content: center;
  }

  .calendar-info .result-label {
    width: 68px;
  }

  .fp-grid .result-label {
    width: 74px;
  }
}

/* =========================================================
   字符编码转换 / 重复统计 / 时辰
   ========================================================= */

.shichen-watch {
  margin-top: 14px;
}

.shichen-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.shichen-note {
  margin: 0;
  padding: 4px 20px 20px;
}

.data-table tr.is-current td {
  color: var(--accent-strong);
  background: var(--accent-faint);
  font-weight: 600;
}

.data-table tr.is-current td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* =========================================================
   屏幕取色器
   ========================================================= */

.eyedropper-swatch {
  display: grid;
  place-items: center;
  min-height: 168px;
  margin: 0 20px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, var(--surface-3) 25%, transparent 25%, transparent 75%, var(--surface-3) 75%),
    linear-gradient(45deg, var(--surface-3) 25%, transparent 25%, transparent 75%, var(--surface-3) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  overflow: hidden;
}

.eyedropper-swatch.has-color {
  background: none;
}

.eyedropper-hex {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.eyedropper-swatch.has-color .eyedropper-hex {
  color: #ffffff;
  mix-blend-mode: difference;
}

.eyedropper-history-wrap {
  padding: 0 20px 12px;
}

.eyedropper-empty {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 12px;
}

.eyedropper-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.eyedropper-chip {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  transition: transform 0.12s ease;
}

.eyedropper-chip:hover {
  transform: translateY(-2px);
}

.eyedropper-note {
  margin: 0;
  padding: 0 20px 20px;
}

/* =========================================================
   九宫格 / 图片裁剪
   ========================================================= */

.grid-crops {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 16px;
}

.grid-crop-item {
  margin: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.grid-crop-item img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

.grid-crop-item figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
}

.grid-crop-item .mini-button {
  padding: 2px 7px;
  font-size: 11px;
}

.crop-stage {
  position: relative;
  margin: 0 20px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.crop-stage img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  border: 1.5px solid var(--accent);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  box-shadow: 0 0 0 9999px rgba(9, 17, 14, 0.5);
  pointer-events: none;
}

.crop-selection[hidden] {
  display: none !important;
}

/* =========================================================
   涂鸦画板
   ========================================================= */

.doodle-range {
  width: 120px;
  accent-color: var(--accent);
}

.doodle-size-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.doodle-stage {
  padding: 0 20px 12px;
}

.doodle-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
}

.doodle-note {
  margin: 0;
  padding: 0 20px 20px;
}

/* =========================================================
   字体预览
   ========================================================= */

.font-preview-box {
  margin: 0 20px 14px;
  padding: 26px 22px;
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.font-preview-line {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.font-editor {
  padding: 0 20px 20px;
}

.font-editor .textarea-shell {
  min-height: 0;
}

.font-editor textarea {
  height: 150px;
  min-height: 150px;
}

/* =========================================================
   条形码 / 二维码
   ========================================================= */

.barcode-stage {
  display: grid;
  place-items: center;
  margin: 0 20px 14px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
}

.barcode-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-editor {
  padding: 0 20px;
}

.qr-editor .textarea-shell {
  min-height: 0;
}

.qr-editor textarea {
  height: 128px;
  min-height: 128px;
}

.qr-stage {
  display: grid;
  place-items: center;
  padding: 18px 20px;
}

.qr-canvas {
  width: min(100%, 360px);
  height: auto;
  border-radius: 10px;
  background: #ffffff;
  image-rendering: pixelated;
  box-shadow: var(--shadow-float);
}

/* =========================================================
   Markdown 预览
   ========================================================= */

.md-preview {
  flex: 1;
  min-height: 360px;
  max-height: 620px;
  overflow: auto;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.md-preview.is-empty {
  display: grid;
  place-items: center;
  color: var(--faint);
}

.md-preview > :first-child {
  margin-top: 0;
}

.md-preview > :last-child {
  margin-bottom: 0;
}

.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4,
.md-preview h5,
.md-preview h6 {
  margin: 18px 0 10px;
  color: var(--ink);
  line-height: 1.35;
}

.md-preview h1 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
}

.md-preview h2 {
  font-size: 20px;
}

.md-preview h3 {
  font-size: 17px;
}

.md-preview h4,
.md-preview h5,
.md-preview h6 {
  font-size: 15px;
}

.md-preview p {
  margin: 0 0 10px;
}

.md-preview ul,
.md-preview ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.md-preview li {
  margin: 3px 0;
}

.md-preview blockquote {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-faint);
  color: var(--muted);
}

.md-preview blockquote p {
  margin: 0;
}

.md-preview code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.md-preview pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow: auto;
  border-radius: 10px;
  background: var(--surface-3);
}

.md-preview pre code {
  padding: 0;
  background: none;
  font-size: 12px;
}

.md-preview table {
  width: 100%;
  margin: 0 0 12px;
  border-collapse: collapse;
  font-size: 12px;
}

.md-preview th,
.md-preview td {
  padding: 6px 9px;
  border: 1px solid var(--line);
  text-align: left;
}

.md-preview th {
  background: var(--surface-3);
  color: var(--ink);
}

.md-preview a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.md-preview img {
  max-width: 100%;
  border-radius: 8px;
}

.md-preview hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

/* =========================================================
   特殊符号
   ========================================================= */

.symbol-toolbar {
  padding: 20px 20px 12px;
}

.symbol-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 10px;
}

.symbol-group-button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.symbol-group-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.symbol-group-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.symbol-info {
  margin: 0;
  padding: 0 20px 8px;
  color: var(--muted);
  font-size: 12px;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  padding: 0 20px 20px;
}

.symbol-chip {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.symbol-chip:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--accent-faint);
}

.symbol-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.symbol-empty {
  margin: 0;
  padding: 26px 20px 34px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

/* =========================================================
   在线闹钟
   ========================================================= */

.alarm-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 20px 16px;
}

.alarm-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0 20px 16px;
  padding: 30px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
  text-align: center;
}

.alarm-clock {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(34px, 8vw, 56px);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.alarm-status {
  color: var(--muted);
  font-size: 12px;
}

.alarm-remain {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 15px;
}

.alarm-display.is-ringing {
  border-color: var(--accent);
  animation: alarm-pulse 1s ease-in-out infinite;
}

@keyframes alarm-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--focus-halo);
  }
  50% {
    box-shadow: 0 0 0 12px transparent;
  }
}

.alarm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 20px 12px;
}

.alarm-note {
  margin: 0;
  padding: 0 20px 20px;
}

@media (prefers-reduced-motion: reduce) {
  .alarm-display.is-ringing {
    animation: none;
  }

  .symbol-chip,
  .eyedropper-chip {
    transition: none;
  }
}

@media (max-width: 700px) {
  .grid-crops {
    gap: 6px;
    padding: 0 14px 14px;
  }

  .grid-crop-item figcaption {
    padding: 4px 6px;
  }

  .grid-crop-item figcaption span {
    font-size: 10px;
  }

  .eyedropper-swatch,
  .crop-stage,
  .barcode-stage {
    margin: 0 14px 12px;
  }

  .font-preview-box {
    margin: 0 14px 12px;
    padding: 20px 16px;
  }

  .eyedropper-history-wrap,
  .eyedropper-note,
  .doodle-stage,
  .doodle-note,
  .font-editor,
  .qr-editor,
  .qr-stage,
  .symbol-toolbar,
  .symbol-groups,
  .symbol-info,
  .symbol-grid,
  .alarm-panel,
  .alarm-display,
  .alarm-actions,
  .alarm-note {
    padding-left: 14px;
    padding-right: 14px;
  }

  .symbol-grid {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    padding-left: 14px;
    padding-right: 14px;
  }

  .symbol-chip {
    font-size: 19px;
  }

  .doodle-range {
    width: 90px;
  }

  .md-preview {
    min-height: 260px;
    max-height: 460px;
  }
}


