:root {
  color-scheme: light;
  --paper: #faf6ee;
  --paper-deep: #f1eadf;
  --frame-bg: rgba(255, 255, 255, 0.72);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-soft: rgba(255, 255, 255, 0.66);
  --surface-tint: rgba(249, 245, 237, 0.92);
  --rule: rgba(92, 121, 162, 0.12);
  --margin-rule: rgba(201, 93, 80, 0.15);
  --border: rgba(92, 121, 162, 0.18);
  --border-strong: rgba(92, 121, 162, 0.28);
  --frame-outline: rgba(92, 121, 162, 0.1);
  --text: #243246;
  --muted: #5a6f8e;
  --soft: #73839a;
  --blue: #4f79b3;
  --green: #73984d;
  --amber: #cf8340;
  --cyan: #5a8fc5;
  --red: #cf6a69;
  --purple: #8c7ac8;
  --pink: #c56e95;
  --button-bg: rgba(255, 255, 255, 0.76);
  --badge-bg: rgba(255, 255, 255, 0.62);
  --mini-bg: rgba(255, 255, 255, 0.6);
  --icon-start: rgba(255, 255, 255, 0.96);
  --icon-end: rgba(244, 238, 227, 0.9);
  --scroll-track: rgba(108, 134, 170, 0.12);
  --scroll-thumb: rgba(92, 121, 162, 0.38);
  --scroll-thumb-hover: rgba(92, 121, 162, 0.52);
  --shadow: 0 18px 34px rgba(63, 72, 95, 0.08);
  --shadow-soft: 0 8px 18px rgba(63, 72, 95, 0.06);
  --paper-lift: 4px 4px 0 rgba(35, 49, 69, 0.05);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d1523;
  --paper-deep: #121d30;
  --frame-bg: rgba(16, 23, 36, 0.84);
  --surface: rgba(22, 31, 47, 0.9);
  --surface-soft: rgba(26, 37, 56, 0.82);
  --surface-tint: rgba(18, 26, 40, 0.96);
  --rule: rgba(113, 137, 176, 0.11);
  --margin-rule: rgba(203, 120, 97, 0.12);
  --border: rgba(131, 155, 193, 0.2);
  --border-strong: rgba(151, 176, 214, 0.3);
  --frame-outline: rgba(151, 176, 214, 0.08);
  --text: #e8eef8;
  --muted: #9faec4;
  --soft: #b7c2d3;
  --blue: #94b5e6;
  --green: #98bb72;
  --amber: #e2a25f;
  --cyan: #9bc5f0;
  --red: #e09190;
  --purple: #bfaff3;
  --pink: #d99abc;
  --button-bg: rgba(26, 36, 53, 0.88);
  --badge-bg: rgba(28, 39, 58, 0.84);
  --mini-bg: rgba(24, 34, 50, 0.84);
  --icon-start: rgba(30, 42, 62, 0.96);
  --icon-end: rgba(20, 29, 44, 0.96);
  --scroll-track: rgba(113, 137, 176, 0.18);
  --scroll-thumb: rgba(151, 176, 214, 0.34);
  --scroll-thumb-hover: rgba(151, 176, 214, 0.48);
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.26);
  --paper-lift: 4px 4px 0 rgba(5, 10, 17, 0.24);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--scroll-thumb) 82%, var(--paper) 18%) 0%,
    color-mix(in srgb, var(--scroll-thumb) 94%, var(--paper-deep) 6%) 100%
  );
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  transition: background 0.22s ease, box-shadow 0.22s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--scroll-thumb-hover) 84%, var(--paper) 16%) 0%,
    color-mix(in srgb, var(--scroll-thumb-hover) 96%, var(--paper-deep) 4%) 100%
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paper) 18%, transparent);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body.dt-page {
  margin: 0;
  min-height: 100svh;
  padding: clamp(16px, 2.4vw, 28px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: var(--qx-font-body, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif);
  color: var(--text);
  background:
    linear-gradient(90deg, transparent 0 42px, var(--margin-rule) 42px 44px, transparent 44px),
    linear-gradient(0deg, var(--rule) 1px, transparent 1px),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
  background-size: 100% 100%, 100% 28px, 100% 100%;
}

@media (min-height: 760px) {
  body.dt-page {
    align-items: center;
  }
}

body.dt-page > * {
  width: min(1320px, 100%);
}

.dt-shell {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 24px 20px 26px 20px;
  background: var(--frame-bg);
  box-shadow: var(--shadow), var(--paper-lift);
  overflow: hidden;
}

.dt-shell::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid var(--frame-outline);
  border-radius: 20px 16px 22px 18px;
  pointer-events: none;
}

.dt-grid-bg {
  background-image:
    linear-gradient(0deg, var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 121, 162, 0.04) 1px, transparent 1px);
  background-size: 100% 28px, 28px 100%;
}

.dt-surface {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: 18px 15px 20px 14px;
  box-shadow: var(--paper-lift), var(--shadow-soft);
}

.dt-window-bar {
  background: color-mix(in srgb, var(--surface-soft) 86%, var(--surface-tint) 14%);
  border-bottom: 1px solid color-mix(in srgb, var(--border-strong) 76%, transparent);
}

.dt-title {
  font-family: var(--qx-font-heading-alt, var(--qx-font-body, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dt-kicker {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dt-mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.dt-label-box {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-strong) 74%, transparent);
  border-radius: 16px 13px 18px 12px;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--paper) 20%, transparent);
}

.dt-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface-soft) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px 10px 14px 10px;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--paper) 22%, transparent);
}

.dt-tag--pill {
  border-radius: 999px;
}

.dt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  background: var(--button-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 12px 10px 14px 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--paper) 22%, transparent);
  transition:
    border-color 0.22s ease,
    color 0.22s ease,
    transform 0.28s var(--ease-smooth),
    background-color 0.22s ease,
    box-shadow 0.28s ease,
    opacity 0.22s ease;
}

.dt-button:hover:not(:disabled) {
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.dt-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dt-button--primary {
  color: color-mix(in srgb, var(--text) 66%, var(--blue) 34%);
  background: color-mix(in srgb, var(--blue) 14%, var(--button-bg) 86%);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--border) 60%);
}

.dt-button--danger:hover:not(:disabled),
.dt-button--danger.is-active {
  color: color-mix(in srgb, var(--text) 70%, var(--red) 30%);
  border-color: color-mix(in srgb, var(--red) 42%, var(--border) 58%);
  background: color-mix(in srgb, var(--red) 12%, var(--button-bg) 88%);
}

.dt-button.is-active {
  color: color-mix(in srgb, var(--text) 68%, var(--blue) 32%);
  border-color: color-mix(in srgb, var(--blue) 42%, var(--border) 58%);
  background: color-mix(in srgb, var(--blue) 12%, var(--button-bg) 88%);
}

.dt-select-wrap {
  position: relative;
  display: inline-flex;
  min-width: 248px;
}

.dt-select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-60%) rotate(45deg);
  pointer-events: none;
}

.dt-select {
  appearance: none;
  width: 100%;
  min-height: 42px;
  padding: 9px 40px 9px 14px;
  border-radius: 12px 10px 14px 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--button-bg) 94%, transparent);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--paper) 24%, transparent);
}

.dt-button:focus-visible,
.dt-select:focus-visible,
button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 72%, white 28%);
  outline-offset: 3px;
}

.dt-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dt-dot--info { background: var(--blue); }
.dt-dot--success { background: var(--green); }
.dt-dot--warning { background: var(--amber); }
.dt-dot--danger { background: var(--red); }
.dt-dot--purple { background: var(--purple); }
.dt-dot--pink { background: var(--pink); }

.dt-status-panel {
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
  border: 1px solid var(--border);
  border-radius: 16px 13px 18px 12px;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--paper) 18%, transparent);
}

.dt-result {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 0.34s ease,
    transform 0.34s var(--ease-smooth),
    border-color 0.24s ease,
    background-color 0.24s ease,
    color 0.24s ease;
}

.dt-result.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.state-allow {
  background: color-mix(in srgb, var(--green) 12%, var(--surface) 88%);
  color: color-mix(in srgb, var(--text) 82%, var(--green) 18%);
  border: 1px solid color-mix(in srgb, var(--green) 38%, var(--border) 62%);
}

.state-block {
  background: color-mix(in srgb, var(--red) 12%, var(--surface) 88%);
  color: color-mix(in srgb, var(--text) 80%, var(--red) 20%);
  border: 1px solid color-mix(in srgb, var(--red) 38%, var(--border) 62%);
}

.state-warn {
  background: color-mix(in srgb, var(--amber) 14%, var(--surface) 86%);
  color: color-mix(in srgb, var(--text) 82%, var(--amber) 18%);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--border) 62%);
}
