:root {
  --bg:       #16181c;
  --card:     #1c1f25;
  --border:   rgba(255,255,255,0.12);
  --link:     rgb(79, 156, 255);
  --muted:    #94a3b8;
  --accent:   #bb86fc;
}

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

html {
  overflow: hidden;
}

body {
  font-family: 'Courier New', Courier, monospace;
  background: var(--bg);
  color: snow;
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

h1 { margin: 0 0 8px; font-size: 20px; }

.subtitle {
  font-size: 13px;
  color: snow;
  margin: 0;
  opacity: 0.85;
}

a { color: var(--link); }

.card {
  border: 1px solid var(--border);
  padding: 20px;
  width: 100%;
  max-width: 820px;
}

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

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
}

.grid > div:last-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.row-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-suffix-wrap {
  position: relative;
  width: 100%;
}

.input-suffix-wrap input {
  width: 100%;
  padding-right: 48px;
}

.input-suffix {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: Consolas, monaco, monospace;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  user-select: none;
}

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 0 9px;
  height: 34px;
  line-height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: snow;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

input:not([type="range"]):focus {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

select:focus {
  outline: none;
  border-color: var(--border);
  box-shadow: none;
}

input[type="range"] { border: none; padding: 0; cursor: pointer; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

option {
  background-color: #1c1f25;
  color: snow;
}

option:hover,
option:focus,
option:checked {
  background-color: #2a2d35;
}

.slider-value {
  width: 32px;
  font-family: Consolas, monaco, monospace;
  padding: 4px 0;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: snow;
}

button {
  cursor: pointer;
  font-family: Consolas, monaco, monospace;
  font-size: 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: snow;
  padding: 6px 12px;
}

button:hover { border-color: rgba(255, 255, 255, 0.6); background-color: rgba(255, 255, 255, 0.04); }

.btn-primary { border-color: var(--link); color: var(--link); }
.btn-primary:hover { border-color: rgb(130, 190, 255); color: rgb(130, 190, 255); background-color: rgba(79, 156, 255, 0.06); }

.btn-danger { border-color: #ef4444; color: #ef4444; }
.btn-danger:hover { border-color: #f87171; color: #f87171; background-color: rgba(239, 68, 68, 0.06); }

.dpi-adjust {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
}

.results {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--border);
}

.result {
  flex: 1 1 0;
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
  margin-top: -1px;
}

.result:last-child { border-right: none; }

.results::after {
  content: '';
  display: block;
  width: 100%;
  border-top: none;
}

.result > div:last-child {
  font-size: 15px;
  font-weight: 600;
  font-family: Consolas, monaco, monospace;
  margin-top: 4px;
}

.notes {
  margin-top: 14px;
  border: 1px solid var(--border);
}

.notes summary {
  list-style: none;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.notes summary::before {
  content: "> ";
  font-family: Consolas, monaco, monospace;
  color: var(--accent);
}

.notes[open] summary::before { content: "v "; }

.notes pre {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-family: Consolas, monaco, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.small  { font-size: 13px; }
.muted  { color: var(--muted); }

.error-msg {
  font-size: 12px;
  color: #ef4444;
  margin-top: 5px;
  font-family: Consolas, monaco, monospace;
}

.hidden {
  display: none !important;
}

input.input-error {
  border-color: #ef4444;
}