@font-face {
  font-family: Telegraf;
  src: url(fonts/Telegraf-UltraLight.woff2) format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Telegraf;
  src: url(fonts/Telegraf-Regular.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Telegraf;
  src: url(fonts/Telegraf-Bold.woff2) format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Telegraf;
  src: url(fonts/Telegraf-UltraBold.woff2) format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0e0f13;
  --panel: #16171c;
  --panel-muted: #1c1d24;
  --canvas-bg: #0b0c10;
  --border: #2a2b33;
  --border-light: #35363f;
  --text: #e6e8ee;
  --text-muted: #9a9cab;
  --text-dim: #6b6d7a;
  --accent: #6b8afd;
  --accent-hover: #7d9aff;
  --input-bg: #1c1d24;
  --button-bg: #2a2b33;
  --button-active: #3d3f4a;
  --shadow: rgba(0, 0, 0, 0.45);
  --font: Telegraf, system-ui, sans-serif;
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

#app {
  display: flex;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#sidebarInner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: #000000 #1c1d24;
}

#sidebarInner::-webkit-scrollbar {
  width: 10px;
}

#sidebarInner::-webkit-scrollbar-track {
  background: #1c1d24;
}

#sidebarInner::-webkit-scrollbar-thumb {
  background: #000000;
  border-radius: 5px;
  border: 2px solid #1c1d24;
}

#title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}

.section {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 6px 0 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.section.first {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.control {
  margin-bottom: 4px;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.control-row label,
.control-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.control-value {
  font-size: 9px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.check-row input {
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  background: transparent;
  cursor: pointer;
  margin: 2px 0;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: #2a2b33;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #2a2b33;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #16171c;
  box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #16171c;
  box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]:hover::-webkit-slider-thumb {
  background: var(--accent-hover);
  box-shadow: 0 0 0 1px var(--accent-hover);
}

select,
.readonly {
  width: 100%;
  padding: 4px 6px;
  font-size: 10px;
  font-family: var(--font);
  border: 1px solid var(--border-light);
  border-radius: 0;
  margin-bottom: 4px;
  background: var(--input-bg);
  color: var(--text);
}

.readonly {
  opacity: 0.7;
  cursor: default;
}

button {
  width: 100%;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font);
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
}

button:hover {
  background: var(--button-active);
  color: var(--text);
}

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.hint {
  font-size: 7px;
  color: var(--text-dim);
  line-height: 1.3;
  margin: 8px 0 4px;
}

.credit {
  font-size: 7px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 8px;
}

.credit a {
  color: var(--text-muted);
  text-decoration: none;
}

.credit a:hover {
  color: var(--accent);
}

#stage {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--canvas-bg);
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

#info {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 10;
  pointer-events: none;
  font-family: var(--font);
  font-size: 9px;
  color: var(--text-muted);
  background: rgba(14, 15, 19, 0.82);
  border: 1px solid var(--border);
  padding: 6px 8px;
  min-width: 148px;
  line-height: 1.45;
  backdrop-filter: blur(4px);
}

#info .info-title {
  color: var(--text);
  margin-bottom: 4px;
  font-size: 10px;
}

#info span {
  color: var(--text);
}

@media (max-width: 640px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    height: auto;
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
