
  * { box-sizing: border-box; }
  body {
    margin: 0;
    padding: 20px;
    background: #f3f3f3;
    color: #222;
    font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", sans-serif;
  }
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }
  h1 { margin: 0 0 18px; font-size: 24px; }
  h2 { margin: 0 0 10px; font-size: 17px; }
  .panel {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
  }
  .draggable-section { position: relative; }
  .draggable-section.dragging { opacity: 0.45; }
  .drag-handle {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f5f5f5;
    color: #666;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    font-size: 18px;
    line-height: 1;
  }
  .drag-handle:active { cursor: grabbing; }
  #matrixCanvas { touch-action: none; cursor: default; }
  .draggable-section > h2 { padding-left: 34px; }
  .row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
  }
  .pc-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  label { font-size: 14px; }
  input[type="text"], input[type="number"], select {
    padding: 8px 10px;
    border: 1px solid #aaa;
    border-radius: 5px;
    font-size: 14px;
    background: white;
  }
  input[type="text"] { min-width: 180px; }
  button {
    padding: 8px 12px;
    border: 1px solid #888;
    border-radius: 5px;
    background: #eee;
    cursor: pointer;
    font-size: 14px;
  }
  button:hover { background: #ddd; }
  .danger { background: #f4dddd; }
  .status {
    color: #555;
    font-size: 13px;
    min-height: 20px;
  }
  #preview {
    overflow: auto;
    background: #ddd;
    padding: 12px;
    border-radius: 6px;
  }
  #matrixCanvas {
    display: block;
    max-width: none;
    height: auto;
    background: white;
    margin: 0 auto;
    cursor: pointer;
  }
  .small {
    font-size: 12px;
    color: #666;
  }
  .emotion-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-bottom: 10px;
  }
  .emotion-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .emotion-grid select { max-width: 100%; }
  .emotion-list {
    margin-top: 12px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
  }
  .emotion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
  }
  .emotion-item .arrow { color: #666; }
  .emotion-item button {
    margin-left: auto;
    padding: 4px 8px;
    font-size: 12px;
  }
  .emotion-direction-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }
  .emotion-direction { margin: 0; }
  .emotion-direction label { display: block; margin-bottom: 4px; }
  @media (max-width: 700px) {
    body { padding: 10px; }
    .panel { padding: 12px; }
    .drag-handle { top: 6px; left: 6px; }
    .draggable-section > h2 { padding-left: 32px; }
    .pc-grid { grid-template-columns: 1fr; }
    input[type="text"] { min-width: 0; width: 100%; }
    select, input[type="number"] { max-width: 100%; }
    .emotion-grid { flex-direction: column; align-items: flex-start; gap: 8px; }
    .emotion-grid label { width: 100%; }
    .emotion-direction-row { flex-direction: column; }
    .emotion-direction { width: 100%; }
    .emotion-direction select { max-width: 100%; }
    .row > label { max-width: 100%; }
    .row > label select { max-width: 100%; }
  }
