* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: #222;
  background: #999;
}

.app {
  display: flex;
  min-height: 100vh;
}

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

.sidebar {
  width: 320px;
  flex: 0 0 320px;
  background: #d8d8d8;
  border-right: 1px solid #999;
  padding: 14px;
  overflow-y: auto;
  height: 100vh;
}

.sidebar h1 {
  font-size: 16px;
  margin: 0 0 4px 0;
}

.sidebar .version {
  font-weight: normal;
  color: #666;
  font-size: 12px;
}

.disclaimer {
  font-size: 11px;
  color: #555;
  background: #eee;
  border: 1px solid #bbb;
  padding: 6px 8px;
  border-radius: 3px;
  margin: 0 0 12px 0;
}

.history-toolbar {
  display: flex;
  gap: 8px;
  margin: 0 0 4px 0;
}

.history-toolbar button {
  margin-bottom: 0;
}

.history-hint {
  margin: 0 0 12px 0;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #e8e8e8;
}

button:disabled:hover {
  background: #e8e8e8;
}

fieldset {
  border: 1px solid #b3b3b3;
  background: #e4e4e4;
  border-radius: 4px;
  padding: 10px;
  margin: 0 0 12px 0;
}

legend {
  font-weight: bold;
  font-size: 12px;
  padding: 0 4px;
  color: #333;
}

.field {
  display: block;
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #333;
}

.field input[type="text"],
.field input[type="color"],
.field textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
}

.field input[type="range"] {
  display: block;
  width: 100%;
  margin-top: 3px;
}

.paired-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.paired-row input[type="range"] {
  flex: 1;
  margin-top: 0;
}

.paired-row input[type="number"] {
  width: 66px;
  flex: 0 0 auto;
  padding: 3px 4px;
  font-size: 12px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
}

.preset-row,
.utility-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px 0;
}

.preset-label {
  flex-basis: 100%;
  font-size: 11px;
  color: #666;
}

.preset-btn {
  width: auto;
  flex: 0 0 auto;
  padding: 4px 9px;
  margin-bottom: 0;
  font-size: 11px;
}

.utility-row button {
  width: auto;
  flex: 1 1 calc(50% - 6px);
  margin-bottom: 0;
  font-size: 11.5px;
  padding: 6px 4px;
}

.field input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 3px;
  font-size: 11px;
}

.val {
  float: right;
  font-weight: bold;
  color: #555;
}

.radio-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.hint {
  font-size: 11px;
  color: #666;
  margin: 4px 0 0 0;
}

button {
  display: block;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  border: 1px solid #888;
  border-radius: 3px;
  background: #f0f0f0;
  cursor: pointer;
}

button:hover {
  background: #e2e2e2;
}

button:active {
  background: #d0d0d0;
}

button:last-child {
  margin-bottom: 0;
}

.dims {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11.5px;
  color: #444;
  line-height: 1.6;
}

/* ---------- Canvas area ---------- */

.canvas-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px;
  overflow: auto;
  background: repeating-linear-gradient(
    45deg,
    #a8a8a8,
    #a8a8a8 10px,
    #9c9c9c 10px,
    #9c9c9c 20px
  );
}

#jcard-canvas {
  background: #fff;
  border: 1px solid #444;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  width: 610px;
  height: auto;
  cursor: grab;
  touch-action: none;
}

#jcard-canvas:active {
  cursor: grabbing;
}
