* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  height: 100dvh;
  background: #f5f5f5;
  color: #333;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-wrap {
  flex: 1;
  background: #fff;
  overflow: hidden;
  min-height: 0;
}

canvas {
  display: block;
  touch-action: none;
}

.info-bar {
  flex-shrink: 0;
  margin: 0 -16px;
  background: #fff;
  padding: 6px 16px;
  font-size: 12px;
  color: #9b59b6;
  border-top: 1px solid #eee;
}

.info-title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table td {
  width: 50%;
  text-align: left;
  padding: 1px 0;
}

.vl {
  color: #f39c12;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vl-blade {
  width: 14px;
  height: 9px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.controls {
  flex-shrink: 0;
  background: #fff;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #eee;
}

.group {
  background: #f8f8f8;
  border-radius: 10px;
  padding: 10px 12px;
}

.group-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.row {
  display: flex;
  gap: 8px;
}

.group .row + .row {
  margin-top: 8px;
}

.field {
  flex: 1;
}

.field label {
  display: block;
  font-size: 10px;
  color: #999;
  margin-bottom: 2px;
}

.field input,
.field select {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.field input {
  -webkit-appearance: none;
}

.field input + input {
  margin-top: 4px;
}

.field input[type="color"] {
  height: 34px;
  padding: 2px;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  border-color: #667eea;
}

.btn-calc {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  border: none;
  background: #f8f8f8;
  color: #9b59b6;
  border-radius: 10px;
  cursor: pointer;
}
.btn-calc:active {
  background: #f3eef8;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  line-height: 1.8;
}
.modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal-box h3 {
  position: sticky;
  top: 0;
  background: #fff;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  color: #9b59b6;
  z-index: 1;
}
.modal-box .step {
  margin-bottom: 8px;
}
.modal-box .step-title {
  font-weight: 600;
  color: #333;
}
.modal-box .step-val {
  color: #666;
}
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
