:root {
  --bg-1: #f8f4ec;
  --bg-2: #dff6ef;
  --bg-spot-1: #fff7e6;
  --bg-spot-2: #cdf4ea;
  --ink: #1c1e21;
  --muted: #556070;
  --card: rgba(255, 255, 255, 0.86);
  --panel: rgba(255, 255, 255, 0.66);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-soft: rgba(255, 255, 255, 0.56);
  --placeholder-soft: #dfe5ea;
  --media-preview-bg: #0d1015;
  --media-shot-bg: #dfe5ea;
  --calc-field-bg-top: rgba(255, 255, 255, 0.98);
  --calc-field-bg-bottom: rgba(248, 250, 252, 0.92);
  --line: rgba(28, 30, 33, 0.14);
  --accent: #ff6a3d;
  --accent-2: #117a65;
  --focus: #1b5cff;
  --shadow: 0 16px 44px rgba(14, 17, 28, 0.12);
}

:root[data-theme="dark"] {
  --bg-1: #0f151c;
  --bg-2: #101a18;
  --bg-spot-1: #2a2f1f;
  --bg-spot-2: #143332;
  --ink: #e8edf2;
  --muted: #aeb7c2;
  --card: rgba(19, 25, 35, 0.88);
  --panel: rgba(24, 31, 42, 0.86);
  --surface: rgba(22, 29, 40, 0.92);
  --surface-soft: rgba(22, 29, 40, 0.76);
  --placeholder-soft: #2a3441;
  --media-preview-bg: #111a25;
  --media-shot-bg: #2a3441;
  --calc-field-bg-top: rgba(30, 38, 51, 0.96);
  --calc-field-bg-bottom: rgba(24, 32, 44, 0.94);
  --line: rgba(176, 191, 209, 0.2);
  --focus: #6ea8ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 15% 10%, var(--bg-spot-1) 0%, transparent 35%),
    radial-gradient(circle at 90% 10%, var(--bg-spot-2) 0%, transparent 30%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(36px);
}

.bg-shape-1 {
  width: 320px;
  height: 320px;
  left: -90px;
  top: 24%;
  background: rgba(255, 106, 61, 0.22);
  border-radius: 40% 60% 53% 47% / 53% 52% 48% 47%;
  animation: drift 12s ease-in-out infinite;
}

.bg-shape-2 {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 56%;
  background: rgba(17, 122, 101, 0.24);
  border-radius: 60% 40% 45% 55% / 44% 52% 48% 56%;
  animation: drift 14s ease-in-out infinite reverse;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1280px, 94vw);
  margin: 0.9rem auto 0.08rem;
  display: grid;
  gap: 0.85rem;
}

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.workspace.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar {
  position: sticky;
  top: 1rem;
  height: min(70dvh, 640px);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(28, 30, 33, 0.3) transparent;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
}

.sidebar::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(28, 30, 33, 0.25);
}

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

.nav-group {
  display: grid;
  gap: 0.42rem;
  margin-bottom: 0.35rem;
}

.nav-group-title {
  margin: 0.25rem 0 0.1rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.sidebar h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  padding-bottom: 0.35rem;
}

.nav-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid rgba(24, 29, 38, 0.16);
  border-radius: 10px;
  padding: 0.5rem 0.62rem;
  background: rgba(255, 255, 255, 0.75);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  border-color: rgba(24, 29, 38, 0.3);
}

.nav-link.active {
  background: linear-gradient(120deg, rgba(255, 106, 61, 0.18), rgba(255, 131, 71, 0.18));
  border-color: rgba(255, 106, 61, 0.48);
  font-weight: 700;
}

.pages {
  display: grid;
}

.tool-page {
  display: none;
}

.tool-page.active {
  display: block;
}

body.home-mode.sidebar-collapsed .app {
  min-height: 100vh;
  margin-top: 0;
  margin-bottom: 0;
  align-content: center;
}

body.home-mode .workspace {
  display: grid;
}

body.home-mode.sidebar-collapsed .workspace {
  display: none;
}

body.home-mode.sidebar-collapsed .hero {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
}

.hero {
  position: relative;
  padding: 0.45rem 0.2rem 0.2rem;
  text-align: left;
  animation: rise 0.7s ease-out both;
}

.hero-controls {
  position: absolute;
  top: 0.1rem;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-toggle-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0.32rem 0.58rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-toggle-btn:hover {
  box-shadow: none;
  transform: none;
  border-color: rgba(24, 29, 38, 0.3);
}

.theme-switcher {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.theme-btn {
  min-width: 56px;
  padding: 0.4rem 0.58rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}

.theme-btn:hover {
  box-shadow: none;
  transform: none;
  border-color: var(--line);
}

.theme-btn.active {
  background: linear-gradient(120deg, var(--accent), #ff8347);
  color: #fff;
}

.eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0;
}

h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.52rem, 2.35vw, 2.25rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 66ch;
  font-size: 0.92rem;
}

body.home-mode.sidebar-collapsed .subtitle {
  margin: 0 auto;
}

.home-readme-box {
  margin: 0;
  min-height: 220px;
  max-height: 58vh;
  overflow: auto;
  padding: 0.72rem;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}

.home-readme-box h1,
.home-readme-box h2,
.home-readme-box h3,
.home-readme-box h4,
.home-readme-box h5,
.home-readme-box h6 {
  margin: 0.75rem 0 0.42rem;
}

.home-readme-box p,
.home-readme-box ul,
.home-readme-box ol,
.home-readme-box pre,
.home-readme-box blockquote {
  margin: 0.48rem 0;
}

.home-readme-box ul,
.home-readme-box ol {
  padding-left: 1.3rem;
}

.home-readme-box code {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.88em;
  padding: 0.1rem 0.26rem;
  border-radius: 6px;
  background: rgba(127, 139, 171, 0.18);
}

.home-readme-box pre {
  padding: 0.62rem;
  border-radius: 8px;
  overflow: auto;
  background: rgba(127, 139, 171, 0.14);
}

.home-readme-box pre code {
  padding: 0;
  background: transparent;
}

.home-readme-box a {
  color: var(--accent);
}

.home-readme-box blockquote {
  margin-left: 0;
  padding-left: 0.72rem;
  border-left: 3px solid rgba(127, 139, 171, 0.35);
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0.15rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

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

.panel {
  background: var(--panel);
  border: 1px solid rgba(17, 26, 42, 0.08);
  border-radius: 14px;
  padding: 0.82rem;
  display: grid;
  gap: 0.52rem;
}

label {
  font-size: 0.92rem;
  color: var(--muted);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(24, 29, 38, 0.2);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  background: var(--surface);
  color: var(--ink);
}

input[type="file"] {
  padding: 0.42rem 0.45rem;
  background: var(--surface-soft);
}

input[type="range"] {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

input[type="file"]::file-selector-button {
  margin-right: 0.65rem;
  border: 1px solid rgba(24, 29, 38, 0.2);
  border-radius: 8px;
  padding: 0.36rem 0.62rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  margin-right: 0.65rem;
  border: 1px solid rgba(24, 29, 38, 0.2);
  border-radius: 8px;
  padding: 0.36rem 0.62rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

textarea,
#hash-output,
#public-key-output,
#private-key-output {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}

input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

button {
  border: none;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), #ff8347);
  color: #fff;
  padding: 0.66rem 0.92rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 106, 61, 0.35);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: linear-gradient(120deg, #117a65, #1f9e87);
}

button.secondary:hover {
  box-shadow: 0 6px 18px rgba(17, 122, 101, 0.35);
}

.qr-output {
  min-height: 208px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 12px;
  background: var(--surface-soft);
}

.result-box {
  min-height: 92px;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  padding: 0.7rem;
  background: var(--surface-soft);
  white-space: pre-wrap;
}

.hint {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0.2rem 0 0;
}

.button-row {
  display: flex;
  gap: 0.6rem;
}

.countdown-preset-row {
  flex-wrap: wrap;
}

.countdown-preset-row button {
  min-width: 88px;
  padding: 0.45rem 0.7rem;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.5s ease-out forwards;
}

#hash-card {
  animation-delay: 120ms;
}

#ssh-card {
  animation-delay: 220ms;
}

#cron-card {
  animation-delay: 320ms;
}

#uuid-card {
  animation-delay: 420ms;
}

#unit-converter-card {
  animation-delay: 460ms;
}

#timestamp-card {
  animation-delay: 480ms;
}

#password-card {
  animation-delay: 500ms;
}

#encode-card {
  animation-delay: 520ms;
}

#image-base64-card {
  animation-delay: 560ms;
}

#color-card {
  animation-delay: 600ms;
}

#diff-card {
  animation-delay: 640ms;
}

#route-trace-card {
  animation-delay: 680ms;
}

#calculator-card {
  animation-delay: 720ms;
}

#time-now-card {
  animation-delay: 740ms;
}

#countdown-card {
  animation-delay: 745ms;
}

#bmi-card {
  animation-delay: 750ms;
}

#input-test-card {
  animation-delay: 760ms;
}

#media-test-card {
  animation-delay: 800ms;
}

.cron-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cron-grid > div:last-child {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.cron-next-times {
  margin: 0;
  padding-left: 1.1rem;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
  min-height: 120px;
  max-height: 180px;
  overflow: auto;
}

.cron-next-times li {
  margin: 0.45rem 0;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.92rem;
}

.color-picker {
  -webkit-appearance: none;
  appearance: none;
  height: 92px;
  padding: 0;
  border: 1px solid rgba(40, 45, 58, 0.24);
  border-radius: 12px;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 11px;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 11px;
}

.color-output-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.color-copy-btn {
  min-width: 64px;
  height: 40px;
  padding: 0.45rem 0.7rem;
}

.color-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.color-status.error {
  color: #b42318;
}

.inline-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.inline-copy-row button {
  padding: 0.45rem 0.72rem;
}

.base64-image-preview {
  width: 100%;
  min-height: 160px;
  max-height: 360px;
  object-fit: contain;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
}

.base64-image-preview.is-empty {
  background: var(--placeholder-soft);
}

.image-process-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.image-process-preview-col {
  display: grid;
  gap: 0.35rem;
}

#audio-process-source-preview,
#audio-process-result-preview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

#audio-process-source-waveform,
#audio-process-result-waveform {
  width: 100%;
  display: block;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
}

:root[data-theme="dark"] #audio-process-source-preview,
:root[data-theme="dark"] #audio-process-result-preview {
  color-scheme: dark;
  background: #111a25;
  border-color: rgba(176, 191, 209, 0.22);
}

:root[data-theme="dark"] #audio-process-source-waveform,
:root[data-theme="dark"] #audio-process-result-waveform {
  background: #111a25;
  border-color: rgba(176, 191, 209, 0.22);
}

:root[data-theme="dark"] .audio-process-band-track {
  background: rgba(176, 191, 209, 0.24);
}

:root[data-theme="dark"] .audio-process-band-range {
  background: linear-gradient(120deg, #ff805a, #f3b14e);
}

:root[data-theme="dark"] .audio-process-band-slider-wrap input[type="range"]::-webkit-slider-thumb,
:root[data-theme="dark"] .audio-process-band-slider-wrap input[type="range"]::-moz-range-thumb {
  border-color: rgba(176, 191, 209, 0.35);
  background: #ecf2f9;
}

.audio-process-ab-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.audio-process-ab-row button {
  width: 100%;
}

.audio-process-filter-custom-row {
  margin-top: -0.15rem;
  margin-bottom: 0.2rem;
}

.audio-process-filter-type-row,
.audio-process-filter-band-row {
  grid-column: 1 / -1;
}

.image-process-two-col-grid > .audio-process-filter-type-row,
.image-process-two-col-grid > .audio-process-filter-band-row,
.image-process-two-col-grid > .audio-process-time-pitch-type-row,
.image-process-two-col-grid > .audio-process-time-pitch-controls-row {
  grid-column: 1 / -1;
}

.image-process-two-col-grid > #audio-process-band-wrap {
  grid-column: 1 / -1 !important;
}

.audio-process-filter-band-row,
#audio-process-band-wrap,
#audio-process-band-visual-wrap,
#audio-process-band-slider-wrap {
  width: 100%;
  min-width: 0;
}

.audio-process-time-pitch-type-row,
.audio-process-time-pitch-controls-row {
  grid-column: 1 / -1;
}

.audio-process-filter-visual-wrap {
  display: grid;
  gap: 0.35rem;
  width: 100%;
}

.audio-process-band-slider-wrap {
  position: relative;
  height: 30px;
}

.audio-process-band-track,
.audio-process-band-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.audio-process-band-track {
  background: rgba(120, 132, 148, 0.24);
}

.audio-process-band-range {
  background: linear-gradient(120deg, #ff6a3d, #f39f33);
}

.audio-process-band-slider-wrap input[type="range"] {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  accent-color: transparent;
}

.audio-process-band-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(17, 26, 42, 0.18);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(17, 26, 42, 0.25);
  margin-top: -6px;
  cursor: pointer;
}

.audio-process-band-slider-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(17, 26, 42, 0.18);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(17, 26, 42, 0.25);
  cursor: pointer;
}

.audio-process-band-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border: none;
}

.audio-process-band-slider-wrap input[type="range"]::-moz-range-track {
  height: 6px;
  background: transparent;
  border: none;
}


#audio-process-band-wrap .image-process-scale-percent-row {
  margin-bottom: 0.2rem;
}

.audio-process-band-text-inline {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto minmax(90px, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.audio-process-band-text-inline label {
  margin: 0;
  white-space: nowrap;
}

#audio-process-band-value {
  min-width: 220px;
  white-space: nowrap;
}

#audio-process-gain {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  height: 24px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  --gain-fill: 33.3%;
}

#audio-process-gain::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #ff6a3d 0%,
    #ff6a3d var(--gain-fill),
    rgba(120, 132, 148, 0.28) var(--gain-fill),
    rgba(120, 132, 148, 0.28) 100%
  );
}

#audio-process-gain::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #ff6a3d 0%,
    #ff6a3d var(--gain-fill),
    rgba(120, 132, 148, 0.28) var(--gain-fill),
    rgba(120, 132, 148, 0.28) 100%
  );
}

#audio-process-gain::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(17, 26, 42, 0.2);
  background: #fff;
  margin-top: -4px;
}

#audio-process-gain::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(17, 26, 42, 0.2);
  background: #fff;
}

:root[data-theme="dark"] #audio-process-gain::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    #ff805a 0%,
    #ff805a var(--gain-fill),
    rgba(176, 191, 209, 0.26) var(--gain-fill),
    rgba(176, 191, 209, 0.26) 100%
  );
}

:root[data-theme="dark"] #audio-process-gain::-moz-range-track {
  background: linear-gradient(
    90deg,
    #ff805a 0%,
    #ff805a var(--gain-fill),
    rgba(176, 191, 209, 0.26) var(--gain-fill),
    rgba(176, 191, 209, 0.26) 100%
  );
}

:root[data-theme="dark"] #audio-process-gain::-webkit-slider-thumb,
:root[data-theme="dark"] #audio-process-gain::-moz-range-thumb {
  border-color: rgba(176, 191, 209, 0.35);
  background: #ecf2f9;
}

.audio-process-log-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
}

.audio-process-log-marks {
  position: relative;
  height: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.audio-process-log-marks span {
  position: absolute;
  left: calc(var(--mark-pos) * 1%);
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  cursor: pointer;
}

.audio-process-log-marks .mark-edge-left {
  transform: translateX(0);
}

.audio-process-log-marks .mark-edge-right {
  transform: translateX(-100%);
}

.audio-process-log-marks span b {
  color: var(--ink);
  font-weight: 700;
  font-style: normal;
}

.audio-process-log-marks span:hover b {
  text-decoration: underline;
}

.image-process-two-col-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-process-ratio-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
}

.image-process-ratio-row label {
  margin: 0;
}

.image-process-quality-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.image-process-quality-value {
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  min-width: 56px;
  text-align: center;
  line-height: 1.1;
}

.image-process-quality-marks {
  position: relative;
  height: 2.1rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.image-process-quality-marks span {
  position: absolute;
  left: calc(var(--mark-pos) * 1%);
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  display: inline-grid;
  justify-items: center;
  line-height: 1.05;
  cursor: pointer;
}

.image-process-quality-marks span b,
.image-process-quality-marks span i {
  font-style: normal;
}

.image-process-quality-marks span b {
  color: var(--ink);
  font-weight: 700;
}

.image-process-quality-marks .mark-edge-left {
  transform: translateX(0);
}

.image-process-quality-marks .mark-edge-right {
  transform: translateX(-100%);
}

.image-process-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
}

.image-process-chip-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink);
}

.image-process-chip-row input[type="checkbox"] {
  width: auto;
}

.image-process-ico-preset-row {
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.image-process-ico-preset-row button {
  min-width: 90px;
  padding: 0.4rem 0.65rem;
}

.image-process-scale-percent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.image-process-scale-percent-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.image-process-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.82rem;
  color: var(--ink);
}

.image-process-inline-check input[type="checkbox"] {
  width: auto;
}

#image-process-scale-percent-custom-wrap {
  margin-top: 0.35rem;
}

.image-process-scale-percent-value {
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.52rem;
  min-width: 58px;
  text-align: center;
}

.image-process-scale-percent-marks {
  position: relative;
  height: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.image-process-scale-percent-marks span {
  position: absolute;
  left: calc(var(--mark-pos) * 1%);
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  cursor: pointer;
}

.image-process-quality-marks span:hover b,
.image-process-scale-percent-marks span:hover b {
  text-decoration: underline;
}

.image-process-scale-percent-marks .mark-edge-left {
  transform: translateX(0);
}

.image-process-scale-percent-marks .mark-edge-right {
  transform: translateX(-100%);
}

.image-process-scale-percent-marks span b {
  color: var(--ink);
  font-weight: 700;
  font-style: normal;
}

.image-process-two-col-grid > div:last-child {
  grid-column: auto;
}

.image-process-crop-stage {
  position: relative;
  width: 100%;
  min-height: 260px;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
  overflow: hidden;
}

.image-process-crop-stage.is-empty {
  background: var(--placeholder-soft);
}

.image-process-crop-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 460px;
  cursor: crosshair;
}

.image-process-crop-stage.is-empty canvas {
  display: none;
}

.image-process-crop-placeholder {
  margin: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--muted);
}

.image-process-crop-stage:not(.is-empty) .image-process-crop-placeholder {
  display: none;
}

#image-process-card .panel .button-row {
  flex-wrap: wrap;
}

#image-process-card .panel .button-row button {
  min-width: 150px;
}

.diff-options-row {
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
}

.diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--ink);
}

.diff-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.diff-toggle-slider {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c8d0da;
  border: 1px solid rgba(17, 26, 42, 0.18);
  position: relative;
  transition: background 140ms ease;
}

.diff-toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 26, 42, 0.25);
  transition: transform 140ms ease;
}

.diff-toggle input:checked + .diff-toggle-slider {
  background: linear-gradient(120deg, #117a65, #1f9e87);
}

.diff-toggle input:checked + .diff-toggle-slider::after {
  transform: translateX(18px);
}

.diff-toggle input:focus-visible + .diff-toggle-slider {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

:root[data-theme="dark"] .theme-switcher {
  background: rgba(20, 28, 39, 0.9);
  border-color: rgba(176, 191, 209, 0.28);
}

:root[data-theme="dark"] .theme-btn {
  color: #d7e1ec;
}

:root[data-theme="dark"] .theme-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .diff-toggle-slider {
  background: #4b5768;
  border-color: rgba(176, 191, 209, 0.34);
}

:root[data-theme="dark"] .diff-toggle-slider::after {
  background: #ecf2f9;
}

.diff-output-view {
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.45rem;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.9rem;
}

.diff-line {
  margin: 0.2rem 0;
  padding: 0.36rem 0.45rem;
  border-radius: 8px;
  white-space: pre-wrap;
}

.diff-line.same {
  background: rgba(46, 125, 50, 0.12);
  color: #145a1a;
}

.diff-line.add {
  background: rgba(2, 132, 199, 0.14);
  color: #0c4a6e;
}

.diff-line.remove {
  background: rgba(220, 38, 38, 0.14);
  color: #7f1d1d;
}

.random-picker-result-list {
  counter-reset: pick;
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.5rem 0.4rem 0.4rem;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  background: var(--surface-soft);
  min-height: 130px;
  max-height: 280px;
  overflow: auto;
}

.random-picker-result-list li {
  counter-increment: pick;
  display: grid;
  grid-template-columns: 4ch minmax(0, 1fr);
  align-items: start;
  gap: 0.45rem;
  margin: 0.3rem 0;
  line-height: 1.35;
}

.random-picker-result-list li::before {
  content: counter(pick) ".";
  justify-self: end;
  text-align: right;
  color: var(--muted);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.random-picker-result-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.random-picker-preset-row {
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

#random-picker-card .grid.two-col {
  align-items: start;
}

#random-picker-card .grid.two-col > .panel {
  align-self: start;
}

.diff-line.change {
  background: rgba(217, 119, 6, 0.14);
  color: #78350f;
}

#route-trace-card .panel .button-row {
  flex-wrap: wrap;
}

#route-trace-card .panel .button-row button {
  min-width: 150px;
}

.password-options {
  display: grid;
  gap: 0.4rem;
}

.password-options label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
}

.password-options input[type="checkbox"] {
  width: auto;
}

.time-now-display,
#time-date-display {
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}

.time-now-display {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  width: min(100%, 24ch);
  margin-left: auto;
  margin-right: auto;
}

#time-date-display {
  font-size: clamp(2.1rem, 6.2vw, 3.8rem);
  width: min(100%, 24ch);
  margin-left: auto;
  margin-right: auto;
  -webkit-appearance: none;
  appearance: none;
}

#time-now-card .panel {
  justify-items: stretch;
  text-align: center;
}

.countdown-display {
  font-size: clamp(1.2rem, 3.4vw, 2rem);
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 12px;
  background: var(--surface-soft);
}

.time-fullscreen-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000000;
  color: #f4f7fb;
  z-index: 9999;
}

.time-fullscreen-view.fs-alt {
  background: #ffffff;
  color: #111111;
}

.time-fullscreen-clock {
  font-size: clamp(3rem, 11vw, 10rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  user-select: none;
  pointer-events: none;
}

.countdown-fullscreen-clock {
  font-size: clamp(2rem, 7.5vw, 6.4rem);
}

.time-fullscreen-view:not(:fullscreen) {
  display: none;
}

.calc-pad {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.calc-pad button {
  padding: 0.56rem 0.3rem;
}

.calc-expression,
.calc-result {
  font-family: "Cambria Math", "Times New Roman", Georgia, serif;
  letter-spacing: 0.02em;
  font-size: 1.03rem;
  background: linear-gradient(180deg, var(--calc-field-bg-top), var(--calc-field-bg-bottom));
  color: var(--ink);
}

.calc-result {
  font-style: italic;
}

.calc-btn {
  font-weight: 700;
  border: 1px solid rgba(17, 26, 42, 0.18);
}

.calc-btn-wide {
  grid-column: span 2;
}

.calc-btn-num {
  background: linear-gradient(120deg, #334e68, #486581);
}

.calc-btn-num:hover {
  box-shadow: 0 6px 18px rgba(51, 78, 104, 0.35);
}

.calc-btn-op {
  background: linear-gradient(120deg, #c05621, #dd6b20);
}

.calc-btn-op:hover {
  box-shadow: 0 6px 18px rgba(192, 86, 33, 0.35);
}

.calc-btn-fn {
  background: linear-gradient(120deg, #c05621, #dd6b20);
}

.calc-btn-fn:hover {
  box-shadow: 0 6px 18px rgba(192, 86, 33, 0.35);
}

.calc-btn-ctrl {
  background: linear-gradient(120deg, #4a5568, #718096);
}

.calc-btn-ctrl:hover {
  box-shadow: 0 6px 18px rgba(74, 85, 104, 0.35);
}

.calc-equal {
  background: linear-gradient(120deg, #1b5cff, #3b7bff);
}

.mouse-test-area {
  border: 1px dashed rgba(40, 45, 58, 0.24);
  border-radius: 10px;
  min-height: 120px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  user-select: none;
}

:root[data-theme="dark"] .nav-link {
  background: rgba(30, 39, 53, 0.86);
  border-color: rgba(176, 191, 209, 0.24);
}

:root[data-theme="dark"] .nav-link.active {
  background: linear-gradient(120deg, rgba(255, 106, 61, 0.3), rgba(255, 131, 71, 0.26));
  border-color: rgba(255, 156, 122, 0.48);
}

.media-preview-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.media-column {
  display: grid;
  gap: 0.55rem;
}

.media-audio-controls {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.55rem;
}

.camera-preview {
  display: block;
  width: 100%;
  height: 220px;
  border-radius: 10px;
  border: 1px solid rgba(40, 45, 58, 0.24);
  background: var(--media-preview-bg);
  object-fit: cover;
}

.camera-shot {
  display: block;
  width: 100%;
  height: 220px;
  border-radius: 10px;
  border: 1px solid rgba(40, 45, 58, 0.24);
  background: var(--media-shot-bg);
  object-fit: contain;
}

.camera-shot.is-empty {
  background: var(--media-shot-bg);
}

.mic-level {
  width: 100%;
  height: 16px;
  color-scheme: light;
}

.recorded-audio {
  width: 100%;
  border-radius: 10px;
  background: var(--surface);
  color-scheme: light;
}

.recorded-audio::-webkit-media-controls-panel {
  background: var(--surface);
}

:root[data-theme="dark"] input[type="file"]::file-selector-button,
:root[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  border-color: rgba(176, 191, 209, 0.32);
  background: rgba(43, 54, 69, 0.88);
  color: #dbe6f2;
}

:root[data-theme="dark"] .recorded-audio {
  color-scheme: dark;
  border: 1px solid rgba(176, 191, 209, 0.22);
  background: rgba(24, 32, 44, 0.92);
}

:root[data-theme="dark"] .recorded-audio::-webkit-media-controls-panel {
  background: #1a2330;
}

:root[data-theme="dark"] .mic-level {
  color-scheme: dark;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) translateX(12px) rotate(4deg);
  }
}

@media (max-width: 900px) {
  .hero-controls {
    position: static;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
  }

  .theme-switcher {
    width: fit-content;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    height: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    gap: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .nav-group {
    display: flex;
    gap: 0.5rem;
    margin: 0;
  }

  .nav-group-title {
    display: none;
  }

  .sidebar h2 {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .app {
    margin: 0.6rem auto 0.06rem;
  }

  .qr-output {
    min-height: 188px;
  }

  .cron-grid {
    grid-template-columns: 1fr;
  }

  .image-process-two-col-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-preview-grid {
    grid-template-columns: 1fr;
  }

  .media-audio-controls {
    grid-column: auto;
  }

  .cron-grid > div:last-child {
    grid-column: auto;
  }
}

@media (max-height: 860px) {
  .app {
    margin: 0.55rem auto 0.04rem;
    gap: 0.62rem;
  }

  .hero {
    padding-top: 0.2rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .card {
    padding: 0.82rem;
  }
}
